What is semaphore in Operating System?

0 votes
59 views
Kalin asked 04-Apr-2022 in troubleshooting by Kalin

What is semaphore in Operating System?

1 Answer

0 votes
Hitesh Vohra answered 05-Apr-2022 by Hitesh Vohra
What is semaphore in Operating System?
  • A semaphore is a variable or abstract data type in computer science that is used to restrict access to a shared resource by several threads and avoid critical section problems in a concurrent system like a multitasking operating system. Synchronization primitives include semaphores. A trivial semaphore is a simple variable that is incremented, decremented, or toggled in response to programmer-defined criteria.
  • Semaphores are a valuable tool for preventing race circumstances, but their use does not guarantee that a programme will be free of these issues. Counting semaphores allow for any resource count, but binary semaphores are used to establish locks and are limited to the numbers 0 and 1 (or locked/unlocked, unavailable/available).


Read More: When does trashing occur in Operating System?