The Twinky Final

This test is all about an Operating System named TwinkyOS.  This operating system will be used to control several machines and sensors at a Twinkie making factory.
  1. The factory contains many hundreds of devices with requirements like "Must get the correct command with 20 milliseconds or the currently assembled box of twinkies will contain extra twinkies.", and a few machines that say "Must receive the correct command with 40 ms.  Failure to receive the correct comand in the correct timeframe will result in destruction of the machine's motor assembly."
    1. The operating system must be hard real time
    2. The operating system can be soft real time

  2. The Twinky Assembly Machine (TAM) assembles boxes of twinkies.  As a twinky falls into the current box, the twinky blocks the path between a laser and a light sensor.  When the light sensor goes from on-off-on, the computer should realize that a twinky has been added to the current box.  Would it be appropriate for the TAM device to use DMA?
    1. Yes
    2. No

  3. Many devices are connected to the Twinky mainframe.  These devices generate interrupts to do I/O.  Our mainframe requires that every interrupt be given a priority number, such that higher numbered inturrupts get acted on first.  Luckily, the TwinkyOS designers have checked things out, and it is possible to handle all inturrupts in the worst case, if they are handled in the right order.  Which device should have the highest priority inturrupt?
    1. Most important inturrupt
    2. Device that needs the answer most quickly
    3. Device that does the most byes/second of data

  4. (3 points) The Twinky Box Sealing Machine (TBSM) is a very old machine.  It does not use interrupts to tell the mainframe when the box has been sealed, and a new box may be sent.  Instead, there is a memory location that has the value "1" when the machine is ready for a new box, and "0" when the machine is busy.  TwinkyOS checks the memory location periodically, and sends a box when the value is "1".
    This is not called inturrupt driven IO.  It's normally called ____________________________________________
    List an advanatge of this technique over interrupt-driven I/O

    List a disadvantage of this technique over interrupt-driven I/O
  5. TwinkyOS is used on to run the Twinky.com web site.  The computer Twinky.com is attached to the Internet by an FDDI laser ring at 100 megaBYTES/second.  The average packet size is 1000 bytes.  How many inturrupts per second must this machine take?


  6. TwinkyOS uses a normal one-level paging scheme, with 32 bit addresses and 4K pages.  If a process requests 17K of RAM, how many entries in it's page table?
    1. 4
    2. 5
    3. (2 ^ 32) / (4 * 1024)
    4. 2 ^ 32

  7. What does it mean if the dirty bit is set.  (Circle all that apply)
    1. The page is not in RAM
    2. The Twinky is to be rejected
    3. The process does not have permission to write to that page
    4. The page should be swapped out when you need to find free space.
    5. None of these silly answers

  8. TwinkyOS wants to use virtual memory and swap space so that it can run programs that seem to use more memory that the mainframe really has.  The designers seem to have two choices on where to store their paged-out ram.

    They can store it on the hard drive.  The hard drive can answer any request in 10 ms, and has a bandwidth of 40 megabytes/second.

    The Ethernet-Based-Storage-Device can answer any request in 1 ms, and has a bandwidth of 10 megabyes/second.

    The page size is 4K.  Which device can answer requests faster?  (BTW, these are semi-realistic numbers)

  9. A page must be pushed out to swapspace so that a new page can be brought in.  How should TwinkyOS decide which page to swap out?  (You must pick one.  Pick the one that will perform the best among the choices given.)
    1. Keep a list of pages in the order they have been accessed by the CPU.  Toss the page at the end of the list (the oldest end).
    2. Pick any page from the currently requesting process
    3. Choose randomly

  10. Suppose a normal process using TwinkyOS runs the following code.  Remember that TwinkyOS uses a one-level page table.  Is the address a virtual or physical address?
  11. setToTwelve() {
       char *wrapper = 0123456;
       *wrapper = 12;
    }
  12. Suppose a DMA transfer is set up from a device in TwinkyOS to some ram held by a process.  The process will be put to sleep until the transfer finishes.  Is it OK to swap out the ram while waiting for the inturrupt signalling the device is finished?
    1. Yes
    2. No
  13. Twinkies.com is a web site running TwinkyOS.  The goal of the designers of TwinkyOS is to ensure that as many web requests get answered per seond.   Which scheduling algorithm would be best?
    1. Round robin without aging
    2. First Come First Serve with Aging
    3. Shortest Job Next with premption
    4. A Priority scheme where the priorities are set by username
  14. Using the Twinkes.com mainframe, the hard drive can answer any querry in 10 ms.  TwinkyOS uses EXT2.  How many milliseconds would it take to do a 'DIR /'?  Assume that the 'dir' executable, the partition table and the superblock is cached, but nothing else.  The root dir itself can fit onto one block.

  15. Using the Twinkes.com mainframe, the hard drive can answer any querry in 10 ms.  TwinkyOS uses VFAT.  How many milliseconds would it take to do a 'DIR \'?  Assume that the 'dir' executable and the partition table is cached, but nothing else.  The root dir itself can fit onto one block.

  16. The Twinkies.com mainframe has a RAID array.  The goal is to set up this RAID array to handle any one disk failure without loss of data.  It is important that the RAID array be very fast at small reads, but no one cares about write speed at all (It's a web server, after all).  We have 40M to store, 6 disks, and they hold 10M each.  Which RAID levels will work?  Circle all that apply.
    1. RAID 0
    2. RAID 1
    3. RAID 4
    4. RAID 5
    5. RAID 6

  17. Twinkies.com uses the EXT2 file system.  We have used every one of the entries in our inode table.  How?  Pick all that apply.
    1. We made too many files
    2. We made several large files
    3. We filled with disk with one huge file
    4. We deleted and rewrote too many files
    5. One can never run out of inodes.

  18. My filesystem has 1000 files.  Files come in all sizes, and the average file is 23,000 bytes.   My allocation unit is 4K (i.e. the VFAT cluster is 4K, or the EXT2 blocksize is 4K.)  How big should my disk be?







  19. I've improved EXT2.  The new filesystem, TwinkyFS, is just like EXT2 except that instead of 13 direct blocks, one indirect block, and 1 doubly indirect block, I have 1 direct block, 1 indirect block, and 1 doubley indirect block.  My filesystem holds web pages, gifs, and MP3s.  It does not hold multi-gigabye databases.  In what way will the performance of TwinkyFS differ from EXT2?






  20. I have a file cache of 10M.  I have a 12M file, that I access repeatidly in seuential order.  I use LRU.  How much will my cache help?
    1. 10 / 12 of all blocks needed will be in the cache
    2. 2 / 12 of all blocks needed will be in the cache
    3. 2 / 10 blocks needed will be in the cache
    4. The cache is worhtless in this situation

  21. Comparing VFAT and EXT2, which would do better when accessing a file in REVERSE order.  Assume no cache.


  22. Using TwinkyFS, I notice that it takes on average 10 disk blocks to answer every read.  Each disk read takes 10 ms.  Luckily, my disk cache can answer 1/2 of all the block requests I make.  How long does it  take to answer the average read using TwinkyFS?


  23. How long does the average open system call take?
    1. One microsecond
    2. One millisecond
    3. One second

  24. TwinkyOS will use priority scheduling without aging and without premption.  Which process is running at time slice #10?  Low numbers are low priorities. If a process arrives at time 7, it can run at time 7.

  25.                Job          Priority         Arival Time    Length
                   ---------------------------
                     1                10                     1                       5
                     2                 5                      2                       3
                     3                 12                    3                       17
                     4                  6                     4                       8
  26. Oops.  My mistake.  TwinkyOS really uses shortest job next with premption.  WHat job is really running at time 10?