next up previous
Next: Pit CPU-bound vs. CPU-bound Up: Assignment 5: Processor Scheduling Previous: Build a time bomb

Build a looper

1.
Write a second program called cpuloop that runs a mathematically intensive loop for a fixed number of iterations. Make it take the number of iterations as an argument from the command line. Calibrate the program so that you know how many iterations take about 3 seconds of CPU time. It should not print anything inside the loop. This program will be CPU-bound; that is, its run time will be primarily determined by how much CPU time it gets. Other programs might be I/O-bound, meaning that their performance is determined by the performance of one of the I/O systems, and relatively insensitive to the amount of CPU that's available.



Allen B. Downey
3/17/1998