Question
Write a default version of program to report the behavior of the Linux kernel by inspecting kernel state. The program should print the following values
Write a default version of program to report the behavior of the Linux kernel by inspecting kernel state. The program should print the following values to the user screen or console:
CPU type and model
Kernel version
Amount of time since the system was last booted, in the form dd:hh:mm:ss (for example, 3 days 13 hours 46 minutes 32 seconds would be formatted as 03:13:46:32)
report date (gettimeofday) and machine hostname 2.3
Part C Write a second version of the program in Part B that prints the same information as the default version plus the following: The amount of time the CPU has spent in user mode, in system mode, and idle
The number of disk requests made on the system
The number of context switches that the kernel has performed The time when the system was last booted
The number of processes that have been created since the system was booted 2 2.4
Part D
Extend the program again so that it also prints the following: The amount of memory configured into this computer The amount of memory currently available A list of load averages (each averaged over the last minute) This information will allow another program to plot these values against time so that a user can see how the load average varied over some time interval. Allow the user to specify how the load average is sampled. To do this you will need two additional parameters: One to indicate how often the load average should be read from the kernel One to indicate the time interval over which the load average should be read The first version of your program might be called by observer and the second version by observer -s. Then the third version could be called by observer -l 2 60, whereby the load average observation would run for 60 seconds, sampling the kernel table about once every 2 seconds. To observe the load on the system you need to ensure that the computer is doing some work rather than simply running your program. For example, open and close windows, move windows around, and even run some programs in other windows.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started