Operating System -- The Final in a Can

Misc.
  1. Which of these is normally part of the operating system kernel?  Circle all that apply
    the device drivers                                                       the command interpreter (e.g. command.com or /bin/bash)
    the code implementing the filesystem                   the code implementing the file manager
  2. What's you favorite soft drink? __________________________________________
Processes
  1. When a process would like to use the CPU but does not yet have the CPU, what queue is it in?
    1. A Wait queue
    2. The Run Queue
    3. The Busy Queue
    4. The Process Control Block
    5. The Ice Cube Tray
    6. None or all of the above
  2. __________ On a NMU laptop, how many processes can be in the Run Queue at once?
Scheduling
  1. Which of these scheduling algorithms would work well for a Real Time OS?
    FCFS                                                Shortest Job Next
    Round Robin                                   Priority
    Round Robin with Aging             First Come First Server with Aging
  2. Using shortest Job next, what is the "job" that the timing number refers to?
    1. How long the process will need the CPU before it calls exit()
    2. How long the process will need the CPU before it calls fork()
    3. How long the process will need the CPU before it calls sleep()
    4. None of the above
  3. (Yes/No) My new scheduling algorithm us called "random", and it picks a random process to run.  Is random with preemption subject to starvation in theory?
File systems
  1. Name a task that FAT32 is much better at than EXT2




  2. You had both read and write caching, with average hit rates.  Suppose to save RAM you eliminate the file cache.  GENERALLY SPEAKING on a NORMAL COMPUTER, How would that effect file operations?
    1. Read might be about twice as slow, write might be about twice as slow
    2. Read might be mostly uneffected, write might be about twice as slow
    3. Read might be LOTS slower, write might be uneffected
    4. Read might be about twice as slow, write might be LOTS slower
  3. Name one part of an EXT2 filesystem (e.g. block bitmap, group descriptor) that you could not repair if the data were lost.



  4. You have a FAT16 filesystem.  You have a 3G hard drive.  You write a one byte file.  How much space does it need?




  5. __________  You have a filesystem just like EXT2, but each inode only holds 12 pointers (10 direct, 1 indirect, and one doubly indirect).  The file system has 1K blocks, and each pointer takes 4 bytes.  What's the biggest file you can make on this filesystem.
Memory Management
  1. _____________ On Tuesday, I was running seven copies of a program that helps me plan Coke production.  This program used 200K or RAM for code, and 50K or RAM for data.  The data was different for every copy I ran.  How much RAM do I need to run all seven programs and avoid swapping or paging?
  2. _____________ I have a program that uses 500K.  I call fork().  Assume my operating system uses copy-on-write.  At the instant that the fork() is finished, how much RAM do I need to avoid swapping or paging?
  3. _____________ Assume int's are 4 bytes each.  Assume that it takes 10ms to bring a page in from the disk, and that I only have 10M or RAM available for the array 'pepsi'.  I have lots of free disk space for swapping and paging.  Assume that the non-disk parts of the program below take an insignificant amount of time.  How long does the program below take to run?  Your answer should be in seconds.
    main() {
        int i, j, pepsi[10 * 1000 * 1000];
        for(i = 0; i < 1000*1000; i++) {
              j = random_from_one_to_ten_million();
              pepsi[j] = 3;
         }
    }
  4. _____________ Assume int's are 4 bytes each.  Assume that it takes 10ms to bring a page in from the disk, and that I only have 10M or RAM available for the array 'pepsi'.  I have lots of free disk space for swapping and paging.  Assume that the non-disk parts of the program below take an insignificant amount of time.  How long does the program below take to run?  Your answer should be in seconds.
    main() {
       int i, j, pepsi[10 * 1000 * 1000]; 
       j = 0;
       for(i = 0; i < 1000*1000; i++) {
              j = j + 10
              pepsi[j] = 3;
         }
    }
  5. Looking at a page table, what does it mean if the  'dirty bit' is set?




  6. ______________ Each page is 1K.  You have a 32 bit CPU with 256K total RAM.  The virtual address space for this process is 100K.  Each page table entry takes 20 bytes.  How big is the page table for this process?
  7. I have a 32 bit CPU, with 256K total RAM.  Each page table entry is 17 bytes.  A process would like to see 1M of virtual memory.  What happens?
    1. It works
    2. It works, but there might be some swapping.
    3. It doesn't work. No one process can have more virtual address space than the total amount of RAM on the system.
Device Drivers
  1. Normally, when does the interrupt happen (pick ONE)?
    1. When the I/O is started.
    2. When the I/O is finished.
    3. On error.
  2. Which set of information might be given to the disk driver (pick ALL THAT APPLY)
    1. The filename to open from the disk
    2. The block number to retrieve from the disk
    3. The memory location to store the data
  3. What normally happens when you have in you OS a device driver, but that device is not attached (pick ALL that apply)?
    1. Wastes memory
    2. Locks up the computer
    3. Uses CPU cycles as the computers runs
    4. None of the above
Disk Drives
  1. What makes RAID-5 better than RAID-4?
    1. Reads are faster
    2. Writes are faster
    3. It holds more
    4. It's less prone to disk failure
  2. (True/False) Among disk scheduling algorithms, shortest seek next is provably optimal.
  3. Among disk scheduling algorithms, I want fairness above all else.  What algorithm should I use?


  4. _____________ You are going to launch an orbital probe to Venus, to see if they drink Coke there.  On the mission, the pointy headed people think EACH disk has a 10% chance of failure, due to the vast clouds of hot hydrogen sulfide and vaporous Sprite.  You have a RAID-1 setup with 4 disks.  What are the odds the probe gets to Venus without having lost any data?
  5. Connect with lines
    RAID-0                                                Holds the least data                                                                                             
    RAID-1                                                Holds the most data
    RAID-5                                                The Middle One
  6. ____________ You have a disk with 1000 sectors per track, 4 platters, 250 cylinders, and each sector holds 1K.  The disk holds 1G.  The computer has 256M or RAM, on a 32 bit CPU using EXT2.  When you spill Squirt on the disk, how many sectors have you destroyed?  (How many sectors on the disk in total?)
  7. You are Coke, inc.  You have lots of account balances to update every day.  You cannot stand to loose data.  You have lots of money.  Which RAID system would you use, and WHY?






  8. _____________ You have two disks.  The first is 1G, and the other is 1.5G.  Using RAID-1, how much can they hold?



Deadlocks
  1. Process one wants the lock for the page table, and holds the lock for the ready queue.  Process three wants the lock for the serial port, and has the lock for the page table.  Process #217 holds the lock for the USB port, and wants the lock for the page table.  Process four has the lock for the serial port, and wants the lock for the ready queue.  Unfortunately, process four is in an infinite loop, and is unlucky to ever make forward progress again.  Can process one ever finish (without killing or taking locks)?
  2. Which is true?
    1. There are more integers than even numbers
    2. There are the same number of even numbers and integers
    3. There is a need for a Coke, and a smile.