Home CS439

CS439: Principles of Computer Systems

Homework 7, Part 1

Due in Section on Friday, March 25, 2016

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

  1. Consider a program with seven virtual pages numbered from 0 to 6 references its pages in the order:

    0 1 3 6 2 4 5 2 5 0 3 1 2 5 4 1 0

    Using clock page replacement algorithm with 4 frames and assuming demand paging, compute the number of page faults and show the state of frames (pages in frames and value of clock bit) after each page access.
  2. The Operating System gives memory to the heap memory manager k page(s) at a time. Why?

  3. Question 9.19, page 852 in the Second Edition, page 880 in the Third Edition, B&O.

  4. In some operating systems, I/O from/to disk is done directly to/from a buffer in the user program's memory. The user program does a system call specifying the address and length of the buffer (the length must be a multiple of the disk record size).

    The disk controller needs a physical memory address not a virtual address. Your co-worker proposes that when the user does a write system call, the operating system should check that the user's virtual address is valid, translate it into a physical address, and pass that address and the length (also checked for validity) to the disk hardware.

    This won't quite work. In no more than two sentences, what did your co-worker forget?

  5. Given the following piece of code:
    main(int argc, char**argv)
       int child=fork();
       int c=2;
    How many different copies of the variable c are there? What are their values?