Questions tagged [semaphore]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
62 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 ...
user avatar
4 votes
0 answers
51 views

Why semaphores lead to loss of modularity?

In this article Semaphores in Operating System and other articles on the internet, they have mentioned one of the disadvantages of semaphores is that it leads to loss of modularity. They further said ...
user avatar
  • 141
0 votes
1 answer
64 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 ...
user avatar
1 vote
1 answer
291 views

How are semaphores and test-and-set instructions connected?

Cheers, so my textbook explains these parts very poorly, so I would gladly take any advice! I am confused between the test-and-set instructions, which per my book is a very common CPU instruction set, ...
user avatar
1 vote
1 answer
45 views

How to trigger a thread to start working using semaphore?

How to trigger a thread to start working using semaphore? I have find a lot of explanation about thread and semaphore but i still don't understand, any help please
user avatar
  • 115
0 votes
1 answer
69 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 ...
user avatar
0 votes
1 answer
120 views

When does a semaphore issue a wait and when does it issue a signal?

In my textbook, Operating Systems: Internals and Design Principles (9th Edition) by William Stallings in chapter 5, it explains how semaphores work: The fundamental principle is this: Two or more ...
user avatar
1 vote
0 answers
27 views

Comparing wait-signal alternatives for synchronizing two piece of programs

I came across following problem: A certain computation generates two arrays a and b such that ...
user avatar
  • 1,547
2 votes
1 answer
182 views

Designing solution to critical section problem with two semaphores vs single semaphore

I came across following problem: Let two processes P1 and P2 are there: ...
user avatar
  • 1,547
2 votes
0 answers
35 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 ...
user avatar
  • 1,547