Lecture10-chapter05 - Operating Systems Operating Lecture 10 Lecture Semaphores Semaphores Anda Iamnitchi anda@cse.usf.edu 1 Mutual Exclusion

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

View Full Document Right Arrow Icon
Operating Systems Operating Systems Lecture 10: Lecture 10: Semaphores Semaphores Anda Iamnitchi anda@cse.usf.edu 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
Mutual Exclusion Mutual Exclusion Idea #3: Semaphores Idea #3: Semaphores 1) May be initialized to a nonnegative integer value 2) The semWait operation decrements the value 3) The semSignal operation increments the value
Background image of page 2
Semaphore Primitives Semaphore Primitives
Background image of page 3

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

View Full DocumentRight Arrow Icon
Binary Semaphore Primitives Binary Semaphore Primitives
Background image of page 4
Consequences Consequences Three consequences of the semaphore definition: There is no way to know before a process decrements a semaphore whether it will block or not. After a process increments a semaphore and another process gets woken up, both processes continue running concurrently. There is no way to know which process, if either, will continue immediately on a uniprocessor system. When you signal a semaphore, you don’t necessarily know whether another process is waiting, so the number of unblocked processes may be zero or one.
Background image of page 5

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

View Full DocumentRight Arrow Icon
Strong/Weak Semaphores Strong/Weak Semaphores A queue is used to hold processes waiting on the semaphore
Background image of page 6
Example of Semaphore Example of Semaphore Mechanism Mechanism
Background image of page 7

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

View Full DocumentRight Arrow Icon
Mutual Exclusion Mutual Exclusion
Background image of page 8
Shared Data Protected by a Shared Data Protected by a Semaphore Semaphore
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 02/18/2012 for the course COP 4600 taught by Professor Andaiamnitchi during the Fall '08 term at University of South Florida - Tampa.

Page1 / 24

Lecture10-chapter05 - Operating Systems Operating Lecture 10 Lecture Semaphores Semaphores Anda Iamnitchi anda@cse.usf.edu 1 Mutual Exclusion

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