Operating Systems -- A Themeless Test

  1. How does a real time operating system differ from a normal operating system?

  2. _______________________________________________________________
  3. Should adjusting the memory map be a privliged instruction? ______________
  4. The airplane of my dreams has a computer navigation system.  I ask that 99.5% of the time the display update every 1/2 second.
    1. This is a hard real time requirement
    2. This is a soft real time requirement.
    3. Get off the airplane fixation.
  5. How come modems don't use DMA, and network cards do?



  6. Which type of schedule makes sense for a computer that going to interact with users (like a Windows or a Mac machine) (circle all that apply)

  7. a) Priority Scheduling
    b) Shortest Job Next
    c) Round Robin
    d) First Come First Serve
  8. Which type of scheduler can lock up a computer if a process goes into an infinite loop (circle all that apply)

  9. a) First Come First Serve
    b) Priority
    c) Round Robin
    d) Shortest Job Next
  10. Is there a deadlock?

  11. A holds 2 and wants 1
    B holds 4
    C holds 3 and 5 but wants 4
    D holds 1 but wants 2
    F wants 1
  12. A process is put on a wait queue for over 20 minutes.  The computer is busy with CPU intensive jobs, but no disk I/O and no memory allocation occurs.  How likely is it that this sleeping process get swapped or paged to disk?
    1. Very.  It would be freakish under these circumstances for the process to stay in RAM.
    2. Medium, 50%-ish
    3. It stays in RAM.
  13. My computer has no MMU, but I want processes to share code segments when possible.  Data between processes should remain private.  Can this be done, and if so how?




  14. List a sysytem call that will put your process onto a wait queue. _______________
  15. What will this program do on a round robin scheduled machine?
    main() {
          while (1) {
               int pid = fork();
               if (pid != 0) { exit(0); }
          }
    }


  16. The CPU has a 20 bit addresses, a 20 bit address bus, and 16M of RAM.   There are 1024 page table entries.  How big is each page? (Hint:  2^20 = 1024 * 1024.  16M = 16 * 1024 * 1024)




  17. Assume 1000 bytes pages.  Where is address 3168 for this process? ____________________

  18.  
    Physical Page
    1
    2
    1
    5
  19. Consider the following segment of C++ code.  Is the address reference to 1000 a virtual address, or a physical address?

  20. main() {
           char *a = 1000;
           *a = 12;
    }
  21. Using non-premeptive Shortest Job Next, when does job 3 finish?

  22.  
    Process Arrival Time Length
    1 1 7
    2 2 5
    3 3 1
  23. Given the data above. and assuming the first time slice is time slice #1, what process runs in each of the first 6 time slices?
    #1 ______ #2 _______ #3 _______ #4 ______ #5 _______ #6 _______
  24. (Safe/Deadlock-able)Suppose that processes are allowed to hold resources.  However, if a lower numbered process wants a resource held by a higher numbered process, the higher numbered process is killed, and the lower numbered process gains the resource.  Is this GUARENTEED to be deadlock free?
  25. Consider a process with multiple threads. Put a 'P' next to those things that all threads in the process share. Put a 'T' next to those things that are not shared.

  26.          1.Stack.
             2.Address space.
             3.Program counter.
             4.Code segment.
             5.Set of registers.
  27. (2 points) Consider the memory map below.  A request is made for 122K of RAM.  Where does each placement strategy allocate these 122K?

  28.       Worst Fit_________________  Best Fit ______________________ First Fit ______________
     
    135 Free 73K Used 150K Used 127 Free 141K Used 100 K Used 200K Free
  29. Which schedulers are starvation free? (circle all that apply)

  30. a) First Come First Serve  b) Round Robin    c) Shortest Job Next     d) Priority
  31. (T/F) A process waiting for an I/O operation to complete but otherwise ready to run is in a WAIT queue?
  32. I allocate 100 pages, each of which is 4K.  What's my waste do to internal fragmentation. _____________
  33. Suppose I have an array 100 elements long, where each entry takes 1K bytes. I access the array sequentially, over and over again.  I access 1,2,3 ... 97, 98, 99, 100, 1, 2,3, ... 98, 99, 100, etc.  I have only 50K of RAM.  Using LRU, what will happen.
    1. Every access will generate a page fault
    2. 50% of all accesses will generate a page fault.
    3. Only the first 50 access will generate a page fault.
    4. Only the last 50 access will generate a page fault.
    5. No access will generate a page fault.
  34. I'm a process.  I allocate 1000K of RAM, and access all 1000K, but eventually fall into a loop accessing only 50K scattered throughout the program.  Assuming the system has lots of other processes and activities ...
    1. I end up with 0K in RAM and 1000K on disk.
    2. I end up with 50K in RAM and 950K on disk.
    3. I end up with 950K in RAM and 50K on disk.
    4. I end up with 1000K in RAM and 0K on disk.
  35. (Yes/No) A process forks into two processes on an operating system using copy-on-write.  The parent then changes a variable.  The code below shows this.  Can this change my memory map?
    main() {
         int a = 1;
         int pid = fork();  # the fork
         if (pid > 0) {
                 a = 0;   # Change the variable
          }
    }
  36. Some schedulers divide processes into two categories.  Category one processes offer a large time quantum but are scheduled infrequently.  Category two processes have a small time slice and are scheduled frequently.  In either case the total amount of CPU cycles offered per unit time is the same.  Which category would be best for long computation intensive tasks and why?