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
1
vote
1 answer
Two type of wait() for semaphore . which one is True ?
I was reading Silberschatz's book and semaphore that I saw somethings confusing .
There were two type of definitions for wait() in Silberschatz'book .
the first one is :
wait(S) {
while (S<= 0)
; //busy-wait
S--;
}
and the…

Mohammad Mehdi Sarfejoo
- 434
- 1
- 9
- 22
1
vote
0 answers
Concurrent adding key/value to object in mutex
I'm looking for a mutex in object editing for javascript.
The exact problem is this : I'm reading asynchronously from several files. and collecting info to a single object. This can get down to this toy-example
var o =…

user3617487
- 155
- 11
1
vote
2 answers
Mutual Exclusion using JAVA 2-Threads Solution
I am trying to implement 2-threads solution using LockOne(Mutually Exclusive) Algorithm. Implementing this algorithm, i am trying work out a thread defining my own lock methods but i am not getting the desired output. When i run the program..all i…

Trijit
- 501
- 1
- 4
- 18
1
vote
4 answers
lock file between C and php
Although the title mentions file, it doesn't have to be a file. Any locking mechanism would do.
Here is the situation: I have a daemon process written in C, and a web page in php. I'd like to have a way of mutual locking so that under certain…

lang2
- 11,433
- 18
- 83
- 133
1
vote
1 answer
Java atomic variables native / internal implementation
How does Java's atomic variables like AtomicInteger work internally to achieve mutual exclusion/atomicity?
Is there any locking involved at machine instruction level which yields better performance?
Or an atomic machine level instruction itself does…

Xavier DSouza
- 2,861
- 7
- 29
- 40
1
vote
0 answers
How to synchronize read and multiple writes on sockets
I am asking some theoretical questions, since it would be really hard for me to post the code of the project involved, which is composed of too many files.
I am writing code for a server program, which has to communicate with several clients that…

BattiestFawn66
- 67
- 3
- 10
1
vote
0 answers
Mutex v/s binary semaphore
I read this link https://en.m.wikipedia.org/wiki/Producer–consumer_problem#Using_semaphores
Here they have said that the difference between mutex and binary semaphore is that mutex uses concept of "ownership" which means the process which decrements…

Zephyr
- 1,521
- 3
- 22
- 42
1
vote
1 answer
OS: Does the following algorithm comply with the conditions to have processes adequately progressing?
"Given the following algorithm for two processes, 0 and 1:
Process (i)
REPEAT WHILE Interest [j] = 1 DO;
START
Interest [i]:=1;
Critical Section;
Interest [i]:=0;
Non-critical Section;
END
where i=0,1; j=1-i;, and Interest is a…

Leon Horka
- 153
- 2
- 15
1
vote
1 answer
Critical section with sephamores
Take this pseudo code,
Semaphore S <- 0
non-critical section
wait(S)
critical section
signal(S)
Does this solution to the critical section problem support mutual exclusion only?
I know that there is no freedom from deadlock since the critical…

Kyle
- 69
- 6
1
vote
1 answer
How to get a mutual exclusion on select queries in SQL Server
I know maybe I'm asking something stupid in my application users can create a sort of agendas but only a specific number of agendas is allowed per day. So, users perform this pseudo-code:
select count(*) as created
from Agendas
where agendaDay =…

SagittariusA
- 5,289
- 15
- 73
- 127
1
vote
1 answer
Do mutual exclusion algorithms require atomic loads and stores?
I understand that algorithms for mutual exclusion such as Dekker's algorithm and Peterson's algorithm require an underlying sequentially consistent memory model to work (or use of memory barriers), but it's not clear to me if they require atomic…

Mike Sweeney
- 1,896
- 2
- 18
- 20
1
vote
1 answer
Why is this Mutex solution incorrect?
There are 2 processes P1 and P2 that can enter the Critical Section.
Mutex Solution Requirements:
A Mutex Zone - (Critical Section) that can only hold one process maximum.
No Mutual Blocking - a process outside the critical section cannot block a…

Naomi
- 81
- 1
- 8
1
vote
1 answer
Two questions about Distributed systems: Scalability and Mutual exclusion
First question : Scalability
In the context of distributed systems what exactly can be refered to as
scalability? I'm guessing it is the ability of the system to be used by as many distributed devices as one wants without having to change the code.…

God_is_a_sociopath_so_are_we
- 89
- 1
- 7
1
vote
1 answer
Find indices of mutually exclusive elements between two arrays in python
I have two arrays, and I have found how to identify the mutually exclusive elements with np.setxor1d(a,b). For example:
a = np.random.randint(11, size=10) #first array
b = np.random.randint(11, size=10) #second array
ex = np.setxor1d(a,b) …

Thomas Cannon
- 89
- 2
- 12
1
vote
2 answers
Mutual Exclusion Without Touching Both Processes
I have a unique problem. There are two processes (P0 and P1) trying to access one file. P0 is writing information to the file and P1 is reading the information. There is a race condition occurring between the two in which P1 is reading before P0 is…

Mark
- 13
- 2