Practice Final Examination

Course: Csci 5102

Quarter: Fall 1998

Time Allocated: 75 minutes

Instructions:

1. This is an open book exam. You may consult notes, Unix man-pages , textbook or recommended books. Please do use a any other material or computers.

2. It covers the topics of processes, files and signals. Prerequisite knowledge of C programming language and basic familiarity with Unix operating systems is assumed.

3. There are 5 questions. Budget your time to be able to answer al the questions.

 

Question 1. Determine the trueness of the following statements by marking them "True" or "False". Briefly justify your answers.

1a. User threads can be used to increase the resources available to a process.

 

1b. User threads are faster to create and switch between relative to kernel threads.

 

1c. When a proces exits, all threads within the process terminate.

 

1d. Each thread within a process can have different signal masks.

 

1e. A signal delivered to a process must be handled by every thread within the process.

 

1f.. Universal Internet Communication Interface uses a shared port at server for all communications with different clients.

 

------------------------------------------------------------------------------------------------

Q. 2a. What is Universal Internet Communication Interface. How is it diferent from the "Sockets" interface for network communication?

 

Q. 2b. What are the problems with using <hostname, process-id> for naming server processes, e.g. network print server? How does <hostname, port number> solve these?

 

Q. 2c. What a "signal mask"? Which system calls mask all signals to a thread?

 

Q. 2d. Compare and contrast the following: "async-signal safe" and "thread-safe" .

How can you make a function async-signal safe and thread-safe?

 

Q. 3. Consider program 12.3 and 12.4 (pp. 440-3Provide brief explanation of your answer and identify your assumptions.

Q3a. Determine the output of the program pair assuming no errors.

Q3b. How will the following events affect the output/behaviour of the program pair?

(1) A network failure before u_connect() (pp. 443).

(2) A noisy network loses some of the data,

i.e. some buffers written by client do not reach server.

 

Q. 4. Consider the Program 10.3 (pp. 373-4). How will the following modifications affect its correctness? Briefly justify your answers.

(4a). The program is run on a machine with two processors. Producer and Consumer threads run on different processors.

 

(4b) The producer() functions has two calls to put_item() in its critical section.

 

(4c). There are two producers and a single consumer