Friday, April 26, 2019

[iOS] - Semaphore to control access to shared resource


  1. DispatchSemaphore is initialized with maximum number of threads to access the shared resource.
  2. It provides methods wait()/signal() to lock/unlock resource
  3. If the resource access is locked in a lower priority thread by semaphore, it freezes and releases the resource until finish it although the higher priority thread is there, this is called Priority Inversion or Priority Inheritance.

  • Multiple Semaphore access resource wait for each other can cause deadlock

No comments:

Post a Comment