Questions tagged [mutual-exclusion]

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.

261 questions
0
votes
1 answer

Semaphores/Creating a Critical Section

How can you use a semaphore to create a special critical section that allows two threads to be executing inside instead of the usual one thread?
0
votes
1 answer

Filter lock mutual exclusion property

The following is a generalised version of Peterson's 2-thread lock algorithm, allowing 'n' threads/processes to compete for critical section. Basically there are 'n' levels and 'n' threads. Threads which are inactive or are executing in non critical…
Aman Vats
  • 15
  • 8
0
votes
3 answers

Lock implemention on "Class" class object for synchronization

I was going through this link . According to this : Class locks are actually implemented as object locks. When the JVM loads a class file, it creates an instance of class java.lang.Class. When you lock a class, you are actually locking that…
mohit
  • 1,087
  • 1
  • 9
  • 18
0
votes
2 answers

how to model mutually exclusive attributes in UML?

I'm working up an analysis model in UML, and I'm a bit stuck when trying to represent a constraint on a couple of attributes in a class diagram. In the following class: +-----------+ | SomeClass | +-----------+ | isFoo | | isBar | | isBaz …
Val
  • 2,291
  • 7
  • 34
  • 63
0
votes
1 answer

MySQL ensuring that is_free_lock is always exclusive

I'm using mysql get_lock to ensure mutual exclusion between multiple instances of php scripts that I am running for the same lines of code. I need to ensure that two simultaneous executions of the is_free_lock will not yield 0, in which case I will…
YD8877
  • 10,401
  • 20
  • 64
  • 92
0
votes
1 answer

Debugging simplified version of Lamport's Bakery Algorithm in C

I'm trying to implement a simplified version of Lamport's Bakery Algorithm in C before I attempt to use it to solve a more complex problem.* The simplification I am making is that the lock is only shared by only two threads instead of N. I set up…
Glenn
  • 386
  • 3
  • 12
0
votes
4 answers

Synchronized Cache Matrix

Im working on a java project for school where you have to deal with a multithreaded program. I need a class, shared between many threads that is basically a matrix of values that have to manage concurrent access, it looks something like: public…
Michele M.
  • 117
  • 1
  • 8
0
votes
1 answer

Hybrid solution of consumer producer algorithm

I am trying to show that the following solution of the producer/consumer problem does not work, by showing that when a consumer is at the beginning of M1, there is a case when it won't be able to dequeue an item within a finite time, and/or there is…
ratsimihah
  • 1,010
  • 1
  • 11
  • 22
0
votes
1 answer

Test-and-Set in Mutex Solution

I am trying to check the correctness of this mutex solution, and need to check that mutual exclusion, liveness, and fairness are all satisfied. L1 and L2 are arbitrary lines of code. There are 2 processes running concurrently. Below is the code of…
ratsimihah
  • 1,010
  • 1
  • 11
  • 22
0
votes
2 answers

how to achieve mutual exclusion using synchronized method in this application

i have run into a little problem in here. I am doing a concurrent program in Java. Problem is: There are 4 people (students) that are trying to access printer, to print 5 documents. But only one can print at the time (kind of obvious) 5 documents.…
0
votes
1 answer

Handling uniqueness concurrently in event-based systems

In the project I am working on right now, we have what we call challenges. Challenges have members and participants. Members are everyone who has access to the challenge (which can be both single users or groups of users), and participants track…
Jan Aagaard Meier
  • 28,078
  • 8
  • 95
  • 66
0
votes
2 answers

In process synchronization, what is a Monitor?

There are lots of information in the internet for Semaphore, Mutex, etc. But as far as I've searched, there isn't a clear info available on Monitors. I know that a Mutex helps in Mutual exclusion between processes. A binary semaphore also does…
user1956389
0
votes
1 answer

Using SQL dB column as a lock for concurrent operations in Entity Framework

We have a long running user operation that is handled by a pool of worker processes. Data input and output is from Azure SQL. The master Azure SQL table structure columns are approximated to [UserId, col1, col2, ... , col N, beingProcessed,…
0
votes
1 answer

PHP Mutual Exclusion on a File / MySQL reading and executing statements from a file using perl

So I was wondering how / if PHP has some sort of mutual exclusion on file reading and writing. Here's how I plan on using it: The site I'm working with utilizes a payment service that requires leaving the server, making it difficult to deal with…
-1
votes
1 answer

Opposite of mutually exclusive - two arguments must exist together

In python, I have a function to read bytes from a file: def read_bytes(path: pathlib.Path, tohex: bool = True, hexformat: Optional[Callable] = None) -> bytes | hex | Any: In this function, hex is whether to convert the bytes to hex. hexformat is a…
1 2 3
17
18