slowprimes.c implements a naive method of calculating the
number of primes less than N by checking if each number is divisible by some
other number. This problem is easily parallelizable as checking a number is
independent from checking other numbers. slowprimes.py implements the same
algorithm in Python.
primes.c implements the sieve of Eratosthenes, which is
asymptotically faster than the naive method. We can see orders of magnitude
of performance improvement over the parallelized version of the above.
However, this algorithm is not so cleanly divisible into subproblems, and we
should see some but not much time improvement when using multithreading.
badcnt.c shows what could happen when two threads compete for the
same memory resource.
goodcnt.c shows how to use semaphores to synchronize access to
shared resources.
Finally, bomb.c shows how to communicate between two threads.