CS372: Homework 13

Problem 1:

A system uses multi-partition allocation with swapping. The size of main memory is 128K, and there are 4 programs running with sizes 64K, 64K, 32K, and 16K respectively. Each program runs for 50msec, and then requests an I/O operation that requires 20msec. A program can be swapped at the rate of 8Kbyte/20msec. Compute the CPU utilization under round-robin scheduling. Devise a better scheduling strategy and show it has a better utilization.

Problem 2:

In problem one, compute the CPU utilization if we:
  1. replace the CPU by one that runs 10 times faster
  2. double the size of main memory

Problem 3

Alice P. Hacker is a Head Guru in MacroHard, a software company known for operating systems with very sorry quality. She suggested a trick to reduce the pressure on the swap space. Instead of swapping out pages that belong to code texts into the swap area, the operating system could just take away the memory frames. If the code page is needed later, it could be paged directly from its binary file. Her argument is that the operating system will save time by not storing the code page into the swap space, and will save space in the swap area. The code text exists on disk anyway, and could be fetched from there. Would you approve of this design? Why or why not?

Problem 4:

You are designing a program to automate the publication of stock data in the Greedy Stock Exchange system. To simplify the design, the structure of the application is such that the stock data file will be shared in read-only mode among the processes that are used by brokers, while the exchange manager will run a different process that can update the stock data. All processes will run on the MegaGiga mainframe system running the Solaris operating system. Using the system calls mmap(), mprotect(), and any other call you deem necessary, explain how the processes can share the stock data file as required. Show how the system calls will be used and explain the arguments that will be used to establish the solution.

Problem 5

In some operating systems, IO 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. Ben Bitdiddle 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 Ben forget?