460 Lab Assignment #3 : MTX System
DUE & DEMO : To be posted
A. PRELIMINARY WORK:
=============================================================================
0. Make sure YOUR MTX booter of LAB#1 is working. Use it here.
1. Run the sample MTX given in notes #3.
(Also available in samples/LAB3 as s.s and main.c).
============================================================================
B. REQUIREMENTS:
============================================================================
Download the files main.c and s.s from ~samples/LAB3/. Generate a bootable
MTX image in /boot/mtx on a FD. Use YOUR MTX booter to boot MTX from the FD.
Test run the simple MTX. Lab#3 is an extension of this program.
Modify main.c to do the following
1. Add a priority field to the PROC struct and implement a readyQueue by
task priority. Tasks with the same priority are ordered FIFO.
Let mainProc's priority = -1 (the lowest), and all other task's
priority = 0.
NOTE: When adding fields to the PROC struct, make sure they are
multiples of 2 bytes and place them BEFORE the kstack[], which
must be at the HI END of the PROC struct.
2. Instead of creating ALL the tasks at the same time, implement a
int myfork()
function, which creates a CHILD task and enters the child task into the
readyQueue. It returns the child task's pid if succeeds, or -1 if not.
Let EVERY new task begins execution from the same body() function.
3. In main():
call initialize() to initialize the data structures. Initially,
all FREE proc's are in a freeList and readQueue is empty.
Let mainProc be the initial running task.
call myfork() once to create task1, which should go into the readyQueue.
call tswitch() to switch to task1.
4. In the body() function, implemnet a 'f' command, which calls myfork() to
create a new task. The new task is a CHILD of the task that called myfork().
Add some fields to the PROC structure, e.g. ppid or parentPtr, to keep track
of the parent-child relation.
=============================================================================