CMSC 412 Sample Final

 

  1. (20 points) Define (or explain) the following terms:
    1. Display (screen) protection
    2. encapsulation (in computer networks)
    3. server
    4. remote procedure call (RPC)
    5. monitor (as a synchronization abstraction)

  2. (20 points) In project #5, the waitpid routine blocked waiting for a process to terminate. A useful extension to this routine would be to have waitpid return the exit code from the process when it terminates. If you added this extension, what would be required to ensure that a waitpid would be able to get the exit status of a process even if the waitpid call occurs after the process exits. What would happen if waitpid was never called or called more than once per exited process?
  3. (25 points) The mailboxes that you implemented as part of project #5 provided a way to send messages between processes. In the project, you only sent messages between one sender and one receiver per mailbox. For this question, consider the case of multiple producer (send) and consumer (receive) processes all sharing a single mailbox. A message produced by any producer may be consumed by any consumer.
    1. If all messages sent are small, the same size, and item potent (don’t depend on other messages) are semaphores required to synchronize access to the mailbox? Explain your answer.
    2. Now consider the case where messages are small and fixed size, but not item potent. Instead, the first message of a group indicates how many messages are part of the same object being produced. Is synchronization required for the code shown below? If so, add the required semaphore operations and initial values for the semaphores used.

    Produce(int dest, int count, char **msgs)

    {

    int i;

    char header[MSG_SIZE];

     

    header[0] = (char) count;

    MQ_send(dest, header);

    for (i=0; i < count; i++) {

    MQ_send(dest, msgs[i], MSG_SIZE);

    }

    }

     

    Consume(int src, int *count, char **msgs)

    {

    int i;

    char header[MSG_SIZE];

     

    MQ_receive(src, header, MSG_SIZE);

    *count = (int) header[0];

    for (i=0; i < *count; i++) {

    MQ_send(src, msgs[i], MSG_SIZE);

    }

    }

     

  4. (20 points) Consider scheduling the following tasks (which all arrive at time zero in the order P1 to P4) using: FCFS, non-preemptive priority (lower priority number is higher priority), RR (quantum = 1).
  5. Process

    Burst Time

    Priority

    P1

    10

    1

    P2

    2

    3

    P3

    1

    4

    P4

    5

    2

    1. What is the turnaround time of each process for each of the three scheduling algorithms?
    2. Process

      FCFS

      Priority

      RR

      P1

           

      P2

           

      P3

           

      P4

           

    3. Define waiting time (in the context of scheduling algorithms)?
    4. Why might a single system want to have both non-preemptive priority scheduling for some processes and round robin for other?

  6. (20 Points) Network Routing
    1. Describe one advantage for each of source routing and hop-by-hop routing.
    2. Describe one advantage of per-packet routing and one advantage of per-session routing.

  7. (25 points) Consider writing a filesystem for a write once read many (WORM) drive. On this type of drive, it is possible to write a sector only once. Assume that you must write sectors in order starting from sector 0 and that you can identify the last sector written.
    1. Describe how you might store directory and file information assuming that files and directories are only created and never deleted.
    2.  

       

    3. Describe a way to permit files to be deleted from directories (depending on your answer to part a this may or may not require major changes)
    4. Assuming that price and performance were identical to magnetic drives, give one reason why you still might want to use a WORM drive.

  8. (20 points) Security
    1. Why is computer security only as good as the physical security of the computer itself?
    2. Why would a user want to have mutual authentication?
    3. Why does presenting a user name and a password not provide mutual authentication?