GNU LUK

Lab exercises

The lab exercises are found under student-luk-1.0.8/lab. For each lab exercise you will need to:

(i)

modify student-luk-1.0.8/Makefile.in to reflect the exercise being undertaken. This only needs to be done once.

(ii)

edit the appropriate file inside each lab directory and complete the code. Now you need to go through the edit, compile, build, run cycle until the code is perfect! Remember to make bootdisk every time you want to test your code!

Each sub section below corresponds to a sub directory under student-luk-1.0.8/lab.

hello

In this directory is a simple application which just prints ``hello world'' to the screen and terminates. It is a minimal application which tests whether the microkernel can build and boot correctly. This example is complete and does not require any source code changes.

You need to modify the Makefile.in and set the APPLICATION variable to hello. So the top of Makefile.in should look like this:

#
# ================
# Makefile for luk
# ================
#
# You can configure the microkernel building in the following
# lines of code
# 
# uncomment _one_ of the following APPLICATIONs to build an
# appropriate microkernel
#
#
APPLICATION=hello
# APPLICATION=debug
# APPLICATION=scn
# APPLICATION=boundedbuffer
etc etc

debug

In this exercise you should implement the function DebugString inside the file Debug.c. Notice that there are two parameters to DebugString the pointer to the start of the string and the maximum number of characters which maybe in the string.

All characters from the pointer up until the <nul> character (char)0 should be emitted. No more than the maximum number of characters should be emitted, in case there is no trailing (char)0.

There is an initial attempt of Debug.c in this directory and this can be built using the generic building instructions found in this document.

Your function DebugString must check for the character sequence '\' 'n' and this should be cause a newline to be printed. Hint you should call WriteLn.

scn

In this exercise you should complete the screen device driver Scn.c.

There is an initial attempt of Scn.c in this directory and this can be built using the generic building instructions found in this document. You need to complete the function ScrollUp which should move each line up the screen and then finally blank the bottom line.

The screen can be accessed via the pointer to array (*screen)[j][i]. The screen top row is accessed via (*screen)[0][i]. Where i can have any value 0..Width-1 which represents the columns (left to right).

boundedbuffer

In this exercise you must complete the bounded buffer module as discussed in the lecture.

There is an initial attempt of BufferDevice.c in this directory and this can be built using the generic building instructions found in this document. Your task is to finish the two functions BufferDevice_InitBuffer and BufferDevice_ReadBuffer. Both functions have been discussed in the lectures and their associated notes.

executive

In this exercise you should complete the functions Resume and Wait in the executive.

There is an initial attempt of Executive.c in this directory and this can be built using the generic building instructions found in this document.

timerhandler

In this exercise you should complete the functions ArmEvent, Timer, Sleep in the file timerhandler/TimerHandler.c. Once these functions are complete you should improve the scheduler in any way you think appropriate. Remember that part of the scheduler is in the Executive (RotateRunQueue) and the process priority queues.

There is an initial attempt of TimerHandler.c in this directory and this can be built using the generic building instructions found in this document.

There are a number of test programs which you should use to test your implementation while under development. These test programs are enabled by changing the APPLICATION declaration in Makefile.in.

The three test programs you should use are:

# APPLICATION=basic
# APPLICATION=lander
# APPLICATION=window
basic

provides simple command line access to the TimerHandler module. It creates a ten, fifteen and sixty second alarm process. The keyboard can then cancel or reset the sixty second alarm. This is very useful just to ensure that the core primitives of the TimerHandler are operational.

lander

provides a lunar lander retro game using TimerHandler, Executive and the microkernel.

window

provides the three window example which appears very similar to the one used to test the Executive. However this time it uses your scheduler which you have written in TimerHandler and Executive.

processes

In this directory is an application which runs three processes running in separate windows. It is a test application which demonstrates that the Executive and Interrupts are functioning in the microkernel. This example is complete and does not require any source code modifications.

combined

This does not require any extra work, but allows students to see their combined C files all working in the microkernel. It will have been necessary to complete all previous exercises (bug free) to see this successfully work.