% oos 10 oos% date oos% ls -l oos% a.out 1 2 3 & oos% foo bar ^C oos% ^D %
The following are the highlights of the session.
limit.
No process created in this shell
should take more than limit seconds. If any process takes more
time, the shell kills it.
PATH.
^C kills the current command, but not the
shell. The way to exit the shell is by typing ^D or
exit. If the user exits the shell, the shell should kill all
the background processes it had created.
30*limit seconds, the shell
exits on its own. The shell kills all the background processes it had created
before exiting.
<, >) and
pipes (|). But you should discuss them in your report.
fork: creates a new process.
exec: executes a new program. You can use any of the
exec system calls.
wait: wait for a child process to complete.
alarm
as a timer to time the execution of a
process and terminate it if required.
Hello world. You can create many,
say 100 or 1000, processes to to this. You can also create 100 or 1000 threads to do the same
job. You can now compare the execution times of these two approaches. You
can use the command time to measure execution time. You should
use POSIX threads.
Makefile
to compile them in a tar file called shell.tar. The
Makefile should create the executables
oos for the shell
mthread which creates and runs multiple threads
mprocess which creates and runs multiple processes
bundleP1 on ieng9 to submit the tar file. The
code should be submitted before 11:59 PM on Apr 21. Make sure you run
"prep cs120s" before running bundleP1. This sets up the correct path so
you can find the bundleP1 program.
tcsh? In
particular, how can indirection, pipes, and environment variables be handled?
(You can look at the documentation of tcsh.
You can use the command man tcsh to get the manual pages.)
You should do this project in groups of size 3 (exactly 3). No other form of collaboration is permitted. In particular, you cannot use the code developed by others.
man threads. If
you're not successful, try apropos threads. (If you want
to know what apropos is, try man apropos.
Sample code: This program creates processes. You should run this program before working on the project.
POSIX threads tutorial: Only the section "Thread creation and destruction"
is directly relevant to this assignment. You can use the code in this
section as part of your programs.
While compiling this code, use the " -lpthread"
option.
You should attend the discussion section for more information on this project.
ps command to list the processes.
If your login id is student, you can list your processes
by ps -U student. You can kill the unwanted processes (one
by one) using
kill -9 <PID> where PID is the process id of
the unwanted process.