FAQ Storage Mangement

What is Virtual memory? Why is it needed?
Virtual Memory is a memory allocation scheme in which secondary memory can be addressed as though it were part of main memory. During execution, large process can store themselves in secondary memory in the form of pages and only the required pages or portions of processes are loaded into the main memory. The memory addresses used by a program in secondary disk is called virtual addresses. The OS maps the virtual address into physical addresses in computer memory.
Advantages – It allows the execution of processes that are not completely in memory. This eliminates the memory-storage limitations. Programs can be larger than physical memory.

State the advantages of virtual memory.
  • It allows the execution of processes that are not completely in memory. This eliminates the memory-storage limitations. Programs can be larger than physical memory. This simplifies the programming task.
  • Because each user program could take less physical memory, more programs could be run at the same time, with a corresponding increase in degree of multiprogramming, CPU utilization and throughput without affecting the response time or turnaround time.
  • Since the complete process does not have to be memory to execute, less I/O would be needed to load or swap user programs into memory, so each user program would run faster, improving the CPU utilization and throughput.

What is meant by demand paging?
What is the advantage of demand paging?
Demand paging is a method of virtual memory management, in which pages are loaded into main memory only when they are accessed and that page is not already in memory (i.e., if a page fault occurs).
Advantages of demand paging:
  • Only loads pages that are demanded by the executing process. Reduces the time required to load a process into memory, so each user process would run faster, improving the CPU utilization and throughput
  • Less loading latency occurs at program startup, as less information is accessed from secondary storage and less information is brought into main memory.
  • Since only required pages are loaded, more space is available in main memory and more processes can be loaded, increasing the degree of multiprogramming.

Define thrashing.
High paging activity is called thrashing. A process is thrashing if it spends more time paging than executing. Thrashing can be eliminated by using
  • Working set strategy
  • Page fault frequency strategy

Is it not possible for a process to have two working sets? One representing data and another representing code? Explain.
Yes, it is possible for a process to have two working sets, one for code and one for data. The code being accessed by a process may retain the same working set for a long period of time. However, the data accesses may change, thus reflecting a change in the working set for data accesses.

What is swapping?
When a process has to be moved into main memory, and sufficient memory is not available, one process is selected and moved from main memory to a backing store creating sufficient memory to move the new process into main memory. When sufficient memory becomes available again the old process is moved back from the backing store into main memory. This is called swapping.


Why we need mapping from logical address space to physical address space?

What is required to support dynamic memory allocation in contiguous memory allocation?

Describe the difference between first-fit, best-fit and worst-fit dynamic storage allocation strategies.

Differentiate next fit and best fit memory allocation.

Differentiate internal fragmentation from external fragmentation.

Define page and page frame.
Paging is a memory-management scheme in which Physical memory is broken into fixed-sized blocks called frames. Logical memory is also broken into blocks of the same size called pages. When a process is to be executed, its pages are loaded into any available memory frames in the physical memory for execution.

What is the purpose of paging the page tables?

What are the advantages of having an inverted page table?

What is TLB? How is it implemented? What is a translation look aside buffer used for?

What is the copy-on-write feature, and under what circumstances is it beneficial? What hardware support is required to implement this feature?

Why is paging used?
Paging is a memory-management scheme that permits the physical-address space of a process to be noncontiguous. Physical memory is broken into fixed-sized blocks called frames. Logical memory is also broken into blocks of the same size called pages. When a process is to be executed, its pages are loaded into any available memory frames

Why are page sizes always power of 2?
The size of a page is typically a power of 2. The selection of a power of 2 as a page size makes the translation of a logical address into a page number and page offset particularly easy. If the size of logical-address space is 2m, and a page size is 2n addressing units (bytes or words), then the high-order m – n bits of a logical address designate the page number, and the n low-order bits designate the page offset. If p is an index into the page table and d is the displacement within the page then the logical address is given as:

What is segmentation?

What is indefinite postponement?
Indefinite postponement is caused when a process is indefinitely denied access to the processor to execute it. This is caused by scheduling algorithms. Example – in Priority scheduling, if a process has a very low priority and many process with high priority keeps on arriving, the low priority process may be indefinitely postponed and never be allotted the processor to execute.

What is meant by Belady’s anomaly?
In First-In-First-Out (FIFO) page replacement algorithm if the number of page faults increases when the number of frames is increased its called Belady’s anomaly. Example. Consider the reference string:
1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5
The number of faults for four frames (ten) is greater than the number of faults for three frames (nine).

Consider the parameter Δ used to define the working-set window in the working-set model. What is the effect of setting Δ to a small value on the page fault frequency and the number of active (non-suspended) processes currently executing in the system? What is the effect when Δ is set to a very high value?
  • When the working-set window Δ is set to a small value, then the number of frames allocated for the process is lesser than required. Though this increases the degree of multiprogramming, it could also result in a large number of page faults.
  • When the working-set window Δ is set to a large value, then the number of frames allocated for the process is more than required. This reduces the degree of multiprogramming. However, once a process starts executing the number of page faults will be low.