Assignment 1: Fun with Threads
CS33100 - Advanced Operating Systems
Fall, 2002
Due : Tuesday, October 8.
The Royal Society for Putting Little Numbers in Front of Big Numbers
has decided that it is imperative to sort large files of
double precision IEEE-754 floating point data. For this, they have
contacted you to write a sorting program this purpose---mostly because no
one else was around and you didn't seem to be particular busy.
Your task is simple. Write a program that reads the file "/scratch1/numbers",
sorts them in ascending order, and writes them back to a file "sorted". You
must do this on schlitz.cs.uchicago.edu, a 4 processor Sun server. Moreover,
your program should use threads to make the program run as fast as possible.
Here are a few specific details:
- The file /scratch1/numbers contains IEEE-754 double precision floating
point numbers stored in binary format. This is the same type as C "double".
- Your program must be written in C or C++ and use either Solaris threads
or POSIX threads. Look at the man pages for thr_create() or pthread_create()
for some details and pointers.
- You may use the C qsort() function if you think it will help.
- You may not have enough disk space in your home directory to write the
output file in this assignment. If not, just make a directory for yourself on
either /scratch1 or /scratch2 and run the program there.
- Grading is simple. Whoever has the fastest program (wall-clock time) gets 100%.
Your grade will be determined by the speed of your program relative to the fastest
solution (i.e., twice as slow = 50%).
- Good luck :-).