CS 284 Operating Systems
Programming Assignment #5
Due: 9/21/2001 - Class Time
Write a C program that performs the following introductory program with threads.
You may use either Solaris threads or Pthreads.
- Compose a reader function that
- printf()s the argument passed to it
- reads stdin until EOF placing what has been read into char Input (or string
if you prefer)
- thr_exit()s with the value 975
- Compose a writer function that
- printf()s the argument passed to it
- prints the contents of Input until the reader (#1) has ended
- thr_exit()s with the value 739
- main() should
- thr_create the reader passing it the integer 593
- thr_create the writer passing it the integer 481
- thr_join() the 1st thread to exit
- thr_join() the 2nd thread to exit
- printf() the values returned by each of the threads
=================================================================
- If you found the above too easy, (and it was), add a 2nd reader thread,
and perhaps a 2nd writer.
You will use the 'script' command to capture all necessary information for
handin.