Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Tasks and Task Management : --Time-critical tasks --Contending tasks --Communicating tasks."— Presentation transcript:

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

2 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

3 table_12_00 RTOS timeliness constraints

4 fig_12_01 Example: tasks in a periodic time-based system jitter = variation in evoking event

5 fig_12_02 Example: tasks in an aperiodic system

6 fig_12_03 Simple schedule—asynchronous, interrupt-driven Stays infinite loop until interrupt occurs Difficult to analyze

7 fig_12_04 Another simple scheme: based on polling

8 fig_12_05 State-based scheme; implement as case statement, e.g.

9 fig_12_26a Task scheduling: some algorithms used in practice None is optimal, since these are “on-line” decisions

10 fig_12_26b

11 fig_12_26c

12 fig_12_07 Typical behavior: “bursts” of activity (CPU or I/O)

13 tableun_12_00 Example burst times

14 fig_12_08 Managing communicating tasks: Basic paradigm

15 fig_12_09 Example: shared buffer Need guard statements—what if buffer is full / empty?

16 fig_12_10 Tasks sharing two buffers

17 fig_12_11 Code for sharing two buffers

18 fig_12_14 Ring buffer (FIFO)—allows simultaneous input and output

19 fig_12_15 “Mailbox”—like polling but “pend” suspends task and gives up CPU until data is available

20 fig_12_16 Task communication: direct message-passing

21 fig_12_17 Task communication: over a network

22 fig_12_18 Example: producer / consumer

23 fig_12_21 Indirect communication—tasks share remote mailbox, e.g.

24 fig_12_22 Using a buffering scheme for task communication: manages system if buffer has bounded capacity

25 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)

26 fig_12_26 Tasks sharing a buffer

27 fig_12_27 Modeling the producer-consumer exchange

28 fig_12_29 Pseudocode & c code

29 Critical section management: requirements: 1.Mutual exclusion 2.No deadlock 3.Must be progress through critical section 4.Must have bounded waiting

30 fig_12_30 Model of a critical section and an atomic wait statement with flags:

31 fig_12_32a Producer code

32 fig_12_32b Consumer code

33 fig_12_33 Using a token to manage critical section access: This works but adds

34 fig_12_34 Using interrupts

35 fig_12_35 Semaphore: modeling behavior

36 fig_12_36 Using semaphore to protect critical section:

37 fig_12_38 Using a counting semaphore

38 Classical problem: dining philosophers http://en.wikipedia.org/wiki/Dining_philosophers_problem

39 fig_12_39 Bounded buffer problem

40 fig_12_40 Producer-consumer

41 fig_12_42 reader-writer


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

Similar presentations


Ads by Google