Lec27-Semaphores I

Lec27-Semaphores I - National University of Computer &...

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

View Full Document Right Arrow Icon
Operating System Operating System Spring 09 Spring 09 National University National University of Computer & Emerging Sciences of Computer & Emerging Sciences Lec27-Semaphores Lec27-Semaphores Prepared by Prepared by Uzma Maroof Uzma Maroof [email protected]
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 Reference Reference Modern Operating System Andrew S. Tanenbaum 2 nd edition 2.3 Interprocess communications
Background image of page 2
3 IPC issues IPC issues 1. How do the processes communicate? 2. One process should not get into the way of another process when doing critical activities 3. Proper sequence of execution when dependencies are present A produces data, B prints it Before printing B should wait while A is producing data If A and B are sharing a common buffer As long as the Buffer is Empty B has to wait Thus, B is dependent on A As long as the Buffer is Full A has to wait Thus, A is also dependent on B
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 Producer/Consumer Problem Producer/Consumer Problem One of the Classical IPC Problem A producer process generates information that is to be processed by the consumer process The processes can run concurrently through the use of a buffer The consumer must wait on an empty buffer The producer must wait on a full buffer
Background image of page 4
5 Producer/Consumer Problem Producer/Consumer Problem Also known as the bounded buffer problem 0 1 2 3 4 5 6 7 out A B C D E F in
Background image of page 5

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

View Full DocumentRight Arrow Icon
6 Producer Consumer using Sleep/Wakeup Sleep/Wakeup Count keeps track of the number of items in the buffer n = maximum items in the buffer The producer checks against n .
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/23/2011 for the course COE 10001 taught by Professor Abad during the Spring '09 term at Alfaisal University.

Page1 / 22

Lec27-Semaphores I - National University of Computer &...

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

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