Kamis, 16 Februari 2017

How perform synchronization using inter thread communication

Although we can restrict the access of data or code to a single thread at a time by using synchronization, it can’t guarantee the consistent execution of our logic.   As an example let’s consider the conventional Producer-Consumer problem which is generally introduced in Operating Systems course. In this problem Producer process or thread produces items and stores in a queue and Consumer process or thread consumes items from the queue. Note that the Consumer thread should wait until the Producer produces at least one item.   In our example we will maintain a class Q which contains a single variable n. The Producer

The post How perform synchronization using inter thread communication appeared first on Coding Security.


How perform synchronization using inter thread communication
read more

Tidak ada komentar:

Posting Komentar