当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 2 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : 新手请高手帮忙回答一下问题,谢谢!!!!!
帖子发表于 : 2010-08-19 17:06 

注册: 2010-08-19 16:44
帖子: 1
送出感谢: 0 次
接收感谢: 0 次
Part A

Method
Use the pseudofiles in the /proc directory to answer the questions in Part A. The answer to many of the questions
will vary based on system state at the time (eg uptime, memory usage, etc.); just report the answers you get from
/proc.
(Hint: you may want to Google linux man proc to find out more about the information available in different proc
files.)

Questions for Part A

1.What is the CPU vendor ID and model name?

2.Which version of the kernel is installed?

3.Which version of the GNU compiler collection (gcc) is running?

4.How long in days, hours, and minutes has it been since the system was last booted? (Hint: you'll have to do some arithmetic.)

5.How much RAM does the computer have (in megabytes)?

6.How much memory (in megabytes) is currently free?

7.How much time have each of the processors been spent executing in user mode? System mode? Idle?

8.How many interrupts have occurred?

9.How many processes have been created since the system was booted?

10.How many read and write operations have been performed on each disk device?


Part B
In Part B, you will be writing a program to answer some of the questions in Part A. Specifically, have your program report the following:

1.CPU vendor ID and model

2. Which version of the kernel is running.

3. Which version of gcc is installed.

4.Amount of time since the system was last booted, in the form dd days, hh hours, mm minutes, and
ss seconds. The twist: if the system has been up for less than 1 day, don't print the days. Likewise for
hours and minutes (though you'd be hard-pressed to run the program less than one minute after starting the system!).
NOTE: here's where we separate the men from the boys! Extra credit will be given if you are able to express the time grammatically.

For example:
3 days, 4 hours, 37 minutes, and 10 seconds.
2 hours, and 10 minutes.
1 day, 59 minutes, and 1 second.
To test this, you'll need to set the days, hours, minutes, and seconds by hand instead of calculating from
uptime.

5. The amount of memory configured into this computer in gigabytes.

6. The amount of memory currently available.


Part C
In part C, you will be modifying your program so it looks up and reports information from the /proc/stat and
/proc/diskstats files, specifically:

1. The amount of time that each CPU has spent in user mode, system mode, and idle.

2. The number of interrupts that have occurred since the system was booted.

3. The number of context switches that the kernel has performed.

4. The number of processes that have been created since the system was booted.

5. The number of disk operations (read and write) that have been performed on each disk device.

Design your program so that it accepts a switch from the command line, eg.
-b runs part B.
-c runs part C.
No arguments runs both parts B and C.
--help will print instructions as specified above.
Remember to check for invalid arguments!


For this you will need to reference the bash command line variables $1, $2, etc.
Hint: $# tells you how many arguments are on the command line.


页首
 用户资料  
 
2 楼 
 文章标题 : Re: 新手请高手帮忙回答一下问题,谢谢!!!!!
帖子发表于 : 2010-08-19 17:43 
头像

注册: 2006-10-25 18:08
帖子: 1582
送出感谢: 0 次
接收感谢: 0 次
作业自己做
引用:
Use the pseudofiles in the /proc directory to answer the questions in Part A. The answer to many of the questions
will vary based on system state at the time (eg uptime, memory usage, etc.); just report the answers you get from
/proc.
(Hint: you may want to Google linux man proc to find out more about the information available in different proc
files.)

终端
man proc
读文档吧


_________________
楼主真是一派胡言,真可谓:“两个黄鹂鸣翠柳,不知所云;一行白鹭上青天,不知所止“。本来不想和你辩论,今天气愤不过,和你理论一番。我国宪法写得清清楚楚:“一夜夫妻百日恩,七楼以上才有电梯”。这个想必你知道,既然知道,你就不能断章取义,就算是天气预报,它还有不准的时候呢!!!再者说了,那中国银行也不是你一家开的。人家马拉多纳都结婚了,你还拿着粮票顶什么用呢。真是滑天下之大稽。前些日子,全国人大刚刚开过会,郑重声明:“中国不搞多party制,存栏母猪给补贴”。多好的事呢,楞让你这号人给搅混了。


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 2 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 1 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译