CS241 System Programming: Shadow Homework on Networking Issues, Assignments of Computer Science

Six questions related to various networking issues in system programming, including remote procedure calls, zombie children in parent-server strategy, buffer overflows, and server crashes. The questions are based on the cs241 system programming course taught by klara nahrstedt and are taken from her shadow homework posted on may 1, 2006.

Typology: Assignments

Pre 2010

Uploaded on 03/11/2009

koofers-user-gno-1
koofers-user-gno-1 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
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.

Partial preview of the text

Download CS241 System Programming: Shadow Homework on Networking Issues and more Assignments Computer Science in PDF only on Docsity!

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 }

  1. What happens if the client name does not fit in the buffer passed to u_accept?
  2. 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?

  1. Consider the program 20.2 in R&R. What happens if you start this program without starting the corresponding server?
  2. Draw a timing diagram that illustrates a scenario in which the server receives a client request and then crashes before processing the request.