Main Memory

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Main Memory

1. Absolute code can be generated for ____.

A)
B)
C)
D)

compile-time binding
load-time binding
execution-time binding
interrupt binding

Ans: A
Feedback: 8.1.2
Difficulty: Easy
2. _____ is the method of binding instructions and data to memory performed by most

general-purpose operating systems.


A) Interrupt binding
B) Compile time binding
C) Execution time binding
D) Load-time binding
Ans: C
Feedback: 8.1.2
Difficulty: Medium
3. Suppose a program is operating with execution-time binding and the physical address

generated is 300. The relocation register is set to 100. What is the corresponding
logical address?
A) 199
B) 201
C) 200
D) 300
Ans: C
Feedback: 8.1.3
Difficulty: Easy

4. The mapping of a logical address to a physical address is done in hardware by the

________.
A) memory-management-unit (MMU)
B) memory address register
C) relocation register
D) dynamic loading register
Ans: A
Feedback: 8.1.3
Difficulty: Medium
5. In a dynamically linked library, ____.

A)
B)
C)
D)

loading is postponed until execution time


system language libraries are treated like any other object module
more disk space is used than in a statically linked library
a stub is included in the image for each library-routine reference

Ans: D
Feedback: 8.1.5
Difficulty: Medium
6. _____ is the dynamic storage-allocation algorithm which results in the smallest

leftover hole in memory.


A) First fit
B) Best fit
C) Worst fit
D) None of the above
Ans: B
Feedback: 8.3.2
Difficulty: Easy
7. _____ is the dynamic storage-allocation algorithm which results in the largest leftover

hole in memory.
A) First fit
B) Best fit
C) Worst fit
D) None of the above
Ans: C
Feedback: 8.3.2
Difficulty: Easy

8. A(n) ____ page table has one page entry for each real page (or frame) of memory.

A)
B)
C)
D)

inverted
clustered
forward-mapped
virtual

Ans: A
Feedback: 8.6.3
Difficulty: Easy
9. Assume the value of the base and limit registers are 1200 and 350 respectively. Which

of the following addresses is legal?


A) 355
B) 1200
C) 1551
D) all of the above
Ans: B
Feedback: 8.1.1
Difficulty: Easy
10. Which of the following statements are true with respect to hashed page tables?

A) They only work for sparse address spaces.


B) The virtual address is used to hash into the hash table.
C) A common approach for handling address spaces larger than 32 bits.
D) Hash table collisions do not occur because of the importance of paging.
Ans: C
Feedback: 8.6.2
Difficulty: Medium
11. Which of the following is not a reason explaining why mobile devices generally do

not support swapping?


A) Limited space constraints of flash memory.
B) Small size of mobile applications do not require use of swap space.
C) Limited number of writes of flash memory.
D) Poor throughput between main memory and flash memory.
Ans: B
Feedback: 8.2.2
Difficulty: Difficult

Questions
12. What is the advantage of using dynamic loading?

Ans: With dynamic loading a program does not have to be stored, in its entirety, in main
memory. This allows the system to obtain better memory-space utilization. This also allows

unused routines to stay out of main memory so that memory can be used more effectively.
For example, code used to handle an obscure error would not always use up main memory.
Feedback: 8.1.4
Difficulty: Medium
13. When does external fragmentation occur?

Ans: As processes are loaded and removed from memory, the free memory space is broken
into little pieces. External fragmentation exists when there is enough total memory space to
satisfy a request, but the available spaces are not contiguous; storage is fragmented into a
large number of small holes. Both the first-fit and best-fit strategies for memory allocation
suffer from external fragmentation.
Feedback: 8.3.3
Difficulty: Medium
14. Distinguish between internal and external fragmentation.

Ans: Fragmentation occurs when memory is allocated and returned to the system. As this
occurs, free memory is broken up into small chunks, often too small to be useful. External
fragmentation occurs when there is sufficient total free memory to satisfy a memory request,
yet the memory is not contiguous, so it cannot be assigned. Some contiguous allocation
schemes may assign a process more memory than it actually requested (i.e. they may assign
memory in fixed-block sizes). Internal fragmentation occurs when a process is assigned more
memory than it has requested and the wasted memory fragment is internal to a process.
Feedback: 8.3.3
Difficulty: Medium
15. Explain the basic method for implementing paging.

Ans: Physical memory is broken up into fixed-sized blocks called frames while logical
memory is broken up into equal-sized blocks called pages. Whenever the CPU generates a
logical address, the page number and offset into that page is used, in conjunction with a page
table, to map the request to a location in physical memory.
Feedback: 8.5
Difficulty: Medium
16. Describe how a transaction look-aside buffer (TLB) assists in the translation of a

logical address to a physical address.


Ans: Typically, large page tables are stored in main memory, and a page-table base register
points are saved to the page table. Therefore, two memory accesses are needed to access a
byte (one for the page-table entry, one for the byte), causing memory access to be slowed by
a factor of 2. The standard solution to this problem is to use a TLB, a special, small fastlookup hardware cache. The TLB is associative, high speed memory. Each entry consists of
a key and value. An item is compared with all keys simultaneously, and if the item is found,
the corresponding value is returned.
Feedback: 8.5.2
Difficulty: Medium

17. How are illegal page addresses recognized and trapped by the operating system?

