M7: Process management
Currently your operating system has only been able to run one process,
sosh. In this milestone you will implement the
process related system calls:
process_wait. Obviously each
new process should run it its own address space. This will require you to
carefully manage L4 memory spaces.
process_create need only run executables
contained within the boot image, and need only run these executables
in-place, and only run them successfully once.
You are supplied with a
sos_start_binfo_executables function which
iterates over the threads listed in the image and starts them as new tasks.
It does this with the help of the bootinfo library.
The callback function
bootinfo_new_thread is called for each
thread that the library finds in the image.
sosh has an
exec command. This command provides a simple
interface to the
process_create system call. In a similar
style to UNIX shells, if the third argument to
exec is an
'&' then it will run the process in the background.
Otherwise sosh will use
process_wait to wait until the child
process has finished executing.
To add more executables to the bootimg.bin file you will need to create
newapp = app_env.Package("newapp") in the top-level
SConstruct file. In the
command you can append the new apps to the comma separated list.
Each of these apps will automatically be added
to the boot image.
NOTE: The stime and ctime
fields of the process_t data structure are optional. Unlike
older versions of L4, OKL4 does not maintain these values for you.
As with most milestones, a lot of the design work will be working out
suitable data structures to hold process information. You may also need to
extend other data structures in your operating system to handle multiple
You also probably want to change your
crt so that when a
process's main function exits it will kill itself.
You should show
sosh executing a sub-process and show that
ps command works. As processes will be running in-place
you need only execute each one once.
You may want to add a
kill command to sosh to show that
As always you should be able to explain the data structures and
28 Jul 2008.