Hey guys,
Could you help me with this particular program, say, named wsh (wimpy shell) that reads commands from standard input, executing them one at a time. After starting the process to run a command, wsh waits for the process to complete before processing the next command. For example, the input:
% vi fork.c
% make
% wsh
would invoke the vi editor on the file fork.c, run make after vi completes,
and finally invoke wsh itself.
After executing a command, wsh should display statistics that show some of
the system resources the command used. In particular, wsh should print:
1. The amount of CPU time used (user, system, and total time).
2. The number of times the process was preempted involuntarily.
3. The number of times the process voluntarily gave up the CPU.
The following system calls might be useful:
fork - create a new process
getrusage - get information about resource utilization
execvp - execute a binary file
wait - wait for a process (or processes) to terminate