Using Pthread on Linux

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

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
gcc yourprogram.c -lpthread -o yourbinary
At this point you'll get an executable binary.


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