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

PRINTER Printer-Friendly Version

M8: ELF Loading

At this stage, the only way to install and execute a new application on your operating system is to recompile the operating system itself. The objective of this milestone is to transition your OS to load and execute programs that are hosted by the NFS server. The CPIO archive should not be required after this milestone is complete (including for sosh).

By this final milestone you should ensure that all I/O is asynchronous. This means that your system must not block waiting for completion of file system or paging I/O, but should be able to run any process that is ready while other processes are blocked on I/O completion.


The libelf library has been provided for you in your source tree. You may use this library to handle the parsing of ELF format files. You will need to modify apps/sos/src/elf.c to load executables from the network file system instead of the cpio image linked with SOS.

Note: you initially only need to read the ELF header of an executable file, in order to parse it and subsequently load it for execution. You can assume the header is less than the page size (4 KiB). You should only read in the file as needed when loading the executable, or completely lazily when the application faults on it.

You may also wish to modify the top level Makefile to automatically copy your executable files into your NFS directory (/var/tftpboot/$USER).

Design issues

One design decision is whether to load the whole executable image on process creation, or instead load page-wise on demand at page-fault time.



You will demonstrate (by running a sosh) that your system works even with repeated and concurrent executions, and that you can execute every file (of the right content) from your NFS directory.

Show Stoppers

  • Continuing to run all programs within the CPIO archive (i.e. not loading via NFS). It's okay to load the initial sosh from the CPIO archive.
  • Crash when attempting to load a non-executable or corrupt file.
  • Assuming ELF files only have two sections.

Better Solutions

The following can be considered stretch goals. They are significantly more work, and the reward is mostly in personal understanding.

  • Lazy load the executable or data from the file.
  • Mapping read-only ELF segments read-only, and not paging them, but re-reading them from the ELF file

Last modified: 08 Aug 2017.