![]() ![]() There are 3-types of semaphores namely Binary, Counting and Mutex semaphore. It will be in the wait state until the semaphore is released by the lower priority task. Until this time all other tasks have to wait if they need access to shared resource as semaphore is not available.Įven if the task trying to acquire the semaphore is of higher priority than the task acquiring the semaphore, The task should release the semaphore after it is done with the shared resource. Whenever a task wants access to the shared resource, it must acquire the semaphore first. Semaphore is just like this Key and the bike is the shared resource. And when this person gives the key to the 2nd person, then the 2nd person can use the bike. The one who has the bike key will get the chance to use it. If the semaphore is not available then the requesting task will go to blocked state till the semaphore becomes free.Ĭonsider a situation where there are two persons who want to share a bike.Īt one time only one person can use the bike. When a task wants to use a resource, it requests for the semaphore and will be allocated if the semaphore is available. Semaphore is a technique for synchronizing two/more task competing for the same resources. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |