Operating System :: Process Management - Discussion
21 / 41
Semaphores function is to
Asynchronize critical resources to prevent deadlock
Bsynchronize processes for better CPU utilization
Cused for memory management
Dnone of above
Show Explanation
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.
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