Ans: Illegal addresses are trapped by the use of a valid-invalid bit, which is generally
attached to each entry in the page table. When this bit is set to "valid," the associated page is
in the process's logical address space and is thus a legal (or valid) page. When the bit is set to
"invalid," the page is not in the process's logical address space. The operating system sets this
bit for each page to allow or disallow access to the page.
Feedback: 8.5.3
Difficulty: Medium
18. How is a limit register used for protecting main memory?

Ans: When the CPU is executing a process, it generates a logical memory address that is
added to a relocation register in order to arrive at the physical memory address actually used
by main memory. A limit register holds the maximum logical address that the CPU should be
able to access. If any logical address is greater than or equal to the value in the limit register,
then the logical address is a dangerous address and an error results.
Feedback: 8.1.1
Difficulty: Medium
19. Explain why mobile operating systems generally do not support paging.

Ans: Mobile operating systems typically do not support swapping because file systems are
typically employed using flash memory instead of magnetic hard disks. Flash memory is
typically limited in size as well as having poor throughput between flash and main memory.
Additionally, flash memory can only tolerate a limited number of writes before it becomes
less reliable.
Feedback:
Difficulty: Medium
B) Memory-mapping
C) Demand paging
D) Swapping
Ans: A
Feedback: 9.6
Difficulty: Easy
20. The _____ is an approximation of a program's locality.

A) locality model
B) working set
C) page fault frequency
D) page replacement algorithm
Ans: B
Feedback: 9.6.2
Difficulty: Medium
21. Systems in which memory access times vary significantly are known as __________.

A) memory-mapped I/O

B) demand-paged memory
C) non-uniform memory access
D) copy-on-write memory
22. Explain how copy-on-write operates.

Ans: Copy-on-write (COW) initially allows a parent and child process to share the same
pages. As long as either process is only readingand not modifyingthe shared pages, both
processes can share the same pages, thus increasing system efficiency. However, as soon as
either process modifies a shared page, a copy of that shared page is created, thus providing
each process with its own private page. For example, assume an integer X whose value is 5 is
in a shared page marked as COW. The parent process then proceeds to modify X, changing its
value to 10. Since this page is marked as COW, a copy of the page is created for the parent
process, which changes the value of X to 10. The value of X remains at 5 for the child
process.
Feedback: 9.3
Difficulty: Medium
23. Explain the distinction between global allocation versus local allocation.

Ans: When a process incurs a page fault, it must be allocated a new frame for bringing the
faulting page into memory. The two general strategies for allocating a new frame are global
and local allocation policies. In a global allocation scheme, a frame is allocated from any
process in the system. Thus, if process A incurs a page fault, it may be allocated a page from
process B. The page that is selected from process B may be based upon any of the page
replacement algorithms such as LRU. Alternatively, a local allocation policy dictates that
when a process incurs a page fault, it must select one of its own pages for replacement when
allocating a new page.
Feedback: 9.5.3
Difficulty: Medium
24. Discuss two strategies for increasing TLB reach.

Ans: TLB reach refers to the amount of memory accessible from the TLB and is the page size
multiplied by the number of entries in the TLB. Two possible approaches for increasing TLB
reach are (1) increasing the number of entries in the TLB, and (2) increasing the page size.
Increasing the number of entries in the TLB is a costly strategy as the TLB consists of
associative memory, which is both costly and power hungry. For example, by doubling the
number of entries in the TLB, the TLB reach is doubled. However, increasing the page size
(or providing multiple page sizes) allows system designers to maintain the size of the TLB,
and yet significantly increase the TLB reach. For this reason, recent trends have moved
towards increasing page sizes for increasing TLB reach.
Feedback: 9.9.3
Difficulty: Medium
25. What is the benefit of using sparse addresses in virtual memory?

Ans: Virtual address spaces that include holes between the heap and stack are known as

sparse address spaces. Using a sparse address space is beneficial because the holes can be
filled as the stack or heap segments grow, or when we wish to dynamically link libraries (or
possibly other shared objects) during program execution.
Feedback: 9.1
Difficulty: Medium
26. Explain the usefulness of a modify bit.

Ans: A modify bit is associated with each page frame. If a frame is modified (i.e. written), the
modify bit is then set. The modify bit is useful when a page is selected for replacement. If the
bit is not set (the page was not modified), the page does not need to be written to disk. If the
modify bit is set, the page needs to be written to disk when selected for replacement.
Feedback: 9.4.1
Difficulty: Medium
True/False
27. In general, virtual memory decreases the degree of multiprogramming in a system.

Ans: False
Feedback: 9.1
Difficulty: Easy
28. If the page-fault rate is too high, the process may have too many frames.

Ans: False
Feedback: 9.6
Difficulty: Medium
29. On a system with demand-paging, a process will experience a high page fault rate

when the process begins execution.


Ans: True
Feedback: 9.2
Difficulty: Easy
30. Only a fraction of a process's working set needs to be stored in the TLB.

Ans: False
Feedback: 9.9.3
Difficulty: Medium
31. A page fault must be preceded by a TLB miss.

Ans: True
Feedback: 9.2.1
Difficulty: Medium
32. Non-uniform memory access has little effect on the performance of a virtual memory

system.
Ans: False
Feedback: 9.5.4
Difficulty: Medium

You might also like