About 54 results
Open links in new tab
  1. multithreading - What is a semaphore? - Stack Overflow

    Aug 29, 2008 · A semaphore is a programming concept that is frequently used to solve multi-threading problems. My question to the community: What is a semaphore and how do you use it?

  2. Jan 10, 2026 · A semaphore is an object with an integer value that we can manipu-late with two routines; in the POSIX standard, these routines are sem_-wait() and sem_post()1.

  3. Difference between binary semaphore and mutex - Stack Overflow

    The main difference between binary semaphore and mutex is that semaphore is a signaling mechanism and mutex is a locking mechanism, but binary semaphore seems to function like mutex that creates …

  4. Understanding Semaphores in C# - Stack Overflow

    Dec 23, 2021 · A Semaphore is a synchronization object that allows a limited degree of parallelism in a code section. For sake of simplicity, suppose you are instantiating a fresh new semaphore on a code …

  5. Why use a mutex and not a semaphore? - Stack Overflow

    Apr 27, 2025 · In general, mutex and semaphore target different use cases: A semaphore is for signalling, a mutex is for mutual exclusion. Mutual exclusion means you want to make sure that …

  6. critical section - Understanding semaphores - Stack Overflow

    Feb 15, 2014 · A binary semaphore can be implemented in the same way as a mutex, but they are actually for different purposes. A semaphore protects a resource whereas a mutex strictly protects a …

  7. Conditional Variable vs Semaphore - Stack Overflow

    Aug 18, 2010 · Semaphore is essentially a counter + a mutex + a wait queue. And it can be used as it is without external dependencies. You can use it either as a mutex or as a conditional variable. …

  8. When should I use semaphores? - Stack Overflow

    Apr 8, 2011 · Semaphores might be appropriate for signaling between processes. For multithreaded programming, semaphores should be avoided. If you need exclusive access to a resource, use …

  9. AGENDA / LEARNING OUTCOMES Concurrency abstractions How can semaphores help with producer-consumer? How to implement semaphores?

  10. When should we use mutex and when should we use semaphore

    Here is how I remember when to use what - Semaphore: Use a semaphore when you (thread) want to sleep till some other thread tells you to wake up. Semaphore 'down' happens in one thread …