Operating System :: Process Management - Discussion
64 / 41
Semaphore is used for
Asynchronization
Bdead-lock avoidance
Cbox
DNone of these
Show Explanation
Any integer(non negative) can act as semaphore. Semaphores are used for counting tasks such as creating a critical region that allows a specified number of threads to enter. For example, if we want at most four threads to be able to enter a section, we could protect it with a semaphore and initialize that semaphore to four.The first four threads will be able to decrement the semaphore and enter the region, but at that point, the semaphore will be zero and any other thread will be blocked from outside the critical region until one of the current threads leaves and signals the semaphore.
Asked In ::
Semaphores are synchronization tools.
Any integer(non negative) can act as semaphore. Semaphores are used for counting tasks such as creating a critical region that allows a specified number of threads to enter. For example, if we want at most four threads to be able to enter a section, we could protect it with a semaphore and initialize that semaphore to four.The first four threads will be able to decrement the semaphore and enter the region, but at that point, the semaphore will be zero and any other thread will be blocked from outside the critical region until one of the current threads leaves and signals the semaphore.
Read Full Answer
Report Error
Please Login First Click Here