Mutual exclusion means that processes must always execute critical sections in time intervals that do not overlap. The mutual exclusion requirement is one of the most basic in an operating system; without it the OS cannot share resources safely.
Questions tagged [mutual-exclusion]
261 questions
4
votes
1 answer
Sets of mutually exclusive parameters in PowerShell: Why is this ambiguous?
I've been trying to get multiple sets of mutual exclusions to work.
I want "Width" mutually exclusive to "WidthReset" and "Height" to be mutually exclusive with "HeightReset".
Help for the cmdlet shows:
Get-ArgTest [-Width ] [-Height ]…

joeking
- 2,006
- 18
- 29
4
votes
1 answer
argp: how to pass argp_state to argp_usage, argp_error, etc...?
Using argp in c++ appears to be missing mutual exclusion that python's argparse handles fairly well. In trying to emulate the same behavior I've noted a problem here. How to pass argp_state to the argp_usage (or other argp helper functions) in main?…

nndhawan
- 597
- 6
- 24
4
votes
1 answer
Relation between starvation freedom and bounded waiting
I have four questions regarding the relation between starvation and bounded waiting.
Does starvation-freedom imply deadlock-freedom?
My answer:
From here, the definition of starvation free is
Freedom from Starvation -:Every thread that attempts to…

sourav_anand
- 241
- 1
- 3
- 11
4
votes
1 answer
Some general questions on the Bakery algorithm
I recently encountered the bakery algorithm in my studies and just need to clarify some things.
Would it be possible for the bakery algorithm to violate mutual exclusion if processes did not pick a ticket number larger than that of all existing…

Kyle
- 69
- 6
4
votes
1 answer
Mutual exclusion algorithm using only atomic reads and writes for unknown number of processes and robust to process abortion
I am trying to come up with a mutual exclusion algorithm that is based only on atomic reads and atomic writes of shared memory (i.e. no compare-and-swap or similar).
Apart from mutual exclusion and deadlock freedom, it needs to fulfill the following…

Markus A.
- 12,349
- 8
- 52
- 116
4
votes
3 answers
Programming a mutex in Java
I'm new to Computer Science and I'm reading a book which introduces threads and mutexes. I've tried programming a mutex in Java which seems to work most of the time but every so often it won't.
In my code, the critical section adds on the numbers 1…

mmgro27
- 475
- 1
- 8
- 18
4
votes
1 answer
pthread_mutex_t struct: What does lock stand for?
I am looking at the pthread_mutex_t structure in the pthreadtypes.h file. What does the "__lock" stand for? Is it like a lock number assigned to the mutex?
typedef union
{
struct __pthread_mutex_s
{
int __lock;
unsigned int __count;
…

FranXh
- 4,481
- 20
- 59
- 78
4
votes
6 answers
What is equivalent of the C# lock statement in PHP?
For concurrency and ensuring the integrity of the data, how would you obtain a mutual-exclusion lock for a given object? Would you need to use locking within the database, or a file, or does PHP support something like this?

John B
- 20,062
- 35
- 120
- 170
4
votes
1 answer
Peterson Lock in a binary tree
I have some doubts about Peterson algorithm in a binary tree.
I am making some exercises of the book "The Art of Multiprocessor Programming" and i'm stuck in chapter 2, ex 13:
"Another way to generalize the two-thread Peterson lock is to arrange
a…

briba
- 2,857
- 2
- 31
- 59
4
votes
5 answers
How to ensure that android library project code is executed only in one of installed applications which integrate it?
I'm developing a library project that will be integrated into some popular android applications which can be seen in Google Play.
Let assume that user can have two or more applications installed, and each one can integrate my library. The library…

Michael P
- 670
- 7
- 23
3
votes
3 answers
How do I achieve mutual exclusion like in the lock statement, but the block would be skipped if it is locked?
Using the lock statement, one can "ensure that one thread does not enter a critical section of code while another thread is in the critical section. If another thread tries to enter a locked code, it will wait, block, until the object is…

Louis Rhys
- 34,517
- 56
- 153
- 221
3
votes
1 answer
Mutex Stored Procedure
I want to create some distributed mutual exclusion using a database table. It would be nice to have the following interface on a stored procedure:
Wait(uniqueidentifier)
I was originally thinking of implementing this by having a table of unique…

according2me
- 479
- 6
- 16
3
votes
3 answers
Concurrent access to groups of objects
I'm trying to develop an application that consists of a pool of threads, using a work-stealing algorithm to concurrently execute tasks.
These tasks
access a predefined set of objects;
must "atomicly" acquire read/write permissions on all objects it…

João Rafael
- 131
- 1
- 7
3
votes
1 answer
Does a call to unlock a mutex necessarily switch to another thread that was blocked on the lock?
Let's say we have two threads: th1 and th2.
Let's imagine this line of events:
Th1 locks the mutex and does some work in it's critical region.
Th2 calls lock on the mutex but is blocked.
Th1 finishes its work on the critical region and unlocks the…

Stefan Dimeski
- 438
- 4
- 16
3
votes
2 answers
argparse: Required add_mutually_exclusive_group parameters list as optional?
I know that argparse describes in its documentation that parameters starting with - or -- are considered optional:
In general, the argparse module assumes that flags like -f and --bar indicate optional arguments, which can always be omitted at the…

Judge
- 644
- 8
- 11