The system consisting of cooperatingsequential processes or threads, all running asynchronously andpossiblysharing data. We illustrated this model with the producer-consumer problem,described how a bounded buffer could be used to enable processes to sharememory. Solution allows at most BUFFER.SIZE – 1 items in the buffer at the sametime. Suppose we want tomodify the algorithm to remedy this deficiency. Onepossibility is to add an integer variable counter, initialized to 0. counter isincremented every time we add a new item to the buffer and is decrementedevery time we remove one item from the buffer. The code for the producerprocess can be modified as follows: while (true)
The post How Synchronization is performed in Operating systems appeared first on Coding Security.
How Synchronization is performed in Operating systems
read more
Tidak ada komentar:
Posting Komentar