Answer by Chintan Parikh for multi thread in c question
The question you have asked is classical case of "bounded waiting", and there is known way of solving this via [Bakery Algorithm].1The basic idea here is that you maintain two counts, first is current...
View ArticleAnswer by JMarsch for multi thread in c question
It's up to the operating system. In Windows, there is no guaranteed order that any given thread will be awoken and granted the mutex.
View ArticleAnswer by JSBձոգչ for multi thread in c question
Generally threading libraries do not make any such guarantees, because most OS's don't make any such guarantee. The thread wrapper can't (usually) do any better than the native OS thread management...
View ArticleAnswer by Carl Norum for multi thread in c question
That sort of behaviour would have to be an implementation detail of your threading library (which you didn't mention). I would guess most threading libraries don't make any such a guarantee, though....
View Articlemulti thread in c question
Does mutex guarantee to execute thread in order of arriving? that is, if, thread 2 and thread 3 arrive is waiting while thread 1 is in critical sectionwhat exactly happen after thread 1 exit critical...
View Article
More Pages to Explore .....