Skip to main content

Questions tagged [semaphore]

0 votes
1 answer
116 views

I have an app written in java and using mysql as DB. I need to create a coupon distributed system where I have 100 coupons stored in DB and the first 100 customers who login should get those coupons. ...
dev Joshi's user avatar
  • 109
0 votes
1 answer
159 views

I'm not sure if my answers to the following exercise is correct: Suppose the program is run with two threads. Further suppose that the following sequence of events occurs: Time Thread 0 ...
Lilian Shi's user avatar
3 votes
3 answers
5k views

I have never used atomic operations, and remain largely ignorant of how to utilize them. And yet, I often come across objects like this when peering into Qt's backend: https://doc.qt.io/qt-6/...
Anon's user avatar
  • 3,649
-4 votes
3 answers
789 views

Here are some discussions about mutex (lock) and binary semaphore from two OS books. Stalling's Operating Systems book says A concept related to the binary semaphore is the mutex . A key ...
Tim's user avatar
  • 5,555
1 vote
2 answers
2k views

Here are some discussions about mutex (lock) and binary semaphore from two OS books. Stalling's Operating Systems book says A concept related to the binary semaphore is the mutex . A key ...
Tim's user avatar
  • 5,555
1 vote
1 answer
1k views

Operating System Concepts discusses two implementations of a semaphore, by busy waiting in Section 5.5 and by blocking the current process in Section 5.6: Section 5.5 A semaphore S is an integer ...
Tim's user avatar
  • 5,555
-1 votes
1 answer
253 views

In Little Book of Semaphores: 4.1.6 Finite buffer producer-consumer solution Finite buffer consumer solution 1 items.wait () 2 mutex.wait () 3 event = buffer .get () 4 mutex. signal () 5 spaces . ...
Tim's user avatar
  • 5,555
0 votes
1 answer
2k views

According to Wikipedia: Semaphores are a useful tool in the prevention of race conditions; however, their use is by no means a guarantee that a program is free from these problems. Semaphores which ...
Tim's user avatar
  • 5,555
-1 votes
1 answer
205 views

Generally, if two semaphores are acquired one after the other, is there difference between releasing them in the same order or the reverse order as they are acquired? In the following solution to the ...
Tim's user avatar
  • 5,555
28 votes
5 answers
7k views

Operating System Concepts says 7.4.4 Circular Wait The fourth and final condition for deadlocks is the circular-wait condition. One way to ensure that this condition never holds is to impose a total ...
Tim's user avatar
  • 5,555
-2 votes
2 answers
1k views

A bakery shop has to provide a stream of muffins for customers. The muffins are made by a baker in the kitchen and placed on a conveyor belt. The conveyor belt carries the muffins to where the ...
Callum Bell's user avatar
-1 votes
1 answer
542 views

I am on a project for which I have to spawn many different processes, all in different executables, and there will be some shared memory segments and some semaphores to synchronize them. I use an "...
George Sp's user avatar
  • 119
-1 votes
1 answer
2k views

I understand in a single core system, multiple threads operate in sequence, scheduled by the OS. Hence it can't be possible to have a race condition since by definition they are taking turns locking a ...
Chowza's user avatar
  • 101
4 votes
1 answer
1k views

Let’s assume there is a function EventHandler that is called on multiple threads at different points in time. EventHandler has to call SomeOtherFunction, but these calls shall only happen on one ...
Martin's user avatar
  • 476
16 votes
1 answer
2k views

It doesn't seem to me that a railway semaphore describes a semaphore better than any other generic signalling object, like a flag or a stoplight. Even something like a keyring (people take keys off ...
eyqs's user avatar
  • 271

15 30 50 per page