
Shadow Homework on Networking
CS241 System Programming
Instructor Klara Nahrstedt
Posted May 1, 2006
1. When a procedure is scooped from one machine and placed on another to be
called by RPC (Remote Procedure Call), some problems can occur such as
pointer, unknown array sizes, unknown parameter types and global variables. An
issue not discussed in the class is what happens if the (remote) procedure executes
a system call. What problems might that cause and what might be done to handle
them?
2. What is a zombie child in parent-server strategy? What happens if in the
following pseudo-code (see below) the server parent does not periodically wait
for its zombie child?
For (; ;) {
Wait for a client request on the listening file descriptor
Create a private two-way communication channel to the client
Fork a child to handle the client
Close file descriptor for the private communication channel
Clean up zombie children }
3. What happens if the client name does not fit in the buffer passed to u_accept?
4. Consider the program 18.1 in R&R. Suppose we try to make a bidirectional serial
server from this program by declaring an integer variable called child and
replacing the following line bytecopied = copyfile(STDIN_FILENO,
communfd) with the replacement code
if ((child = fork()) == -1) {
perror(“failed to fork a child”); return 1; }
if (child == 0)
bytecopied = copyfile(STDIB_FILENO, communfd);
else
bytecopied = copyfile(communfd, SDTOUT_FILENO);
What happens if we do this replacement?
5. Consider the program 20.2 in R&R. What happens if you start this program
without starting the corresponding server?
6. Draw a timing diagram that illustrates a scenario in which the server receives a
client request and then crashes before processing the request.