First, pthread_setconcurrency() does nothing on Linux. Second of all, the lack of a Makefile made it difficult for me to run this program. Third of all, a documentation issue: the use of M and N is appropriate for a mathematical formula, but not for software; better would have been the names NBERTHS and NSHIPS. The condition "full" needs to be described. What do you actually intend it to do? The constant 3000 also needs to be described and probably made into an explicit named constant. If you did those things it would be easier for me to look at your code and understand what you're trying to do. The variables "ships" and "waiting" might be better named "ndocked_ships" and "nwaiting_ships", or something of the sort. Incidentally, document that you use waiting purely for printing debugging messages. It would also be very nice if your code would compile cleanly under GCC with various warnings enabled. I personally have the environment variable CFLAGS set to the following by default: export CFLAGS="-pipe -ggdb3 -W -Wall -Wbad-function-cast -Wcast-align -Wpointer-arith -Wcast-qual -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -fkeep-static-consts -fkeep-inline-functions -Wundef -Wwrite-strings -Wno-aggregate-return -Wmissing-noreturn -Wnested-externs -Wtrigraphs -Wconversion -Wsign-compare -Wno-float-equal -Wmissing-format-attribute -Wno-unreachable-code -Wdisabled-optimization -Wendif-labels" Now to the meat of the matter, the *pthread* calls: I have personally always used pthread_cond_wait() from inside of a while() loop, just in case the condition status has changed between the time someone sent the signal and the time the waiting thread received it. This code would be more robust and simpler if you assumed that the condition being signalled did not necessarily mean that there was actually a berth available, just that there might be one. Then, at least while you're debugging, use pthread_cond_broadcast() instead of pthread_cond_signal(). And get rid of the if() statement guarding the pthread_cond_signal (now to be pthread_cond_broadcast()). Just always broadcast; if there are no listeners, the runtime system will throw away the broadcast. You can add the if() back after you have your implementation working in the simple mode. E, finalmente, chi é Tazio? --Steve Augart -- Steven Augart Jikes RVM, an open source Java Virtual Machine http://oss.software.ibm.com/jikesrvm Office: +1 914/784-6743 T.J. Watson Research Center, IBM