Lecture6 - COP 5611 Operating Systems Spring 2010 Dan C....

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
OP 5611 Operating Systems Spring 2010 Dan C. Marinescu Office: HEC 439 B Office hours: M-Wd 2:00-3:00 PM
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Lecture 6 ± Last time: Virtualization ± Today: ² Thread coordination ² Scheduling ± Next Time: ² Multi-level memories ² I/O bottleneck
Background image of page 2
Evolution of ideas regarding communication among threads using a bounded buffer 1. Use locks Æ does not address the busy waiting problem 2. YIELD Æ based on voluntary release of the processor by individual threads 3. Use WAIT (for an event ) and NOTIFY (when the event occurs) primitives . 4. Use AWAIT (for an event) and ADVANCE (when the event occurs) 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Primitives for thread sequence coordination ± YIELD requires the thread to periodically check if a condition has occurred. ± Basic idea Æ use events and construct two before-or-after actions ² WAIT (event_name) Æ issued by the thread which can continue only after the occurrence of the event event_name . ² NOTIFY (event_name) Æ search the thread_tabl e to find a thread waiting for the occurrence of the event event_name . 4
Background image of page 4
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This solution does not work 6 ± The NOTIFY should always be sent after the WAIT. If the sender and the receiver run on two different processor there could be a race condition for the notempty event. The NOTIFY could be sent before the WAIT. ± Tension between modularity and locks ± Several possible solutions: AWAIT/ADVANCE, semaphores, etc
Background image of page 6
AWAIT - ADVANCE solution ± A new state, WAITING and two before-or-after actions that take a RUNNING thread into the WAITING state and back to RUNNABLE state. ± eventcount Æ variables with an integer value shared between threads and the thread manager; they are like events but have a value. ± A thread in the WAITING state waits for a particular value of the eventcount ± AWAIT( eventcount,value ) ² If eventcount >value Î the control is returned to the thread calling AWAIT and this thread will continue execution ² If eventcount value the state of the thread calling AWAIT is changed to WAITING and the thread is suspended. ± ADVANCE( eventcount ) ² increments the eventcount by one then ² searches the thread_table for threads waiting for this eventcount ² if it finds a thread and the eventcount exceeds the value the thread is waiting for then the state of the thread is changed to RUNNABLE 7
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Solution for a single sender and multiple receivers 8
Background image of page 8
Supporting multiple senders: the sequencer ± Sequencer Æ shared variable supporting thread sequence coordination -it allows threads to be ordered and is manipulated using two before-or-after
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/12/2010 for the course CS COP5611 taught by Professor Dancristianmarinescu during the Spring '10 term at University of Central Florida.

Page1 / 26

Lecture6 - COP 5611 Operating Systems Spring 2010 Dan C....

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online