Operating Systems

  1. What are the 5 main tasks of an operating system?

  2. There are 3 programs running on the computer:
    1. foo, which has just moved onto the CPU, and needs a total of 170ms of CPU time.
    2. blah, which is on the ready queue, and needs a total of 90ms of CPU time.
    3. hink, which is on the ready queue, and needs a total of 40ms of CPU time.
    4. murg, which is blocked waiting for an IO service that will be completed in another 60ms. Once the IO service is completed murg needs another 30ms of CPU time.
    Using round-robin scheduling, with a quantum of 50ms, show each change to which process is using the CPU and the state of the ready queue, until all processes are completed. Assume that the time taken for the OS to respond to interrupts is 0. Here's the end of things ...
    Time 0           50        60              100             140
    CPU: foo         blah      blah            hink            foo
    RQ : blah<-hink  hink<-foo hink<-foo<-murg foo<-murg<-blah murg<-blah
    IOQ: murg        murg
    
    Time 190        220   260  310  330
    CPU: murg       blah  foo  foo
    RQ : blah<-foo  foo
    
  3. Suppose we have 4MB of memory. Assume that the OS requires 1MB, and device drivers & library routines require 1MB. Draw diagrams showing:
    1. the initial state of memory
      0      1      2      3      |
      OS     DD     Free   Free           
    2. after 2 programs start: xtetris (1.2MB) and xbiff (0.5MB)
      0      1      2        3.2   3.7 |
      OS     DD     xtetris  xbiff Free     
    3. if xtetris stops then xtank (1MB) starts
      0      1      2      3     3.2   3.7 |
      OS     DD     xtank  Free  xbiff Free     
  4. Imagine a disk which has 32 sectors, spins at 7200rpm, and takes 10ms to move the disk head from one track to another. What is the longest time it could take to read a file which is stored on a disk in two separate blocks on separate tracks?