[CSE]  Advanced Operating Systems 
COMP9242 2012/S2 
CRICOS Provider
Number: 00098G

PRINTER Printer-Friendly Version

M7: Process management

Currently your operating system has only been able to run one process, probably sosh. In this milestone you will implement the process related system calls: process_create, process_delete, my_id, process_status and process_wait. Obviously each new process should run in its own address space. This will require you to carefully manage seL4 address spaces.

Currently process_create need only run executables that have been concatenated by the dite program and placed in the boot image. All the functionality for process creation can be found in the start_first_process() in main.c. You can use this as a guide to create a clean internal SOS interface to process creation and destruction.

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.

Note: the difficult part of this milestone is not process creation, it is process deletion. Now you will discover whether the data structures you have chosen have kept enough information for you to clean up a process and return the resource to the various allocators.

Adding new applications

  • Pick a name for your new application that is <= 16 characters long. The dite loading library will truncate any names longer than this.
  • Create the following folder structure for your new app:
  • Copy and appropriately modify the crt0.S from sosh or tty_test.
  • Use the following Makefile template to create the Makefile:
               # Targets
    TARGETS := newapp.bin
    # Source files required to build the target
    CFILES   := $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/src/*.c))
    ASMFILES := $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/crt/crt0.S))
    # Libraries required to build the target
    LIBS := sel4c sel4 sos
    #export DEBUG=1
    include $(SEL4_COMMON)/common.mk
  • Use the following Kconfig template to create a Kconfig file:
    config APP_NEWAPP
        bool "New app"
        depends on LIB_SEL4 && LIB_SEL4_C && LIB_SOS
        select HAVE_SEL4_APPS
            A new app

Build system integration

  • Modify the apps/Kconfig file, adding the following line:
    source "$SEL4_APPS_PATH/newapp/Kconfig"
  • Modify the apps/Kbuild file, adding the following line:
    apps-$(CONFIG_APP_NEWAPP) += newapp
    newapp: libsel4c libsel4 libsos
  • Now you need to modify the top level Makefile to include your new application as shown below.
    - sos-package: .config sos elfloader common kernel/kernel.elf kernel_elf dite tty_test sosh
    + sos-package: ADDITIONAL_IMAGES=${STAGE_BASE}/bin/${SOS_STARTUP_APP} ${STAGE_BASE}/bin/newapp
    + sos-package: .config sos elfloader common kernel/kernel.elf kernel_elf dite tty_test sosh newapp
  • Lastly, you need to include your new application in the build. At a terminal at the root of the source tree, type make menuconfig. Navigate to Applications -> newapp and select it by pressing 'Y'.

Design issues

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 processes.

You also probably want to check how the crt works, so you can make sure that when a process's main function exits it will kill itself.


You should show sosh executing a sub-process and show that the ps command works.

You may want to add a kill command to sosh to show that process_delete works.

As always you should be able to explain the data structures and algorithms used.

Last modified: 24 Jul 2012.