Semaphores are synchronization primitives used to manage access to shared resources in multi-threaded environments. In the Readers-Writers Problem, semaphores efficiently balance multiple readers accessing shared data simultaneously, while ensuring mutual exclusion for writers to avoid data inconsistency. The problem is solved using two semaphores: one for mutual exclusion (ensuring only one writer or a group of readers access the data) and another for resource access control. This ensures fairness and prevents issues like starvation of writers. Semaphores are widely used due to their flexibility and efficiency in solving synchronization problems. Why Other Options Are Incorrect: 1. Mutex Locks: Enforce strict mutual exclusion but cannot differentiate between readers and writers, leading to inefficiency. 2. Spinlocks: Suitable for short wait times but consume CPU cycles unnecessarily, making them inefficient. 3. Monitors: Provide higher-level synchronization but require language-level support, limiting their applicability. 4. Condition Variables: Complement mutexes but are not standalone synchronization mechanisms. Semaphores provide an optimal balance of efficiency and simplicity for resolving the Readers-Writers Problem.
Small bubbles are perfectly spherical because of –
An image formed by a plane mirror is ______.
The amount of light entering in eye is controlled by:
Why does a fountain pen leak on an airplane flying at high altitude?
An example of longitudinal waves (in a gas medium) is:
Which of the following is not a recognized type of inertia?
What is myopia?
Newton's rings can be obtained in:
The refractive index of glass is 1.5. What is the speed of light in glass?
(Speed of light in vacuum is 3.0 ×108 m s-1)
When a bottle of scent is kept open in a corner of a room its odour is felt in all parts of the room. This is clue to the phenomenon of –