Operating SystemComputer Science & Information Technology

Synchronization

Threads (or processes) are concurrent if they exist at the same time. They are asynchronous if they need to synchronize with each other occasionally. They are independent if they have no dependence on each other: it does not affect a thread whether another thread exists or not. Threads are synchronous if they synchronize
frequently so that their relative order of execution is guaranteed.

Problems Arising When Not Having Synchronization

(i) Inconsistency
(ii) Loss of data
(iii) Deadlock

Let us understand each one of then with the help of examples.

Producer-Consumer Problem: Here the producerprocess generates an item into the buffer, and the consumer process consumes the item out of the buffer.

Buffer of size N (shared resource) with in and out variables to indicate the next position for putting data into the buffer and fetching data from the buffer, respectively. Count maintains a count of the number of items present in buffer (shared resource).

Synchronization

Now produce execute III statement of count
III. count = 4
Here the buffer contains only 3 items, but the count value is 4.
It is because the producer and consumer are not properly synchronized while sharing the common variable count. Hence leading to inconsistency.

Dear Aspirants,
Your preparation for GATE, ESE, PSUs, and AE/JE is now smarter than ever — thanks to the MADE EASY YouTube channel.
This is not just a channel, but a complete strategy for success, where you get toppers strategies, PYQ–GTQ discussions, current affairs updates, and important job-related information, all delivered by the country’s best teachers and industry experts.
If you also want to stay one step ahead in the race to success, subscribe to MADE EASY on YouTube and stay connected with us on social media.
MADE EASY — where preparation happens with confidence.

MADE EASY

MADE EASY is a well-organized institute, complete in all aspects, and provides quality guidance for both written and personality tests. MADE EASY has produced top-ranked students in ESE, GATE, and various public sector exams. The publishing team regularly writes exam-related blogs based on conversations with the faculty, helping students prepare effectively for their exams.

Leave a Reply

Your email address will not be published. Required fields are marked *