Semaphores



In the above Diagram,
  • The Task A Requesting for taking semaphore with the Kernel or Operating System
  • The kernel acknowledge and ask task A to take the semaphore
  • During that time Task B is Blocked (which also uses the same semphore)
  • Task A Releases the semaphore, Event to the OS
  • Task B starts running by taking the semaphore


Use of Multiple Semaphores

  • Two semaphores X and Y are used
  • Task I, J and M share the semaphore X
  • Task K and L Share the semaphore Y
  • In the above diagram, the tasks J and M are waiting for taking the semaphore X as the semaphore is locked by the Task J
  • similarly, the other semaphore Y is been locked by Task L and hence Task K is waiting

Comments

Popular Posts