15. What are the criteria for choosing a process for swapping out of the memory to the swap device?
- The process's memory resident time,
- Priority of the process and
- The nice value.
16. What do you mean by nice value?
Nice value is the value that controls {increments or decrements} the priority of the process. This value that is returned by the nice() system call. The equation for using nice value is:
Priority = ("recent CPU usage"/constant) + (base- priority) + (nice value)
Only the administrator can supply the nice value. The nice() system call works for the running process only. Nice value of one process cannot affect the nice value of the other process.
17. What is a Region?
A Region is a continuous area of a process's address space (such as text, data and stack). The kernel in a "Region Table" that is local to the process maintains region. Regions are sharable among the process.
18. What are the events done by the Kernel after a process is being swapped out from the main memory?
When Kernel swaps the process out of the primary memory, it performs the following:
- Kernel decrements the Reference Count of each region of the process. If the reference count becomes zero, swaps the region out of the main memory,
- Kernel allocates the space for the swapping process in the swap device,
- Kernel locks the other swapping process while the current swapping operation is going on,
- The Kernel saves the swap address of the region in the region table.
19. What are conditions on which deadlock can occur while swapping the processes?
- All processes in the main memory are asleep.
- All "ready-to-run" processes are swapped out.
- There is no space in the swap device for the new incoming process that are swapped out of the main memory.
- There is no space in the main memory for the new incoming process.
20. What are conditions for a machine to support Demand Paging?
- Memory architecture must based on Pages,
- The machine must support the 'restartable' instructions.
Unix Memory Management question and answer for interview