CS575 Notes

Card Set Information

CS575 Notes
2010-10-23 11:23:49

CS575 Midterm Notes
Show Answers:

  1. One reason GUIs were initially slow to be adopted was the cost of the hardware needed to support them. How much video RAM is needed to support a 25 line 80 row character monochrome text screen? How much for a 1024 768 pixel 24-bit color bitmap? What was the cost of this RAM at 1980 prices ($5/KB)? How much is it now?
    A 25x80 character monochrome text screen requires a 2000-byte buffer. The 1024x768 pixel 24-bit color bitmap requires 2,359,296 bytes. In 1980 these two options would have cost $10 and $11,520, respectively. For current prices, check on how much RAM currently costs, probably less than $1/MB.
  2. Which of the following instructions should be allowed only in kernel mode? (a) Disable all interrupts. (b) Read the time-of-day clock. (c) Set the time-of-day dock. (d) Change the memory map.
    • (a) Disable all interrupts
    • (c) Set the time-of-day clock and
    • (d) Change the memory map.
  3. Consider a computer system that has cache memory, main memory (RAM) and disk and the operating system uses virtual memory. It takes 2 nsec to access a word from cache, 10 nsec to access a word from the RAM, and 10 ms to access a word from the disk. If the cache hit rate is 95% and main memory hit rate (after a cache miss) is 99%, what is the average time to access a word?
    If we use 10,000 words as a sample the system would hit 9,500 words in cache, 495 words in ram and 5 words in disk. 19,000 words * 2 nsec = 19,000 nsec. 500 words (from ram and disk) * 10 nsecs = 5,000 nsecs. 19,000 + 5,000 = 24,000 nsecs total divided by 10,000 words would equal an average seek time of 2.4 nsecs.
  4. When a user program makes a system call to read or write a disk file, it provides an indication of which file it wants, a pointer to the data buffer, and the count. Control is then transferred to the operating system, which calls the appropriate driver. Suppose that the driver starts the disk and terminates until an interrupt occurs. In the case of reading from the disk, obviously the caller will have to be blocked (because there are no data for it). What about the case of writing to the disk? Need the caller be blocking awaiting completion of the disk transfer?
    If the user program is writing to disk and a caller requests to write, it will be blocked because data can be overwritten if not handled with care. This may not be an issue if a buffer was involved.
  5. What is the key differnce between a trap and an interrupt?
    A TRAP instruction is a specific instruction in assembly to switch from user mode to kernel mode and start executing at a fixed address. An interrupt is a pause in execution of what is currently running due to the OS demanding it for one event or another. A key difference is that a trap instruction is reproducible as it always appears in the same place in code while interrupts occur due to events that are not necessarily repeatable for a specific program.
  6. For each of the following-system calls, give a condition that causes it to fail: fork, exec, and unlink.
    • Fork can fail if there are no free slots left in the process table (and possibly if there is no memory or swap space left).
    • Exec can fail if the file name given does not exist or is not a valid executable file.

    Unlink can fail if the file to be unlinked does not exist or the calling process does not have the authority to unlink it.