Skip to main content

Questions tagged [mutex]

-1 votes
0 answers
45 views

I am implementing a multithreaded C server where clients are stored in a linked list of structs. Each struct contains, among other fields, the socket (sk) for communicating with the client. The list ...
dok's user avatar
  • 311
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
6 votes
1 answer
1k views

Current situation Right now I have a method like Data lookupData(Key id) { std::lock_guard<std::mutex> lock(m_mutex); auto it = m_dict.find(id); if(it == m_dict.end()) { ...
Daniel McLaury's user avatar
0 votes
1 answer
1k views

Is a mutex lock always implemented as spin waiting? Can a mutex lock be implemented as block waiting? (Operating System Concepts section 5.4 only mentions the implementation by spin waiting. See below....
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
-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
0 votes
0 answers
86 views

I am confronted to a question regarding synchronisation between threads having shared data. This is a stripped down versino of my class : class Foo { private: boost::mutex m_mutex; std:vector&...
drbradock's user avatar
2 votes
0 answers
199 views

I am attempting to write a code to test Lamport's Mutual Exclusion algorithm for safety as a correctness measure. I am running the alogrithm on a single core cpu machine with multiple processes ...
Varun Hegde's user avatar

15 30 50 per page