20
1 VxWorks 5.4 Group A3: Wafa’ Jaffal Kathryn Bean

vxworks

Embed Size (px)

Citation preview

Page 1: vxworks

1

VxWorks 5.4

Group A3:Wafa’ JaffalKathryn Bean

Page 2: vxworks

2

• What is Real Time Operating System (RTOS)

• Standard for RTOS

• VxWorks Features as RTOS

• Layer Structure

• Microkernal Functions:

• Multitasking

• Scheduling

• Interrupt Service Code

• Shared Code and Reentrancy

• Intertask Communications

• Applications for VxWorks

Topics Covered

Page 3: vxworks

3

What is Real Time OS (RTOS)

RTOS Characteristics

• Processing must be done within a time constraint or the system will fail.

• All delays in the system will be bounded; from the retrieval of stored data to the time RTOS finishes the request.

Types of RTOS

• Hard RTOS

• Soft RTOS

Page 4: vxworks

4

Standard for RTOS• Standard requirement for RTOS

POSIX 1003.1b by ISO/IEEE chapter.

• Asynchronous I/O

• Semaphore

• Message queues

• Queued signals

• Scheduling

• Clocks and timers

• Memory management

POSIX interfaces:

Page 5: vxworks

5

VxWorks OS as RTOS

Page 6: vxworks

6

Layer Structure

Real-Time Embedded Application

Graphics Multiprocessing

Internet

Java Support POSIX Library File System

WindNet Networking

Wind MicrokernalCore OS:

Page 7: vxworks

7

MultitaskingP R D

S

• Suspended – used primarily for debugging

• Ready – wait for CPU,

a single primitive=create+activate

• Pended – blocked, wait t time for recourses. After t - Error.

• Delay – asleep for t time, after t goes to ready state.

On a context switch, a task’s context is saved in TCB. All code executes in a single common space. Memory isn’t saved.

Page 8: vxworks

8

Scheduling, One CPU• Priority-based preemptive scheduling

• Each task has priority (from 0 - highest to 255 - lowest). Each priority has its own queue.

• If two tasks are in the ready state, a lower priority task would be pre-empted by one of a higher priority.

• Round-robin scheduling

After time slice for a task expires, another task with the same priority will execute during the given time slice.

• Preemption locks

These locks prevent task context switching, but do not prevent interrupt handling.

Page 9: vxworks

9

Interrupt Service Code

Via interrupts, the system is informed of external events.

• Interrupt Service Routines (ISRs) run outside any task context.

• Interrupt handling involves no task context switch.• Limitations of ISR:

• All ISRs share the same stack

• ISR has no context that can be suspended

• Cannot take the semaphore, but can give the semaphores, releasing any task waiting on them.

• Cannot perform I/O through drivers except pipe.

Page 10: vxworks

10

Shared Code and Reentrancy

• Shared Code - a single copy of code executed by multiple tasks.

• Shared Code must be reentrant. A subroutine is reentrant if a single copy of the routine can be called simultaneously from several task contexts without conflict.

Reentrancy Techniques:

• Dynamic Stack Variables

• Global and Static Variables Guarded by Semaphores

• Task Variables

Page 11: vxworks

11

Shared Code and Reentrancy, Continued

Task1( ){ …..

comFun(myData1)

}

Task2( ){ …..

comFun(myData2)

}

comFun(yourData){

}

myData1

myData2

Dynamic Stack Variables

Tasks Task Stacks Common Function

Page 12: vxworks

12

Shard Code and Reentrancy, Continued

• Guarded Global and Static Variables

Mutual-exclusion mechanism - only one task at a time can be in a critical section of the code.

• Task Variables

Four byte variables are added to the task context block (TCB).

Page 13: vxworks

13

Intertask Communications, One CPU

• Shared Data

• Message Queue

• Pipes - Virtual I/0

• Network Intertask Communication• Sockets• Remote Procedure Call

Types of Intertask Communications:

Page 14: vxworks

14

Intertask Communication, Shared Data

Access SharData

Access SharData

Tasks Memory

Access SharData

SharData

1.

2.

3.

Page 15: vxworks

15

Semaphores

Semaphore - mechanism for mutual exclusion and intertask communication.• Binary Semaphore

Semaphore

available

TimeOut=

No_Wait

Task is pended for timeOut

Task cont.

Semaphore taken

NONO NO

YES

Task cont.

Semaphore not taken

YES

Page 16: vxworks

16

Semaphores, Continued

• Is semaphore is given and no tasks are blocked, count ++

• Counting Semaphore• Every time is semaphore is given count ++• Every time is semaphore is taken count --• If count=0, task that tried to take semaphore is blocked• If semaphore is given and task is blocked, task is unblocked

• Special Semaphore Option (Not in POSIX)

• Timeout

Time the task is willing to wait (time in ticks) in pended state. If time > timeout, ERROR occurs.

Page 17: vxworks

17

Intertask Communication, Message Queue

• Allows a variable number of messages to be queued

• Any task or ISR can send a message to a queue.

• Multiple tasks can send and receive from the same message queue.• Timeout Parameter:

• Send message: how long to wait for buffer space to place message.

• Receive message: how long to wait to obtain message.

Page 18: vxworks

18

Applications for VxWorks

• Flight simulators

• Radio and optical telescopes

• Navigation systems

• Deep sea instrumentation

• Traffic control systems

• Modems … any systems where rigid time requirement have been placed on the operation of a processor or the flow of the data.

Some usage of RTOS

• Printers

• Digital cameras

• Hand-held computing devices

• Routers, switches, and other network devices

Page 19: vxworks

19

Thank You

Any Questions ?

Page 20: vxworks

20

Bibliography

VxWorks 5.4 Programmer Guide