Presentation is loading. Please wait.

Presentation is loading. Please wait.

Processing Order: Cooperative vs. Preemptive Process B2 Process A Process C Process B1 Process D Process A (low priority, cyclic) Process C (high priority,

Similar presentations


Presentation on theme: "Processing Order: Cooperative vs. Preemptive Process B2 Process A Process C Process B1 Process D Process A (low priority, cyclic) Process C (high priority,"— Presentation transcript:

1 Processing Order: Cooperative vs. Preemptive Process B2 Process A Process C Process B1 Process D Process A (low priority, cyclic) Process C (high priority, cyclic) Process B (low priority) Process D (high priority) OS Preemptive Multitasking Cooperative Multitasking Processes (tasks) are run in an infinite loop If task takes too much time (B), need to divide it No overhead occurs Scheduling is performed by the OS Long task is suspended if needed Overhead: caused by OS internals Copyright © 2011 DSR Corporation 1

2 Task States (ITRON Case) Ready: could run but the CPU is busy Executing: running on the CPU Blocked: waits for something (I/O, signal, resource, etc.) Dormant (hibernation): created task that is not started NON-EXISTENT: deleted or not created task The RTOS implements a Finite State Machine for each task and manages its transitions. Copyright © 2011 DSR Corporation 2

3 Task State Transitions Ready Executing Dormant state Task scheduled Preemption Wait state Wait for the event Task can be executed at any time unlock waiting resuming waiting suspend Execution is suspended Only one task running Copyright © 2011 DSR Corporation 3

4 Preemption Ready to run Executing Time High Priority ready-to-run state Executing dormant state dispatch pre-emption waiting state A 123 waiting unlock waiting suspend resuming Task is in the ready state Task is scheduled to run – running state Priority of some task is changed to high Copyright © 2011 DSR Corporation 4

5 Close Example: the task runs until finishing the function Execution of tasks to complete TASK(…) { ………… } HibernationReady to run Executing ready-to-run state Executing dormant state dispatch pre-emption waiting state A 123 waiting unlock waiting suspend resuming Copyright © 2011 DSR Corporation 5

6 Starting Start task executing from the beginning. Task was executing, then it was suspended TASK(…) { ………… } HibernationReady to run Executing ready-to-run state Executing dormant state Dispatch pre-emption waiting state A 123 waiting unlock waiting suspend resuming Copyright © 2011 DSR Corporation 6

7 Wait Example: Wait for an event for 40 msec. Running task is waiting for an event. When AN event rises, task gets ready for execution. TASK(…) { ………… 40msec Wait ………… } Wait state Ready to run Executing ready-to-run state Executing dormant state Dispatch pre-emption waiting state A 123 waiting unlock waiting suspend resuming Copyright © 2011 DSR Corporation 7

8 Wait Release Start execution of the task from the last point. Waiting task becomes ready to run. TASK(…) { ………… 40msec Wait ………… } Wait stateReady to run Executing ready-to-run state Executing dormant state Dispatch pre-emption waiting state A 123 waiting unlock waiting suspend resuming Copyright © 2011 DSR Corporation 8


Download ppt "Processing Order: Cooperative vs. Preemptive Process B2 Process A Process C Process B1 Process D Process A (low priority, cyclic) Process C (high priority,"

Similar presentations


Ads by Google