+1 (315) 557-6473 

Reading Virtual/Proc Files Assignment Help

Relieve your assignment stress by getting our reading virtual/proc files assignment help. Our Linux homework tutors are knowledgeable in this area. You can count on them to curate exceptional solution that will certainly impress your strict examiners. Our reading virtual/proc files homework help service is rated highly by students all across the globe. You too can score your dream grades with the backing of our experts.

Reading Virtual/Proc Files Using C++

The Linux /procfile system is a “pseudo” file system that exists only in kernel memory and is used primarily for querying various kernel and per-process statistics. Although the /proc file system is virtual, you can open and read the virtual files the same way as any other file. So you can start this assignment without the instructor discussing the /procfile system.
You will answer questions about turing by writing a program that reads some virtual files inthe
/proc/sys/kernel/directory,andthefourvirtualfiles:/proc/cpuinfo,/proc/uptime,
/proc/stat, and/proc/swaps.

Using C++ Stringclass in the Program

Review the C++ stringclass and use it in this program. Use member functions of the string class to process strings. For example, to search for a substring in a string, you can use the stringmember function find().
In /proc/cpuinfo, the majority of the input fields repeat for each processor. Processor numbers need not be contiguous, so you need to count the number of processors. Each processor block in the /proc/cpuinfo corresponds to a CPU core. A physical chip can have multiple cores. A host such as turing.cs or hopper.cs can have several physical multi-corechips.
To get the number of physical multi-core chips, you must keep track of the number of “physicalid”s.
Look at the “cpu cores” field to get the number of cores for each physical multi-corechip.
You may only read each file once and you do not know which order the keywords will come in, so you need to read the file, save the fields you need, and then format youroutput.
The file /proc/stat records information about the system since it was started,including: cpu
cpuN
Total CPU time (unit is architecture dependent. 1/100ths of a second for this assignment) spent in user mode, low-priority user mode (nice mode), system mode, idle, and others.
Times for CPU N.
/proc/uptime provides two numbers. Use the manual page for proc to find out what they are.
The file /proc/swaps provides information on swap devices. The units of size and usage are kilobytes.
Command “man proc” is the manual page and can give you more details of the /proc file system.

Program Output

You need to express each output in a numbered complete sentence, e.g.:
A: Questions about turing’s OS:
1. The type of turing’s OS is __ .
B: Questions about turing’s processor:
Turing has __processors.
Turing has __ physical multi-core chips. (if there is only one: 1 physical multi-corechip.)
You can decide the exact sentence as long as you format the answers in a human readable way. Your program output is expected to answer the following questions:
A. Questions about turing’s OS. Read the following files under the directory /proc/sys/kernel/ and format the output in a readable way.
ostype
hostname
osrelease
version
B: Questions about turing’s processors:
How many processors (CPU cores) does turinghave?
How many physical multi-core chips does turinghave?
How long has turing been up inseconds?
Express that time in days, hours, minutes and seconds (e.g., 7 days, 1 hour, 2 minutes, and 4.3seconds)
For processor 0, answer thesequestions:
Who is thevendor?
What is the modelname?
What is its physical addresssize?
What is its virtual addresssize?
For processor 1, answer thesequestions:
How long has it spent time in user mode in seconds (not including low-priority usermode)?
How long has it spent time in system mode inseconds?
How long has it been idle inseconds?
How long has it been idle in days, hours, minutes andseconds?
What is the size of turing’s swap device inMB?

Coding style and documentation standards

Programs must be consistently indented and commented so that a reasonable person can understand them. Use of consistent descriptive variable names is also required.
At a minimum, follow the following rules that you have used in earlier programming courses, including the use of a header box at the top of the program:
http://www.cs.niu.edu/~byrnes/csci240/240doc.htmhttp://www.cs.niu.edu/~mcmahon/CS241/c241man/node6.htmlhttp://www.cs.niu.edu/~mcmahon/CS241/c241man/node7.html
Administration:
Submit the source on Blackboard. We will compile and run them on turing. No credit if your program does not compile on turing.
The compressed file contains your source code and a Makefile. It needs to be named as “your- zid_project1.tar” and must be created following the procedure described below:
Put all your source code files (NO OBJECT or EXECUTABLE FILES) and your Makefile in a directory called “your-zid_project1_dir”. Example: z1234567_project1_dir. Note: ‘z’ must be in lowercase.
In your Makefile, you need to make sure your compilation produces the executable file called “your-zid_project1”. For a student with z1234567 as her zid, the executable would be z1234567_project1.
In addition, in your Makefile, you need to include the pseudo-target cleanto remove object code and executable files. This is to help the TA to clean up their directory since their size quota is limited.Example:
clean:
-rm *.o z1234567_project1
In the parent directory of your-zid_project1_dir, compress this whole subdirectory by the followingcommand:
tar –cvvf your-zid_project1.tar your-zid_project1_dir
Example:
tar–cvvfz1234567_project1.tar z1234567_project1_dir
“your-zid_project1.tar” is now the compressed file containing the whole subdirectory of your files. You can then transfer (e.g. using an ftp client) the tar file from turing (or hopper) to a computer on which you can open a web browser for your final submission to the Blackboard system.
Grading:
When the program is graded, a script runs a sequence of the following commands:
tar –xvf z1234567_project1.tar
cd z1234567_project1_dir make
./z1234567_project1
These procedures should yield a working program. You need to verify by yourself that your compressed tar file can be opened properly. There will be a penalty if programs are incorrectly named or otherwise do not follow directions.
The grading of this assignment will be based on output correctness (40%), programming (40%), coding style and documentation (20%), under the condition that it complies and runs on turing.
For full credit, your program must follow the specs and documentation standards above. In other words, it is possible that you will get deduction even when your program is generating correct results if your coding style is bad. Here are some examples of bad style:
Lack of necessary documentation/comments. Or have incorrectcomments;
Hard to understand variable names or functionnames;
Hard-coded magic numbers without obvious meaning orexplanation;
Inconsistent style of indentation or curly braces to the point of reducing understandability.
If the variable name or function name is self-explanatory, comments can be brief or omitted. Ask yourself – will you still understand your code six months later?