This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Conditions, flags and mutexes


Björn Stenberg wrote:
> 
> Is there a description somewhere that details the conceptual differences
> between conditions, flags and mutexes, and why they are all implemented?
> The reference manual tells me how to use them, but is short on "why".

And you forgot semaphores :-).

I think you want a book on concurrency theory. My personal recommendation
is "Concurrent Systems" by Jean Bacon, published by Addison Wesley.

> I don't understand what conditions do that mutexes don't. Serializing
> multiple threads' access to data? Mutexes can do that. Waking up several
> threds at once? Fine, so why do we need mutexes then? Also, what is a flag
> other than a "multi-mutex"? Why do we have mutexes if flags are a superset
> of them?

A short answer is that there *is* deliberate overlap between these
features. The kernel does not impose policy on how programmers care to
write their program. Instead we just give a box of tools with some of the
most common paradigms.

Flags are uniquely useful in that it is much more complex to do "AND"
semantics for events using the other primitives. Counting semaphores come
close, but not quite.

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]