The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Week 7 Linux Assignment
Â
Write a function that does some work (to put some load on the system) and make a note of the uptime and idletime before and after the call of the function.
Â
Online CS351System Time CalculationObjectives of this Lab:The objective of this assignment is to get used to the system time information in Linux. Youwill do that by writing a small program (in either C, C++ or Java) that will access systemtime information available from the Linux /proc directory.How to proceed with the Program:1.Information in the /proc/uptime is available just as though the file were a regular textfile. You may open the file, read out the data, save or print that data, and then close thefile2.Type the program into an editor and compile the program at the command prompt.3.Compiling and execution is done as in Week 4 Linux project.4.If you do not find a description of some system call by themancommand, then try theWeb search enginegooglefor help (Use a Web browser to accesswww.google.com).Where to look for information in (/proc) directory ?File /proc/uptime has the information for this lab. You can refer to the online manual for moreinformation on proc (man proc). You can type the following in the command linemore /proc/uptimeto find the uptime of the system and the amount of time the system spending in the idleprocesses.Exercise : Write a program in C or C++ or Java to display the following information.1. Time information.In this section you will print out how long the system has been up and how busy it has been.Once you have some baseline numbers printed, you will run a short program that places a loadon the system. You will then take a second set of numbers and calculate the load that yourprogram placed on the system.a.Duration of uptime # get these information from /proc/uptimeb.Duration of idletimeCalculating load average.Write a function that does some work (to put some load on the system) and make a note of theuptime and idletime before and after the call of the function. The following can be usedas sample code for theworkfunction. This program simple runs a math calculation a largenumber of times, just trying to keep the CPU busy. You can include it as a function in youroverall program. Note that because you are using a math function (pow) you will need to
Attachments:
-----------