COM310 / Processes

A tiny shell

See it on a timeline

Shell 1000 Child 1001 Child 1002 mysh> date mysh> ls mysh> exit fork() fork() exec("date") exits exec("ls") exits running waiting in wait()

Every command gets its own new child with a new ID. The shell waits while that child runs, then prints the next prompt.

Trace the code

Screen output

You can also use the arrow keys or the space bar.
C code: mini_shell.c