CS3013 Practice Final Exam

  1. Fragmentation:

    1. What kind of fragmentation do we have with fixed-size partitions?
    2. What kind of fragmentation do we have with paging?
    3. What kind of fragmentation do we have with variable-size partitions?

  2. Briefly describe what happens basic linking. Then, briefly describe the difference in dynamic runtime linking

  3. Consider the following page reference string:

        5,2,3,7,6,3,2,5,2,3,2
    

    Assume pure demand paging so your first unique pages will all cost one fault each. Assume the process has a 3 frames at all times.

    1. How many page faults would occur for a Least Recently Used (LRU) replacement algorithm using 3 frames?
    2. How many page faults would occur for the worst possible page replacement algorithm? Describe how this algorithm works.
  4. Consider a demand-paging system with the following time-measured utilizations:

        CPU utilization:     10%
        Paging disk:         98%
        Other I/O devices:    8%
    

    Which (if any) of the following will (probably) increase CPU utilization?

    1. Install a faster paging disk
    2. Increase the degree of multiprogramming
    3. Decrease the degree of multiprogramming
    4. Install more memory
    5. Upgrade to a high-bandwidth file system

  5. Suppose that a 32-bit virtual address is broken up into three fields: a, b, and c. The first two, a and b, are used for a two-level page table system. The third field, c, is the offset. How large is each page? How many pages can be in a logical address space?

  6. Typically, the number of page faults is directly proportional to the number of page frames allocated to a process. If the number of frames given to the process is doubled, the number of page faults is typically halved. Suppose that a normal instruction takes 1 microseconds, but if a page fault occurs, it takes 10001 microseconds. If a program takes 30 seconds to run, during which time it has 1000 page faults, how long would it take to run if twice as much memory were available to it?

  7. Put the system calls in order for use in a typical shared-memory program:

    1. shm = shmat(id)
    2. strcat(shm)
    3. shmctl(id, IPC_RMID)
    4. shmdt(shm)
    5. id = shmget(KEY, SIZE, PERMS)

  8. Given the template for a WaitSemaphore() system call:

    /* Do a semaphore wait on the semaphore indicated by sid */
    int WaitSemaphore(int sid) {
      /* statements a-h here */
    }
    

    Put the following statements in the right order:

    1. return 0;
    2. endif
    3. if (sema[sid].count < 0) then
    4. sema[sid].count--;
    5. pd[current_process].state = BLOCKED;
    6. if (!sema[sid].allocated) return -1;
    7. Dispatcher();
    8. insert(sema[sid].queue, current_process);

  9. What is the role of the device independent layer of a device driver?


Return to the CS3013 Home Page