Back to Browse

Synchronization | Critical Section | Part-1 | Operating System | Bengali Tutorial

948 views
Jan 29, 2022
26:03

Process Synchronization Producer-Consumer Problem: Producer Process: produces information Consumer Process: consumes the information unbounded-buffer places no practical limit on the size of the buffer bounded-buffer assumes that there is a fixed buffer size Producer: while (true) { /* produce an item and put in nextProduced */ while (count == BUFFER_SIZE) ; // do nothing buffer [in] = nextProduced; in = (in + 1) % BUFFER_SIZE; count++; } Consumer: while (true) { while (count == 0) ; // do nothing nextConsumed = buffer[out]; out = (out + 1) % BUFFER_SIZE; count--; /* consume the item in nextConsumed */ } Every process will have its Own critical section involving the shared data/variable.

Download

0 formats

No download links available.

Synchronization | Critical Section | Part-1 | Operating System | Bengali Tutorial | NatokHD