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

PRINTER Printer-Friendly Version
- Notices
- Course Intro
- Consultations
- Survey Results
- Lectures
- Selected Papers
- Project Spec
- Project FAQ
- Exam
- Forums
- Can't Login?
- Project Resources
- ASysT Lab
- Using Sulima
- L4 Debugging Guide
- L4Ka::Pistachio FAQ
- L4 source browser
- SOS source browser
- L4 reference manual
- L4 user manual
- Sulima ISA Simulator
R4x00 ISA Summary 
MIPS R4700 ReferenceMIPS R4000 User Manual 
- GT64111

Related Info
- Aurema OS Prize
- OS Hall of Fame
- 2004
- 2003
- 2002
- 2000
- 1999
- 1998
- 1997
- Gernot Heiser (LiC)
- Kevin Elphinstone
- Guest Lecturers (TBA)
- Student Reps

Valid HTML 4.0!

M1: Memory manager

Your first milestone is fairly straightfoward, and should only take you around 5 hours to complete. However, you should use this as an opportunity to get to used working with your partner, and probably work out exactly how you can work together so you don't end up duplicating work, or worse still not completing essential parts of the project.

By now you should have got yourself in a group and you should have a group account setup for you. We recommend that you use CVS to maintain your source code, (this isn't a requirement, just a suggestion), and that your CVS repository be setup in your group account with the correct permissions and sticky bits set so that you can both access it.

NOTE: If you are using CVS, be careful that the lib/lwip/core directory is ignored on import by CVS by default. See this page for more information.

The aim of this milestone is to design an implement simply memory management. You will need to set up a frame table so that you can keep track of the system's physical memory. You should extend the current implementation in frames.c. The comments in the provided file explain the existing interface.

Design alternatives

Some things you should think of are what information you need to store in the frame table. You may want to take into account the fact that you will later be using this frame table to support virtual memory, swapping and multiple processes. You should take this into account when designing your data structures.

You should also take into account which operations you want to perform on the frame table, and the required algorithms to fulfill these. For example, you don't want and order n-square search to find the next free frame.

Of course it is easy to change these data structures later as you gain a better understanding of the issues involved, so don't spend too much time designing the perfect structure now.

One other thing you should think of is whether you request frames from Sigma0 at the start, or only when they are first needed. Note the memory distribution policy used by sigma0 suggests grabbing all available/required physical memory at initialisation time to avoid the memory being grabbed by other tasks in the system.

Your design should take into account the space and time complexity and bounds of your data structures.

Supplied Code

For this project you have been supplied with an extensive set of skeleton code to help you along the way. This code is intended as an implementation guide, not as a 'black-box' library.

It is important that you fully understand all provided code that you use. You are encouraged to modify and improve the supplied code. For the purposes of assessment, we treat any supplied code that you call as your code and as such you may be able to describe how it works.


The demonstration of this solution should show the execution of some example code using the allocation routine. For example:

/* Allocate 10 pages and make sure you can touch them all */
for (i=0; i < 10; i++) {
    /* Allocate a page */
    page = frame_alloc();
    assert(page != NULL);

    /* Test you can touch the page */
    *page = 0x37;
    assert(*page == 0x37);

    l4e_printf("Page #%d allocated at %p\n",  i, page);
/* Test that you eventually run out of memory gracefully,
   and doesn't crash */
while(1) {
     /* Allocate a page */
     page = frame_alloc();
		 if (page == NULL) {
          l4e_printf("Out of memory!\n");

     /* Test you can touch the page */
     *page = 0x37;
     assert(*page == 0x37);
/* Test that you never run out of memory if you always free frames. 
    This loop should never finish */
while(1) {
     /* Allocate a page */
     page = frame_alloc();
     assert(page != NULL)

     /* Test you can touch the page */
     *page = 0x37;
     assert(*page == 0x37);

     l4e_printf("Page #%d allocated at %p\n",  i, page);


You should also be able to explain to the tutor the structure of your frame table, how your code works and any design decisions you took.

Last modified: 01 Aug 2005.