Download presentation
Presentation is loading. Please wait.
Published byEloise Horsfield Modified over 9 years ago
1
COP 4600 Operating Systems Fall 2010 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 3:30-4:30 PM
2
Last time: Presentation of the paper “Programming with Threads” by Andrew Birell Thread coordination with a bounded buffer. WAIT NOTIFY Today: Thread coordination with a bounded buffer. AWAIT ADVANCE SEQUENCE TICKET Semaphores Deadlock and Wait for Graphs Enforced modularity on the Intel x86 architecture Virtual Machines Next Time Scheduling Algorithms Lecture 22 – Thursday November 4, 2010 Lecture 222
3
Coordination with bounded buffer WAIT and NOTIFY can be used to coordinate the SEND and RECIVE systems calls. This solution creates problems when a NOTIFY is sent before the WAIT. The thread in the WAITING state will never wake up. Lecture 223
4
4
5
5
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 Lecture 226
7
Implementation of AWAIT and ADVANCE Lecture 227
8
8
9
Solution for a single sender and multiple receivers Lecture 229
10
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 actions. TICKET(sequencer) returns a negative value which increases by one at each call. Two concurrent threads calling TICKET on the same sequencer will receive different values based upon the timing of the call, the one calling first will receive a smaller value. READ(sequencer) returns the current value of the sequencer Lecture 2210
11
Multiple sender solution; only the SEND must be modified Lecture 2211
12
Semaphores Introduced by Dijkstra in 1965 Does not require busy waiting Semaphore S – integer variable Two standard operations modify S: wait() and signal() Originally called P() and V() Less complicated Can only be accessed via two indivisible (atomic) operations wait (S) { while S <= 0 ; // no-op S--; } signal (S) { S++; } 12Lecture 22
13
13
14
Lecture 2214
15
Lecture 2215 Simultaneous conditions for deadlock Mutual exclusion: only one process at a time can use a resource. Hold and wait: a process holding at least one resource is waiting to acquire additional resources held by other processes. No preemption: a resource can be released only voluntarily by the process holding it (presumably after that process has finished). Circular wait: there exists a set {P 0, P 1, …, P 0 } of waiting processes such that P 0 is waiting for a resource that is held by P 1, P 1 is waiting for a resource that is held by P 2, …, P n–1 is waiting for a resource that is held by P n, and P 0 is waiting for a resource that is held by P 0.
16
Wait for graphs Lecture 2216
17
Evolution of modularity for the Intel architecture x86 Real and Virtual Address Space The address space size determined by the number of address bits: 24 for 80286 a 16 bit processor modularity enforced through segmentation 32 for 80386 a 32 bit processor each segment could have up to 2 32 bytes within each segment support for virtual memory Backward compatibility 17Lecture 22
18
18
19
19Lecture 22
20
The increase in the number of lines of operating systems source code (millions) 20Lecture 22
21
Virtual machines First commercial product IBM VM 370 originally developed as CP-67 Advantages: One could run multiple guest operating systems on the same machine An error in one guest operating system does not bring the machine down An ideal environment for developing operating systems 21Lecture 22
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.