Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [critical-section]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers
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 : ...
Girik Garg's user avatar
0 votes
1 answer
79 views

Deadlock in LockTwo Algorithm

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: <...
Equation_Charmer's user avatar
0 votes
2 answers
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 ...
zeeshanseikh's user avatar
3 votes
2 answers
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. ...
pitosalas's user avatar
  • 133
1 vote
0 answers
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 ...
sd22gg44's user avatar
1 vote
0 answers
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 ...
Chien's user avatar
  • 11
0 votes
1 answer
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?
Franc's user avatar
  • 103
3 votes
0 answers
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 ...
MarkovsConundrum's user avatar
1 vote
1 answer
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 <...
RajS's user avatar
  • 1,667
2 votes
4 answers
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 ...
JinseiNagai's user avatar
0 votes
1 answer
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 ...
Abhilash Mishra's user avatar
2 votes
1 answer
578 views

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

I came across following problem: Consider following code: ...
RajS's user avatar
  • 1,667
2 votes
1 answer
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 ...
tomac231's user avatar
1 vote
0 answers
56 views

Does the following piece of code lead to a deadlock?

Process X ...
Krish__'s user avatar
  • 23
3 votes
2 answers
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 (...
jrook's user avatar
  • 133
1 vote
0 answers
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 ...
Adriankusiak's user avatar
7 votes
3 answers
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 ...
laura's user avatar
  • 327
3 votes
2 answers
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$. ...
Mr. Sigma.'s user avatar
  • 1,303
7 votes
2 answers
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: ...
Mahesha999's user avatar
  • 1,753
1 vote
1 answer
4k views

Bounded waiting and progress requirements of critical section problem solution based on exchange instruction

Atomic exchange instruction is given as follows: void exchange (int *a, int *b) { int temp; temp = *b; *b = *a; *a = temp; } Now consider the ...
Mahesha999's user avatar
  • 1,753