Start learning 50% faster. Sign in now
A semaphore is a synchronization mechanism that is crucial for controlling access to shared resources in a multithreaded environment. It serves as a signaling mechanism that can be used to prevent race conditions, which occur when multiple threads attempt to modify shared data simultaneously, leading to unpredictable outcomes. Semaphores maintain a count of available resources and ensure that only a certain number of threads can access the critical section of code at any given time. When a thread wants to enter a critical section, it checks the semaphore's value; if it is greater than zero, the thread decrements it and proceeds; otherwise, it is blocked until the semaphore is released by another thread. This prevents multiple threads from executing critical sections concurrently, thereby eliminating race conditions and ensuring data consistency. Option B (Fork) - Fork is used to create new processes, not for synchronizing access to shared resources. Option C (Signal) - Signals are used for inter-process communication but do not provide the same level of resource control as semaphores. Option D (Context Switch) - Context switching refers to the operating system's ability to switch between processes and threads, which does not inherently prevent race conditions. Option E (Stack) - A stack is a data structure and does not serve any synchronization purpose in multithreading.
What does retributive justice emphasize?
An LC which authorises the Advising Bank, to transfer, at the request of the First Beneficiary the credit available in whole or in part to one or more o...
What is the purpose of the Motor Vehicles Act, 1988 with respect to insurance?
Which of the following is not considered for maintaining Statutory Liquidity Ratio (SLR) by Scheduled Commercial Banks?
The transaction in which the exchange of currencies takes place at a specified future date, subsequentto the spot date is known as a ______
Which is the document governing the internal management of the company?
According to Union Budget 2023-24, consider the following statements regarding the rationalization of Direct Tax:
1. Removing the minimum thr...
What measures are being implemented to improve the resilience of India's external sector?
Which of the following factors does not affect the price of bullion?
1) Supply and demand.
2) Economic and political cond...
When the spot price of a Call Option is less than the strike Price of an Option, the Option is said to be _______