For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > October 2006 > newbie question on synchronization constructs









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author newbie question on synchronization constructs
Digital Puer

2006-10-18, 10:03 pm

Hi, I keep getting this question on programming interviews
(C++/Java on Linux platforms): In the context of Linux and Posix,
what is the difference between semaphores, mutexes, and
condition variables?

I know the difference in principal from academic textbooks,
but I do not know the practical differences in terms of
the Posix APIs (if that's applicable at all). I BS'ed the
interviewer basically that: semaphores are counting
semaphores; mutexes are binary semaphores; and
condition variables are used for signalling wait/notify
for monitors (such as those in Java) but threads
using monitors do not block on condition variables
but rather on mutexes guarding the condition variables.
Is any of this right?

Some help would be appreciated.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com