14_course review

14_course review - COMP 252 Operating Systems REVIEW...

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

View Full Document Right Arrow Icon
COMP 252 Operating Systems REVIEW
Background image of page 1

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

View Full DocumentRight Arrow Icon
Outline ± Critical Section and Monitor eadlock ± Deadlock ± Memory management ± Virtual memory ± File system
Background image of page 2
Solution to Critical Solution to Critical-Section Problem Section Problem ± Critical Section : piece of code that only one thread can execute at once. Only one thread at a time will get into this section of code 1. Mutual Exclusion - If process P i is executing in its critical section, then no other processes can be executing in their critical sections 2. Progress - If no process is executing in its critical section and there exist some processes that wish to enter their critical section, then e selection of the processes that will enter the critical section the selection of the processes that will enter the critical section next cannot be postponed indefinitely 3. Bounded Waiting - A bound must exist on the number of times that other processes are allowed to enter their critical sections after a process has made a request to enter its critical section and before at request is granted that request is granted ± Assume that each process executes at a nonzero speed ± No assumption concerning relative speed of the N processes
Background image of page 3

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

View Full DocumentRight Arrow Icon
Monitors ± Motivation se cks r mutual exclusion and ondition variables r Use locks for mutual exclusion and condition variables for scheduling constraints ± Definition A lock and zero or more condition variables for managing gg concurrent access to shared data ± A high-level abstraction that provides a convenient and effective mechanism for process synchronization ± Only one process may be active within the monitor at a time
Background image of page 4
Monitors monitor monitor-name { // shared variable declarations procedure P1 (…) { …. } procedure Pn (…) {……} Initialization code ( ….) } { … } }
Background image of page 5

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

View Full DocumentRight Arrow Icon
Monitors ± Lock: the lock provides mutual exclusion to shared data ± Always acquire before accessing shared data structure lways release after finishing with shared data ± Always release after finishing with shared data ± Lock initially free ± Condition Variable: a queue of threads waiting for something inside a critical section ± Key idea: make it possible to go to sleep inside critical section by atomically releasing lock at time we go to sleep ± Contrast to semaphores: Can’t wait inside critical section ± condition variables x, y; wo operations on a condition variable: ± Two operations on a condition variable: ± x.wait () – a process that invokes the operation is suspended. ± x.signal () – resumes one of processes (if any) that invoked x.wait ()
Background image of page 6
Deadlock Characterization ± Deadlock can arise if four conditions hold simultaneously utual exclusion ± Mutual exclusion ± only one process at a time can use a resource. ± Hold and wait
Background image of page 7

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

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

Page1 / 47

14_course review - COMP 252 Operating Systems REVIEW...

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

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