Top "Mutual-exclusion" questions

Mutual exclusion means that processes must always execute critical sections in time intervals that do not overlap.

std::unique_lock<std::mutex> or std::lock_guard<std::mutex>?

I have two use cases. A. I want to synchronise access to a queue for two threads. B. I want …

c++ multithreading c++11 mutual-exclusion stdmutex
Conditional Variable vs Semaphore

When should one use a semaphore and when should one use a conditional variable (CondVar) ?

multithreading operating-system synchronization semaphore mutual-exclusion
Make sure only a single instance of a program is running

Is there a Pythonic way to have only one instance of a program running? The only reasonable solution I've come …

python process locking mutual-exclusion
Is my spin lock implementation correct and optimal?

I'm using a spin lock to protect a very small critical section. Contention happens very rarely so a spin lock …

c multithreading concurrency mutual-exclusion spinlock
Static Variables and Threads (C)

I know that declaring a static variable within a function in C means that this variable retains its state between …

c multithreading concurrency static mutual-exclusion
Mutual-exclusion using TestAndSet() instruction

The book Operating System Principles by Silberschatz, Galvin and Gagne contains the following definition for the TestAndSet() instruction in the …

synchronization operating-system mutual-exclusion
PHP mutual exclusion (mutex)

Read some texts about locking in PHP. They all, mainly, direct to http://php.net/manual/en/function.flock.php . …

php mutex mutual-exclusion
Start Java program only if not already running

I need to start 1-3 external programs in my Java application that have paths defined by the user. I have …

java mutual-exclusion
Difference between mutual exclusion and synchronization?

What is the difference between above two? This question came to my mind because I found that Monitors and locks …

concurrency synchronization mutual-exclusion
Difference Between Monitor & Lock?

What's the difference between a monitor and a lock? If a lock is simply an implementation of mutual exclusion, then …

locking thread-synchronization mutual-exclusion