CS360 Final Exam: December 12, 2000. Question 3

Write a program called server, which does the following: Implement this using pthreads. You may use global variables if you want. I don't care, and it will make your life easier.

Also, you may use the routines from jthread.h if you would like.

Make sure your program does not perform poorly if there are bad network connections, and do not make an inordinate number of system calls if you do not have to. Do not worry about handling SIGPIPE.


CS360 Final Exam: December 12, 2000. Question 4

Part i: Why did I say to use the routines from jthread.c in Question 3?

Part ii: Precisely define the semantics of the two functions:

       int pthread_cond_wait(pthread_cond_t *cv, pthread_mutex_t *lock); 
       int pthread_cond_signal(pthread_cond_t *cv); 

CS360 Final Exam: December 12, 2000. Question 5

Write a program called shc.c, which does exactly what the shell does when it executes:

sort < f1 | head -5 | cat -n

You must do your answer on the answer sheet provided, because it fills in some of the code for you.

If you start and mess up, take another answer sheet. I have made at least two copies for each person.