tasks and task management : --time-critical tasks --contending tasks --communicating tasks

Download Tasks and Task Management : --Time-critical tasks --Contending tasks --Communicating tasks

If you can't read please download the document

Upload: wilfrid-darcy-hicks

Post on 08-Jan-2018

267 views

Category:

Documents


0 download

DESCRIPTION

table_12_00 RTOS timeliness constraints

TRANSCRIPT

Tasks and Task Management : --Time-critical tasks --Contending tasks --Communicating tasks fig_12_00 Time durations: vocabulary --Time can be absolute (real-world) or relative to another event --Intervals can be equal (same start/stop time) or of equal duration table_12_00 RTOS timeliness constraints fig_12_01 Example: tasks in a periodic time-based system jitter = variation in evoking event fig_12_02 Example: tasks in an aperiodic system fig_12_03 Simple scheduleasynchronous, interrupt-driven Stays infinite loop until interrupt occurs Difficult to analyze fig_12_04 Another simple scheme: based on polling fig_12_05 State-based scheme; implement as case statement, e.g. fig_12_26a Task scheduling: some algorithms used in practice None is optimal, since these are on-line decisions fig_12_26b fig_12_26c fig_12_07 Typical behavior: bursts of activity (CPU or I/O) tableun_12_00 Example burst times fig_12_08 Managing communicating tasks: Basic paradigm fig_12_09 Example: shared buffer Need guard statementswhat if buffer is full / empty? fig_12_10 Tasks sharing two buffers fig_12_11 Code for sharing two buffers fig_12_14 Ring buffer (FIFO)allows simultaneous input and output fig_12_15 Mailboxlike polling but pend suspends task and gives up CPU until data is available fig_12_16 Task communication: direct message-passing fig_12_17 Task communication: over a network fig_12_18 Example: producer / consumer fig_12_21 Indirect communicationtasks share remote mailbox, e.g. fig_12_22 Using a buffering scheme for task communication: manages system if buffer has bounded capacity fig_12_23 Task management: Sharing critical section: --Only one task can use the section --it cannot be interrupted while in the critical section sharing (rock) fig_12_26 Tasks sharing a buffer fig_12_27 Modeling the producer-consumer exchange fig_12_29 Pseudocode & c code Critical section management: requirements: 1.Mutual exclusion 2.No deadlock 3.Must be progress through critical section 4.Must have bounded waiting fig_12_30 Model of a critical section and an atomic wait statement with flags: fig_12_32a Producer code fig_12_32b Consumer code fig_12_33 Using a token to manage critical section access: This works but adds fig_12_34 Using interrupts fig_12_35 Semaphore: modeling behavior fig_12_36 Using semaphore to protect critical section: fig_12_38 Using a counting semaphore Classical problem: dining philosophers fig_12_39 Bounded buffer problem fig_12_40 Producer-consumer fig_12_42 reader-writer