# Questions tagged [synchronization]

Questions about techniques for enforcing an agreed order of events between several concurrently executing threads. Specific synchronization mechanisms include mutexes (locks), condition variables, semaphores and monitors.

117 questions
Filter by
Sorted by
Tagged with
1 vote
58 views

### Tigers and elephants can't drink water from a pond simultaneously, while more than one tiger or more than one elephants can drink water simultaneously

Below is a question on synchronization mechanism which was asked in an interview in Indian Statistical Institute, M.Tech CS. I got hold of it from here. There is a forest where there are tigers and ...
• 1,034
1 vote
43 views

### Meaning of pulse driven sequential logic?

I am trying to understand the meaning of this scheme, providing a sort of classification of sequential logic circuits. This taken from https://www.electronics-tutorials.ws/sequential/seq_1.html Does ...
• 111
25 views

### How can we prove Karlin and Yao’s probability bound on randomized Byzantine Broadcast protocols?

Can we concretely prove that with 3 nodes (one of which is faulty), a randomized Byzantine broadcast protocol will have a 2/3 probability of success?
60 views

### What will you do if multiple users access your application at the same time?

I'm an experienced Software Engineer but very weak in concurrency because of no prior experience in that. I've been interviewing with several companies in which I was asked similar kinds of questions ...
• 243
21 views

### Dominating set in a connected graph

I have a synchronic ring network with $n$ (i.e. the nodes are connected in a ring), and I need a good approximation (factor of 3/2 of the optimal value) for the minimal dominating set. I also need ...
• 33
18 views

### Partition in a tree shaped distributed network

We are given a synchronic undirected tree shaped network, with $n$ indexed nodes. We know that there is at least one node with at least $\log_k n$ neighbors, $k>1000$, and $k$ is given. We need to ...
• 33
40 views

### Starvation in Dekkers Algorithm

