[Barrelfish-users] thread_cond_wait() and disp_disable()

Georgios Varisteas yorgos at kth.se
Fri Jul 13 15:09:34 CEST 2012

Thanks Simon, your reply forced me to look very deep in my code and found one of those bugs that are never revealed, until you assume they exist.

Obviously it had little to do with the whole thread blocking system.


From: Simon Peter [speter at inf.ethz.ch]
Sent: Friday, July 13, 2012 14:32
To: Georgios Varisteas
Cc: barrelfish-users at lists.inf.ethz.ch
Subject: Re: [Barrelfish-users] thread_cond_wait() and disp_disable()

> I have two threads running on a single core, namely the master core 0, and I thread_cond_wait() one of them; normally it should block while the other thread continues uninterrupted. However, everything stop.

That shouldn't happen. If you're sure that everything has stopped, while
it shouldn't, then this is a bug in the threads system and we should

> I looked at the code and, if I'm not mistaken, the dispatcher is disabled for achieving atomicity in the wait but not enabled again, until the waiting thread is signaled. Is that correct? Does that mean that the thread model in Barrelfish is meant to support just one thread per core per domain?

No. The thread will block while the dispatcher is disabled to achieve
atomicity in executing the block, as you correctly found out. However,
the disaptcher will be enabled again for the next runnable thread.

> If my intuition is correct, is there an alternative to blocking a thread in a way that another thread can awake it, allowing other threads to work on that same dispatcher? Or should/can I have multiple dispatchers on the same core in the same domain?

Multiple dispatchers on the same core per domain are possible, but not
needed in your case.


More information about the Barrelfish-users mailing list