Home CS439

CS439: Principles of Computer Systems

Homework 9, Part 1

Due in Section on Friday, April 15, 2016

Part 1 of the homeworks must be completed before section and brought to section. Please refer to the homework turnin instructions.

  1. What does the function pthread_detach() do? What default behavior of threads does it alter? When might it be useful?

  2. In Unix, the pipe(2) function call creates an I/O mechanism called a pipe and returns two file descriptors, fd[0] and fd[1]. The files associated with fd[0] and fd[1] are streams of data and are both opened for reading and writing. Suppose pipe always returns the two lowest-numbered file descriptors in the process's file descriptor table that are unused. Assume that initially fdt[], the file descriptor table, has three open entries: fdt[0] is the default input device, fdt[1] is the default output device and fdt[2] is the default error output device; all other entries of the fdt are NULL. What does the fdt look like after each of the five following commands is executed in sequence by the process?

    1: pipe (&fd[0]);
    2: close(fd[0]);
    3: close(1);
    4: dup(fd[1]);
    5: close(fd[1]);

    When might such a sequence of commands be useful?

    You'll need to use the man pages for pipe, close, and dup to answer this question.

  3. Using the traceroute command, trace the hops a packet takes from one of the UTCS machines to a website in Europe. Inspect the trace. What do you notice? Do you see any machines you recognize? ISPs? Cities? Please be sure to tell us what website you used.

    Perform the trace again. How does the second time affect the output?

  4. Describe the steps necessary to prepare a server to accept connections. How does it accept a connection?

  5. Which is the best (fastest) network on which to implement a remote-memory read that sends a 100 byte packet from machine A to machine B and then sends a 8000 byte packet from machine B to machine A?
    1. A network with 200 microsecond processing overhead, 10 Mbyte/s bandwidth, 20 microsecond latency
    2. A network with 20 microsecond processing overhead, 10 Mbyte/s bandwidth, 200 microsecond latency
    3. A network with 20 microsecond processing overhead, 1 Mbyte/s bandwidth, 2 microsecond latency
    4. A network with 2 microsecond processing overhead, 1 Mbyte/s bandwidth, 20 microsecond latency