Real-time operating systems spring
2001/ laboratory exercises
Labs 1 and 2 are mandatory to pass the course.
Lab1:
The real-mode exercises must be done with Borland
compiler (The Linux environment has not a real-mode compiler). Compiler
settings: standard DOS, compact/small memory model.
You must implement user level testing of
all labs, you write test processes using new features.
Every student takes one exercise from the following
list (if two, at most, students are working in the same group, you must
discuss with the teacher about additional features):
-
Implement one subprogram scheduler
called in every place when scheduling is needed. This scheduler calls contextswitch
when needed.
In the current system scheduling
is "tailored" case by case (for efficiency). In the send system call we
have one algorithm to schedule (to find the highest priority process to
run) and different in the receive system call and timer interrupt.
-
A process making Send system call is not waiting
any other process to receive the message (mailbox used), it continues immediately.
Rewrite the system call code so that a sending process continues only when
an other process receives the message (a previous exam question, few lines
of code).
When sender is waiting always for receiver mailbox
buffers are not needed. You must take the highest priority waiting process
to receive the sent message. The main idea, that always the highest priority
READY process must be running is not, of course, changed. We need one more
state in the PCB (waiting receiver), also mailbox structure needs re-thinking.
-
Change the system call interface to use interrupt
PC 8086/HS7000 version (software trap), testing in PC. This means that
we add a few code lines as an interface between the user system call
and service routine in the kernel (user system call library routine pushes
parameters on stack or uses general registers and makes inline assembly
instruction as asm("int RECEIVE") and asm("int SEND"). Interrupt
service routine vectors are pointing to the current (slightly modified)
code of Send and
Receive. Unfortunately this exercise can
be done only if the Borland system has assembler TASM with it. This is
not the case in our standard system.
-
Implement simple memory buffer pool management to
PC8086/HS7000 version (kernel allocates buffers to processes), testing
in PC. This means that user processes have 2 system calls ptr=allocate();
and free(ptr). Buffers are for simplicity fixed size. You need not
(necessarily) to implement waiting if all buffers are allocated (even it
is simple, for example Receive to a mailbox dedicated only for this
purpose). Allocating can return only -1, if we have not buffers. This is
simple laboratory exercise, for better grade add waiting of buffer.
-
Add an interrupt based serial line handling in the
PC 8086 version (the code is ready now in protected mode version). This
means that you can copy the code from the protected mode version and test
it with real- mode version. You need a 3- wire serial line cable (in, out,
GND- wire 2-->, 3-->2).
-
The x86/Pentium version has some inline assembly,
replace these "tricky parts" with calls to assembly source modules, no
"trics" needed.
(This lab can be for 2 or 3 students without
additional features)