Memory Management


10) My OS uses a normal one-level paging scheme, with 32 bit addresses and 4K pages. If a process uses addresses from 0 to 17,000, how many entries in it's page table?

a. 4

b. 5

c. (2 ^ 32) / (4 * 1024)

d. 2 ^ 32


13) My OS has allocated 1000 memory allocations totaling 4000 pages each of 4K. How much memory is wasted in internal fragmentation? ________ How much memory is wasted in external fragmentation? ________



14) Using segmenting, my OS has allocated 1000 memory allocations totaling 16,000K. How much memory is wasted in internal fragmentation? ________ How much memory is wasted in external fragmentation? ________



20) What is a TLB (Translation Lookaside Buffer) (chose ONE)

21)On a machine with 32 bit addresses and a process that uses all of those addresses and a page table containing 2^20 pages, how large is each page? _______________________



22)One problem with the Least Recently Used page replacement algorithm is ... (choose ONE)




  1. When do two processes share the exact same page table?

Here is a page table.  Each page takes 1024 bytes.  How much ram does this process use?  Count carefully!

Page Number

Valid

Referenced

Protection

5

Y

Y

R/W

2

N

N

R

3

Y

N

R

6

Y

Y

R/W

5

Y

Y

R/W

  1. What's the largest valid address this program can use? __________________________________

  2. Where is address 2345 stored in RAM?  _________________________________



Processes and Threads



Assume that the system is runnning a strict priority scheduler, and the job with the highest priority is currently in an infinite loop.  Choose one

    1. The system is locked up

    2. The system is not locked up

3) Which of the following things are shared by any two threads that came from the same process?
Code File Descriptors Page Table

local variables global variables None of these


4) Beyond the time delay, what does a process notice when it loses the scheduler takes the CPU and then later gives it back?
a) The CPU registers have changed.
b) The stack has changed.
c) The memory for this process has changed.
d) None of these

5) Who does scheduler aging help?
a) Low priority processes
b) High priority processes


15) (T/F) A process waiting for an I/O operation to complete but otherwise ready to run is in the READY queue?


16) Which of the following algorithms is subject to starvation? (choose all that apply).


19) When a process is finished waiting for an I/O to complete, it normally moves to the


Files


Pick any file anywhere ever created. Make one up if you want. List three pieces of "metadata" or "file attributes" about that file.
_______________________________________________________
_______________________________________________________
_______________________________________________________





Which holds more, a six disk RAID 1 or a six disk RAID 5?



Which is faster at reading, a six disk RAID 1 or a six disk RAID 5?


Other



1) Assume we’re talking about a big mainframe. Which of the following instructions should only run in privileged mode (monitor mode)?
a) Change the interrupt table.
b) Disable interrupts.
c) Change the memory map page table.
d) Change the spark plugs.
e) Power down the machine.
f) None of these.


2) Suppose my computer does not have privileged instructions. Instead it has the OS burned into ROM so that it is protected. Can this method work to make a secure operating system?|
a) Yes sir!
b) No ma’am!


14) Which of the following should be done on every system call. (Circle all that apply
i. Transfer control to the kernel.
ii. Check arguments (if any) for validity.
iii. Create/fork a new process to handle the request.
iv. Write console error message.
v. Reboot computer if day-of-week = Sun.



What is the c++ equivalent of Java’s synchronized?



Suppose I have code like this? How many threads are running the doi() method at once?

pthread_create(&thread1, NULL, doi, NULL);
pthread_join(thread1, NULL);

pthread_create(&thread2, NULL, doi, NULL);
pthread_join(thread2, NULL);

pthread_create(&thread3, NULL, doi, NULL);
pthread_join(thread3, NULL);



  1. What generates an interrupt.  List three:
    _____Device gets input

    clock timer goers off

    illegal instruction tries to run