Monday, 24 September 2012

UNIX Interview Questions-5


41. What is Expansion swap?
Ans: At the time when any process requires more memory than it is currently allocated, the Kernel performs Expansion swap. To do this Kernel reserves enough space in the swap device. Then the address translation mapping is adjusted for the new virtual address space but the physical memory is not allocated. At last Kernel swaps the process into the assigned space in the swap device. Later when the Kernel swaps the process into the main memory this assigns memory according to the new address translation mapping.

42. How the Swapper works?
Ans: The swapper is the only process that swaps the processes. The Swapper operates only in the Kernel mode and it does not uses System calls instead it uses internal Kernel functions for swapping. It is the archetype of all kernel process.

43. What are the processes that are not bothered by the swapper? Give Reason.
Ans: Zombie process: They do not take any up physical memory.Processes locked in memories that are updating the region of the process.Kernel swaps only the sleeping processes rather than the ‘ready-to-run’ processes, as they have the higher probability of being scheduled than the Sleeping processes.

44. What are the requirements for a swapper to work?
Ans: The swapper works on the highest scheduling priority. Firstly it will look for any sleeping process, if not found then it will look for the ready-to-run process for swapping. But the major requirement for the swapper to work the ready-to-run process must be core-resident for at least 2 seconds before swapping out. And for swapping in the process must have been resided in the swap device for at least 2 seconds. If the requirement is not satisfied then the swapper will go into the wait state on that event and it is awaken once in a second by the Kernel.

45. What are the criteria for choosing a process for swapping into memory from the swap device?
Ans: The resident time of the processes in the swap device, the priority of the processes and the amount of time the processes had been swapped out.

46. What are the criteria for choosing a process for swapping out of the memory to the swap device?
Ans: The process’s memory resident time,Priority of the process and the nice value.

47. What do you mean by nice value?
Ans: 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.

48. What are conditions on which deadlock can occur while swapping the processes?
Ans: 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.

49. What are conditions for a machine to support Demand Paging?
Ans: Memory architecture must based on Pages, The machine must support the ‘restartable’ instructions.

50. What is ‘the principle of locality’?
Ans: It’s the nature of the processes that they refer only to the small subset of the total data space of the process. i.e. the process frequently calls the same subroutines or executes the loop instructions.

No comments:

Post a Comment