Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

Implement a new system call: int sys_pgfltstats(pid_t pid, int flag, pf_info_struct *info) The pf_info_struct should contain fields for: total number...

Implement a new system call:int sys_pgfltstats(pid_t pid, int flag, pf_info_struct *info)The pf_info_struct should contain fields for:1. total number of minor page faults2. total number of major page faults3. number of processes included in these counts If pid is:* -1: then return total count statistics for all processes in the system.* positive then look at the flag field and do the following:1. flag is PGFLTSTAT_PROC: then return count statistics for the single process with the matching pid2. flag is PGFLTSTAT_OWNER: then return the total count statistics for all process in the system with the same owner as the specified pid. You can use fields in task_struct for obtaining these, or you could use (or add) values to the fault handling part of the kernel for obtaining them. Make sure to check for error conditions and return appropriate error values as in the previous assignments. Remember that header file contents (prototypes and definitions) that should only be visible inside the kernel (not at user level) should be inside #ifdef __KERNEL, and #endif preprocessor directives.You can grab my starting point code for lab2 to use as a starting point for your system call implementation (~newhall/public/cs45/lab2/).You can use vmstat, and /proc/pid/ files to help you determine if your system call is implemented correctly (look at vmstat and proc (man 5 proc) man pages for more info).Kernel code you may want to read:* page fault handling routines in do_page_fault() in arch/i386/mm/fault.c and mm/memory.c* page replacement code in vmscan.c, which begins with try_to_free_pages.

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question