In the dekkers algorithm for the critical section problem, I happened to have come across a scenario in which P0 can starve out P1 in accessing the critical section(CS)(This is not an assertion, This ...
164 views

### Prove correctness of a solution to the critical section problem in general?

I was wondering if there is any formal, general way to prove the correctness of a candidate solution to the critical section problem in synchronization. For example, in the image enclosed, I have ...
20 views

### rendezvous vs normal synchronous send and receive

From what I understand, rendezvous is a message-passing technique where both the sender and receiver are blocking (synchronous) and the receiver acknowledge the send in a binary handshake between them....
137 views

### How to use Parallel Semaphores for Dining Philosophers Problem

I am in an intro to OS class and we are learning about mutual exclusion and semaphores. One classical problem we learned about was the dining philosophers problem. My professor touched on the ...
28 views

### How to reconcile the different definitions of asynchrony?

There are 3 definitions of asynchrony that I know of: In event-based programming, asynchrony refers to the execution of tasks in a non-sequential way, which may involve creating another thread. For ...
1 vote
57 views

### Starvation and Livelock

I think Option C is false. Following is my thought process: Starvation in general mean Process is waiting indefinitely for the resource or to get scheduled etc. [A/c to Galvin Book]. So, here in this ...
• 41
19 views

### Verification of atomic primitives using Petri Net Models

I want to verify semantics of a library of atomic primitives that I wrote. The idea is, only if the semantics of all the primitives are consistent with each other, an application that uses them could ...
54 views

### Simultaneous buffer access in the bounded buffer problem

Galvin and various other resources only allow either the producer or the consumer to access the buffer at a time, the common code is as follows: ...
• 73
1 vote
34 views

### Synchronization in Distributed Systems

If there is no global clock in Distributed systems , then what is the solution for synchronization in DS ? Also , no global clock in DS is a direct consequence of the fact that the only communication ...
• 177
53 views

### Operating system , synchronization

Consider the methods used by processes P1 and P2 for accessing their critical sections whenever needed, as given below. The initial values of shared boolean variables S1 and S2 are randomly assigned. ...
1 vote
29 views

...
• 111
66 views

### Process synchronization problem

The atomic fetch-and-set x,y instruction unconditionally sets the memory location x to 1 and fetches the old value of x in y without allowing any intervening access to the memory location x. Consider ...
1 vote
53 views

### Bakery algorithm: How does it work with single-writer safe registers?

I'm trying to understand the bakery algorithm and read that the Bakery algorithm uses single-writer safe registers. But I am not able to understand the correctness of bakery algorithm with safe ...
1 vote
78 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,547
1 vote
338 views

### Does pre-emption of a process occur when that process is busy waiting?

I was reading about Peterson's Solution for Synchronisation. Let's assume the two shared variables to be int bool flag[2] and ...
1 vote
123 views

### How to prove that an algorithm has no deadlock

I need to mathematically prove that this algorithm is deadlock-free: ...
112 views

### Can timestamp be used in synchronization of processes having Race Condition?

I am wondering whether timestamp can be used to solve process synchronization problem, when race condition occurs? Below is an algorithm for entry as well as exit sections for every process who wants ...
• 21
1 vote
60 views

### How to do atomic operations on systems that don't support it?

I need to sync data with WebDAV and other similar backend that do not have a concept of atomic operations. In some cases, I might need to read a file, change its content and write it back. And of ...
• 119
34 views

### Does this state certify to be called as a deadlock?

I came across following problem: Barrier is a synchronization construct where a set of processes synchronizes globally i.e., each process in the set arrives at the barrier and waits for all others ...
• 1,547
210 views

### Compiler instructions to sync core caches: are they really needed?

I have read reviews of this book, and quote the following from one of the reviews (emphasis mine): Other than straining your eyes with old-styled C++, you can read such misconceptions in the book ...
• 143
36 views

### Any good source explaining multiprocessor synchronization techniques and their implementation

I need to study how synchronization is done in a multiprocessor operating system, but I am unable to find a good source. I have read about it in the book "Modern Operating System" by Tanenbaum, but I ...
641 views

### Why do OS and DBMS have their own synchronisation mechanisms, when OS can alone do it and it sits at the bottom of DB?

I know that synchronization is important in the OS, but why do we need a separate topic synchronization and concurrency in the DBMS? The OS concentrates on program synchronization while the DBMS ...
1 vote
154 views

### Can 2-philosophers problem be analogous to dining philosophers problem?

Two philosophers A and B, two forks numbered "1", "2"; A needs both "1" and "2" for eating, so does B. Is this theoretical a dining philosopher problem? I'm questioning about the forks philosopher A ...
131 views

### How to design synchronisation algorithm to combine two automata?

I have two automata of states, transition and events (Etat, Transition, evenements) and I want to create a function that create the synchronized product between those two automata. For instance, given ...
6k views

### Difference between Lamport timestamps and Vector clocks

Lamport timestamps and vector clocks sound like almost the same thing. Both are used to determine the order of events in a distributed system. What are their key differences?
• 297
1 vote
106 views

### Do we really need a mutex in this case?

Wikipedia's solution for multi Producer-Consumer problem uses both mutexes and semaphores. ...
181 views

### Lamport logical clock: why event occurs in a process with smaller pid is treated earlier?

In lamport's paper1, he define global local timestamp, which is composed of process id and local lamport timestamp. This timestamp is used to order all the events in a distributed system. The rule ...
• 219
764 views

### Lamport logical clock: what does partial mean in the concept of Partial ordering?

In lamport's paper[1], he define two concept The partial ordering and The totally ordering. What does partial mean in ...
• 219
1 vote
57 views

### semaphore for two groups of processes

Can someone help me giving a pseudo code to this problem : There are two groups of processes , A and B. Maximum 3 Processes from group A or group B(only from one group) can use the given resource . ...
• 55
1 vote
146 views

### bakery algorithm, switching up the condition

I'm currently studying the Bakery Algorithm. I understand it for what it is but now I want to switch it up a bit. If we changed the < in the 2nd ...
• 11
807 views

### Does starvation freedom imply progress?

The above answer taken from the book https://www.amazon.com/Operating-Systems-Sibsankar-Haldar/dp/8131730220 says starvation freedom may not imply progress as processes can be deadlocked. I think ...
• 943
88 views

### FLP Impossiblity Result assumption of $C_1 = e'(C_0)$

FLP86's famous proof regarding impossibility of async distributed processes with a single fault assumes in the proof of the third lemma the existence of an event $e'$ such that the neighbor ...
1 vote
45 views

Process X ...
• 23
1 vote
123 views

### Is Dekker's algorithm not k-bounded for any finite k?

Consider this version of the algorithm, for only 2 processes, 0 and 1: ...
264 views

### Is it possible to write a wait free leader election algorithm?

I want to understand if there exists an algorithm which is wait free and operates on non-shared memory, asynchronously. Finally I want to know how to derive the consensus number of this algorithm. ...
1k views

### semaphore implementation with test and set

I'm trying to understand the algorithm for implementing semaphores on SMP system using test and set instruction described here: https://people.mpi-sws.org/~druschel/courses/os/lectures/proc4.pdf (and ...
• 123
1 vote
428 views

### 2:1 Mutual exclusion with semaphores

I'm stuck on this semaphore exercise (it's a exam question of a previous exam and I'm studying for that exam): There are three processes: A, B and C. Process A wants to execute method a(); Process B ...
486 views

### Are Test and set primitives as powerful as semaphores?

I get confused because i don't know if it is possible to use Test and Set primitives in case where more then one process can be enter in critical section at the same time.
463 views

### Can we have a strictly monotonically increasing/decreasing sequence generated by a distributed system?

Just what the title says. Can we have a strictly monotonically increasing/decreasing sequence generated by a distributed system (without a single point of failure)? My current thoughts are that this ...
• 65
64 views

### Should we assume both processes are getting same CPU clock while we solve SYNCHRONIZATION problems in uniprocessor system?

In synchronization, when one process is in a critical section & another is busy waiting, both are using CPU. But in a uni processor system, in the same clock both cant get the CPU. So there must ...
1 vote
120 views

### Behaviour of Regular Registers for Multiple Writer Case ( in context of Safe, Regular and Atomic Registers)

From the link below I understand the behaviour of different kinds of registers. However that raises few more queries in my mind. https://stackoverflow.com/questions/8871633/whats-the-difference-...
172 views

### Algorithm to construct timeline graph with arrival and departure times

So I am trying to construct a timeline graph for threads interacting with synchronization functions e.g. pthread_mutex_lock. I have the following information: 1- ...
• 101