Take the 2-minute tour ×  I'm debugging a multi-threaded problem
with C, pthread and Linux. On my MacOS 10.5.8, C2D, is runs
fine, on my Linux computers (2-4 cores) it produces undesired
outputs.  I'm not experienced, therefore I attached my code.
It's rather simple: each new thread creates two more threads
until a maximum is reached. So no big deal... as I thought until
a couple of days ago. Can I force single-core execution to
prevent my bugs from occuring?  I profiled the programm
execution, instrumenting with Valgrind:  valgrind --tool=drd
--read-var-info=yes --trace-mutex=no ./threads  I get a couple
of conflicts in the BSS segment - which are caused by my global
structs and thread counter variales. However I could mitigate
these conflicts with forced signle-core execution because I
think the concurrent sheduling of my 2-4 core test-systems are
responsible for my errors.  #include <pthread.h> #include
<stdio.h> #include <stdlib.h> #include <unistd.h>  #define
MAX_THR      12 #define NEW_THR      2  int w