Unformatted text preview:

1 PurposeThe purp ose of this assignment is to learn some details about how the Linuxkernel stores information about its running state. Since we don’t know anythingabout the kernel organization at this point, we will use the /proc file system toprovide this information.2 ExercisesThis assignment will be broken down into four parts. The first part will beto produce information about a Linux system manually. The remaining threeparts will be to write a program that does this for you.2.1 Info by handFrom a machine that is running the 2.6 kernel, use the /proc file system todetermine answers to the following questions. With the answers, include thelocation (file and line) that provided the information for your answer.1. CPU model number and name, and family2. Exact Linux version3. How long (in seconds and converted to days, hours, and minutes) has themachine been running since it was last rebooted?4. How much time (in USER HZ) has the CPU spent in user mode? usermode with low priority? system mode? idle task?5. What are the load averages over the last 1 minute? 5 minutes? 15 minutes?6. How much RAM doe s the OS belive the hardware has? swap space?7. How much RAM is available for use? swap space?8. How many disk reads have been issued? writes?9. How much time (in milliseconds) has been spent reading? writing?10. How many context switches has the kernel performed?11. How many processes has the kernel created since boot?12. How many processes are currently available to run?12.2 Standard outputWrite a simple program that outputs the following information when it is run.You should get the information from the same location as you did in the previoussection.1. CPU model number and name, and family2. Exact Linux version3. How long (converted to days, hours, and minutes) has the machine beenrunning since it was last rebooted?2.3 StatsModify the program from the previous section. Normally it should output thesame information, but if the command line option -s is passed to it; then itshould add the following information. Again, you should get the informationfrom the same location as you did in the first section.1. How many disk reads have been issued? writes?2. How much time (in milliseconds) has been spent reading? writing?3. How many context switches has the kernel performed?4. How many processes has the kernel created since boot?5. How many processes are currently available to run?2.4 Load statsModify the program from the previous section. It should output the sameinformation unless the command line option -l is passed to it. The -l optiontakes two additional parameters. The first is a sampling interval (s) and thesecond is a total time interval (t). Starting at time 0, the program should outputthe following information. After e very s seconds, the program s hould outputthe new values for the same information. This should rep e at until time t.1. What are the load averages over the last 1 minute? 5 minutes? 15 minutes?2. How much RAM doe s the OS belive the hardware has? swap space?3. How much RAM is available for use? swap space?23 Helpful hintsThe /proc filesystem has a ton of files. Most of the files in the top directoryare readable by anyone. Each process has a subdirectory that contains specificinformation to that process (hence the name of the filesystem). You should beable to find all the information you need for this assignment in those top-levelfiles.The filesystem is heavily documented (like much of the Linux kernel) in theform of man pages. The man page you’re interested in is man proc. If you wantmore information about man pages, you can look at the man man page.4 ConstraintsThere are some programs that interpret the /proc filesystem for you (e.g.,procinfo). Don’t use them. The point of this assignment is to learn aboutthe filesystem on your own.You may use any language available to you on the CSS network. If youhave time, I would suggest trying C since you might like to get practice using itbefore the next assignment which must be done in C. Otherwise, languages likePerl that work well with manipulating text files will probably get the job donemost quickly.I will test the program on my machine running the 2.6.14 or 2.6.15 kernel. Itmight be good to test if you program works on multiple computers with differentsetups so that you are sure it will work on


View Full Document

TAYLOR COS 421 - Lecture Notes

Download Lecture Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?