Operating System Quiz
Operating System Quiz
(Memory Virtualization)
DISCLAIMER: NOT ALL OF THE ANSWERS ARE CORRECT, AND I DO NOT KNOW WHICH ONES ARE
ACCURATE.
1. Which of these memory allocation functions are library calls similar to libc, not system
calls?
2. Which of these variants of malloc() prevents "uninitialized reads" from heap by zeroing
allocated memory before returning?
Answer: calloc()
3. So far, in memory virtualization, which of these assumptions have we not violated yet?
(Remember that we already have started paging after concluding segmentation!)
2nd
4. In software based relocation, the loader is limited as compared to hardware based
relocation because it suffers from the following weakness(es).
5. Jain's fairness index is a mathematical metric used to assess the fairness or equity of
resource allocation. Consider a memory virtualization system that has the requirement to
allocate memory for four processes. Process 1 (64 B), Process 2 (64 B), Process 3 (64
B), Process 4 (64B). What is the fairness in this case?
Answer: 1
ca. 1
6. For a process that is interested in discovering its segments locations (starting
addresses, of course), what would the process be able to see?
Virtual address
Physical Addresses
Virtual Addresses
7. Given that the sequence of code, heap and stack segments follows the typical ordering
in memory, for the following locations provided:
location of stack : 0x7fff691aea64
location of heap : 0x1096008c0
location of code : 0x1095afe50
Identify the correct option that can be used to determine size of code segment.
Answer: location of heap – location of code
9. Determine the physical address for the virtual address of 4096B in the physical location
of heap segment at 34 kBs, if the virtual base address of heap is at 4096B.
Address Translation:
Physical address = Physical base address + (Virtual address – Virtual base address)
= 34816B + (4096B – 4096B)
= 34816B
10. Using segment registers, perform the address translation using virtual address of 4096B
in the physical location of heap segment at 34 kBs, if the virtual base address of heap is
at 4096B.
Use the following values:
SEG MASK: 0x3000
SEG SHIFT: 12
OFFSET MASK: 0xFFF
13. Referring to the question regarding address translation in stack segment, look at the
question carefully and identify one anomaly in there.
Answer: Likely incorrect offset calculation or misinterpretation of address bits.
Concept: Bounds checking and correct offset calculation are critical in address translation.
14. We know how allocated memory in heap can be used with free(). What problem do you
see if you do not use it for a short lived program and expect OS to do something upon
exit()?
Concept: The OS reclaims all memory used by a process upon termination, though not freeing it
can cause leaks during execution
15. In a time sharing system, if each process is given full access to all memory at runtime,
following problems could arise:
16. As we know that one major goal of virtualizing memory is achieving transparency.
Whom is it for?
Process