|
本周翘课了,求辅导。
作业1:
Read the man page for the time command for observing various timing measurements on Linux.
Run the timing experiments for the suggested number of test runs and record the results.
Use the Linux sort command. You will need a large datafile. This can be any text document and can be concatenated mutltiple times to produce a large enough file. Note that if the file is too small, you will not get a useful measurement. Also, keep an unsorted copy so you can repeat the tests.
Write your observations regarding the timing experiments:
Include the data with your observations.
Comment on the differences between the types of time measurements supplied by the time command and how you used each one.
作业2: 编程
Write a simple program that exercises various system resources such as memory allocation, CPU usage, and I/O usage. Design a calculation for some expression and run a range of values in the expression in a loop. You will need to make a large number of iterations to make this work so you can time it.
Using the time command under Unix, measure the time required for the program to run. Divide each time by the number of operations that the program reports. Estimate running time based on the number of operations your program will use.
Analyze the code and timing. Compare the three program types (memory allocation bound, CPU bound, and I/O bound) and speculate on why differences may occur. |
|