Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Release - 3.10.0-862.3.2.el7.x86_64 Version - #1 SMP Mon May 21 23:36:36 UTC 2018 Machine - x86_64 Part B: Use the proc filesystem to provide information

image text in transcribedimage text in transcribed

Release - 3.10.0-862.3.2.el7.x86_64 Version - #1 SMP Mon May 21 23:36:36 UTC 2018 Machine - x86_64 Part B: Use the proc filesystem to provide information about the system. According to proc manual pages, "The proc filesystem is a pseudo-filesystem which provides an interface to kernel data structure." You can review the manual page at: http://man7.org/linux/man-pages/man5/proc.5.html The /proc directory contain files and directories which provide the required information. You will write a Cor C++ program to open appropriate file, read information from the file, extract & format the required data, and display the information with appropriate label. Your program should provide the following information about the system: 1. The time when system was last booted. (File name: /proc/stat). Look for line with the label btime. Time is in seconds since 1970-01-01 (epoch time). Display the time in the format yyyy-mm-dd hh:mm:ss. 2. The amount of time since system was last booted (File name: /proc/uptime). This file contains two numbers: the uptime of the system in seconds and the amount of time spent in idle process in seconds. Display the amount of time since system was last booted in the form dd:hh:mm:ss. 3. Amount of time that the CPU has spent in user mode and system mode. (File name: /proc/stat). Use the line with label cpu. The first number is the time spent in user mode and the third number is the time spent in system mode. 4. The total amount of memory in the system and the amount of memory currently available. (File name: /proc/meminfo). Use the lines with labels MemTotal and MemAvailable. Deliverables 1. Program source codes includes all source program files, Makefile, and Readme files Release - 3.10.0-862.3.2.el7.x86_64 Version - #1 SMP Mon May 21 23:36:36 UTC 2018 Machine - x86_64 Part B: Use the proc filesystem to provide information about the system. According to proc manual pages, "The proc filesystem is a pseudo-filesystem which provides an interface to kernel data structure." You can review the manual page at: http://man7.org/linux/man-pages/man5/proc.5.html The /proc directory contain files and directories which provide the required information. You will write a Cor C++ program to open appropriate file, read information from the file, extract & format the required data, and display the information with appropriate label. Your program should provide the following information about the system: 1. The time when system was last booted. (File name: /proc/stat). Look for line with the label btime. Time is in seconds since 1970-01-01 (epoch time). Display the time in the format yyyy-mm-dd hh:mm:ss. 2. The amount of time since system was last booted (File name: /proc/uptime). This file contains two numbers: the uptime of the system in seconds and the amount of time spent in idle process in seconds. Display the amount of time since system was last booted in the form dd:hh:mm:ss. 3. Amount of time that the CPU has spent in user mode and system mode. (File name: /proc/stat). Use the line with label cpu. The first number is the time spent in user mode and the third number is the time spent in system mode. 4. The total amount of memory in the system and the amount of memory currently available. (File name: /proc/meminfo). Use the lines with labels MemTotal and MemAvailable. Deliverables 1. Program source codes includes all source program files, Makefile, and Readme files

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Master The Art Of Data Storytelling With Visualizations

Authors: Alexander N Donovan

1st Edition

B0CNMD9QRD, 979-8867864248

More Books

Students also viewed these Databases questions