Fall 2013
Lab 10
Due Wednesday, November 20

Searching a Linked List Using 2 Threads

The starter code for this lab can be downloaded here.

The function build_list(int size) constructs a list for you. Each node has an index and a payload. The indexes are in order from one end of the list to the other, but they are not consecutive.

I have included a single threaded function scan_list that looks for the first node whose payload is strictly greater than the supplied integer parameter. Your task for this lab is to implement an improved version of scan_list that is capable of using two threads to scan the list looking for the first node whose payload is strictly larger than the specified parameter. Should it fail to find any nodes meeting the bill, it should return NULL.

You should replace the scan_list currently in the listscan.c file with your own version of the same function.


Your program should compile with the following command:
gcc listscan.c -std=c99 -lpthread

Running the Program

The program is set up to take two command line parameters: the first is how long the list should be, and the second is the number to you are looking to find a payload larger than.


In addition, remember, you may lose points if your program is not properly structured or adequately documented. Coding guidelines are given on the course overview webpage.