Share Your Experience: Take the 2024 Developer Survey

# Questions tagged [critical-section]

The tag has no usage guidance.

20 questions
Filter by
Sorted by
Tagged with
1 vote
42 views

### Order of releasing the semaphores

I was studying the dining philosopher problem (See problem description) and its solution using semaphores, and I came across this : ...
79 views

I was reading the Book: The Art of Multiprocessor Programming; Section 2.3.2. and I have a doubt regarding their $\texttt{LockTwo}$ algorithm mentioned in Page 26. The snippet of the algorithm is: <...
136 views

### What's the standard technique to test if the algorithm satisfies mutual exclusion, progress and bounded waiting or not?

Sorry if this is a stupid question. But it really intrigued me. Same resources at different algorithms are telling different ways to test these stuffs. Here's an algorithm and how I'd test for its 3 ...
• 105
156 views

### Race condition, my doubt on Peterson's algorithm vs. C

I have seen this C code showing an implentation of Peterson's Critical Section algorithm. It is obviously skeletal and hardwired for two threads but the logic is supposed to be correct in detail. ...
• 133
1 vote
90 views

### For what example would Maekawa's algorithm allow out of timestamp order access to the critical section

For what example would Maekawa's algorithm allow out of timestamp order access to the critical section. It is mentioned that ordering is not satisfied in Maekawa's algorithm. But in what scenario ...
• 11
1 vote
135 views

### Dekker's Algorithm spin on intent instead of turn

For Dekker's algorithm given below (from Wikipedia), why is it that we wait for the turn to change, instead of waiting for p1 to set it's flag to false? It seems to me that it would be safer (or more ...
• 11
232 views

### Thread - contention vs race

The terms contention and race are used interchangeably when it comes to thread's state(at critical section). Are they same?
• 103
112 views

### Why is the Black-White Bakery Algorithm considered bounded?

As stated in Lamport's papers for the bakery algorithm he states that the ticket numbers are unbounded specifically The range of values of number is unbounded. and Fortunately, practical ...
1 vote
217 views

### Does Dekkers solutions to critical section problem ensure progress?

I was reading concurrency control section from Operating Systems book by William Stallings. In this book, he gives three attempts by Dekker to give solution to critical section problem: Attempt 1 <...
• 1,667
6k views

### Whats exact definition of 'atomicity' in programming?

the definition of 'atomicity' says that a transaction should be able to be terminated without being touched or manipulated by possibly concurrent running actions during its process. But does that also ...
• 121
201 views

### Is OS mode required for accessing general purpose registers

In which of the following cases a process executing in user model is required to enter into the OS mode? (a) Decreasing the value of unsigned integer value in a register to less than 0 (b) Accessing ...
578 views

### Deadlock vs "Progress" requirement of the solution to the critical section problem

I came across following problem: Consider following code: ...
• 1,667
320 views

### Peterson's Algorithm | Context switch after turn=process

Suppose we have two processes P0 and P1 using Peterson's Algorithm to access a critical section. Process P0 starts executing and sets its interested to TRUE and turn is set to 0. A context switch ...
• 21
1 vote
56 views

Process X ...
• 23
1k views

### What is the problem with this Busy Wait solution for two threads?

We have two processes. One process produces F and the other process consumes F Initialization: Consuming = false Produced = false F = EMPTY The first thread (...
• 133
1 vote
61 views

### Is a single starved process considered deadlocked?

In regard to the critical section problem, an algorithm that switches between allowing one of two processes, P1 or P2, to complete their critical section would cause starvation for P1 if P2 stayed in ...
2k views

### Bounded waiting and starvation free in critical section problem

I have 4 questions regarding relation between starvation and bounded waiting. 1.Does starvation-freedom imply deadlock-freedom? My Answer: From here, definition of starvation free is Freedom from ...
• 327
2k views

### Increment and Decrement on binary semaphores when their values are $1$ and $0$ respectively?

What happens if we increment binary semaphore $x$ when it is equal to $1$. E.g A process executes $V(x)$ when $x==1$; What are the possible cases then- Process would be blocked till $x$ becomes $0$. ...
• 1,303
13k views

### Understanding N process Peterson's algorithm

The intuitive informal description of two process Peterson's algorithm for process 0 can be given as follows: ...
• 1,753
1 vote