1. List the functions a server would use to set up a "well-known" socket for communicating with clients, and tell what each function does.

2. List the functions a client would use to connect to a server, and tell what each function does. Assume the program already knows the server's host name and port number, and go from there.

3. Write a program that computes the value of to 99,000,000 places and prints how many digits it has completed whenever the user types ^C. You may assume that someone has already written a function named computePi() that does the actual computation and that every time this function computes a digit, it increments a global int named numDigits. Assume that the function prototype for computePi() is given to you in a header file named piStuff.h.

4. Assume the program you wrote for Question 3 is in a file named miStuff.cc and that the source code for computePI() is in another file named pyStuff.cc. Write a Makefile that will build a program named busyBusy by performing just those compilations and linking operations that are necessary when any of the three source files are edited.

5. Tell what the ci and co commands do, and tell what the -l command line option does with co.

6. Assume you wrote a function named readMsg() that contains the statement,
numBytes = read(skt, &msgBuf, sizeof(msgBuf));
Give the sequence of gdb commands that you would use to examine the value of numBytes and the contents of msgBuf after this call to read(). If you prefer, you may tell how you would do this using ddd instead. There is not enough time to single step through the whole program to get to this statement.

7. The behavior of read() is different depending on whether it is reading from a terminal, a disk file, or a stream socket. Tell what these differences are, including how long the process might block and how to interpret the value returned by read().

8. Tell what "network byte order" refers to and what functions a distributed application must use to deal with it. Be specific about the circumstances in which the functions must be used.

9. What must the kernel do when it performs a context switch between two processes? How does this differ from what it must do to switch between two threads running in the same process?