Using Pthread on Linux

After you get an eecg account please ssh into ra.eecg.toronto.edu and then from there ssh into one of the following Linux machines: 

chocolate.eecg.toronto.edu                                                                                                                                                    platinum.eecg.toronto.edu                                                                                                                                                     magenta.eecg.toronto.edu                                                                                                                                                       maroon.eecg.toronto.edu                                                                                                                                                          mauve.eecg.toronto.edu                                                                                                                                                                mint.eecg.toronto.edu                                                                                                                                                                  navy.eecg.toronto.edu                                                                                                                                                                ochre.eecg.toronto.edu

Man page

First "man -k pthread " to get all the pthread interfaces. There is a man page for each of the pthread primitive.

Compile, link, run

You must include the header file pthreads.h in your source file (#include <pthread.h>), and link the pthreads library. 
cc yourprogram.c -lpthread -o yourbinary
or
gcc yourprogram.c -lpthread -o yourbinary
At this point you'll get an executable binary.

Examples

Some code examples including the parallelization of matrix multiplication, sor and TSP discussed in class are here:  Examples