How can you monitor page faults for individual processes in Linux? Describe how you can use the `time`, `top`, and `ps` commands to view page faults. Provide an example command for each.
The page faults can be checked using commands such as time, top and ps. For time, we need to use the system version of it i.e. /usr/bin/time rather than the shell builtin. time can be used as : /usr/bin/time ps , after the ps command runs, we get the output as:
ps -o pid,min_flt,maj_flt 1 , here 1 is the id of the init process. and the output we get is :-
PID MINFL MAJFL 1 30521 174
where MINFL and MAJFL are minor and major page faults respectively,
for top, we need to select nMaj and nMin are after running top, this is done by pressing f, and then top command displays both nMaj and nMin which are the total no of minor and major page faults till now. This is what would be the output with top: