![]() ![]() The process then uses the resource and when it releases the resource then theįunction is called and the value of the semaphore variable is increased to 1. Initially, the value of semaphore variable is set to 1 and if some process wants to use some resource then theįunction is called and the value of the semaphore is changed to 0 from 1. If the value of the semaphore variable is 0, then no operation will be performed.įunction is used to increment the value of the semaphore variable by one.īinary semaphores, the value of the semaphore variable will be 0 or 1. " by one if the value of the semaphore variable is positive. Both these functions are used to change the value of the semaphore but the value can be changed by only one process at a particular time and no other process should change the value simultaneously.įunction is used to decrement the value of the semaphore variable " You can use any other variable name of your choice. So, in this blog, we will learn about semaphore and we will also look at the types of a semaphore.īefore starting this blog, you should know the concept of Process Synchronization(read the process synchronization blog fromĪ semaphore is a variable that indicates the number of resources that are available in a system at a particular time and this semaphore variable is generally used to achieve the process synchronization. This synchronization between processes can be achieved with the help of semaphore. So, in an Operating System, we must have synchronization between various processes. ![]() One resource should be used by only one process at a time. In a system, we have a limited amount of resources that are being shared between various processes. ![]()
0 Comments
Leave a Reply. |