Producer-Consumer - (out+2)mod N SIGNAL(P) Consumer [w2]...

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

View Full Document Right Arrow Icon
Producer-Consumer Problem. Suppose producer at each time will put 2 items into buffer and  consumer will at each time remove1 item from the buffer.  Producer: produce(wi) WAIT(P) Buffer [in] w1 in (in+2)mod N SIGNAL(C) GOTO Producer w1 is a local buffer used by producer Consumer; WAIT(C) W2 Buffer[out] out
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: (out+2)mod N SIGNAL(P) Consumer [w2] GOTO Consumer w2 is a local buffer used by consumer WAIT(S) S s-2 If(s<0) then {put this process in waiting queue, Qs} SIGNAL (S) V(S) S s+2 if (s0) then {remove a process from waiting queue, Qs} Pi WAIT(S) CS(i) SIGNAL(S) Mutual Exclusion...
View Full Document

This note was uploaded on 12/09/2009 for the course CS 431,430,48 taught by Professor Scher,statica during the Spring '09 term at NJIT.

Page1 / 2

Producer-Consumer - (out+2)mod N SIGNAL(P) Consumer [w2]...

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

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