* added compilers lcc and bcc (linux86)
[mascara-docs.git] / i86 / mtx / mtx / LAB3.html
bloba3032c7a7d23e26529313fc9811d4ddcfbee7269
1 <Title>460 Notes</Title> <Body bgcolor="#00cccc" text="#000000"><H1>LAB #3 sleep/wakeup/wait/exit in MTX Kernel</H1><pre>
2 ASSIGNMENTS
4 DUE & DEMO : to be posted
6 PRELIMINARY WORK: LAB2 MTX Kernel with [s|q|f] commands
8 Modify YOUR base MTX system in LAB #2 to include the following:
10 1. sleep(event)/wakeup(event):
11 As shown in Notes #4
13 2. pid = wait(&status):
14 The logic of wait() is explained in Notes #4.
15 Implement it in YOUR MTX.
17 3. RE-WRITE kexit() as follows:
18 A task calls kexit(int exitValue) to die, in which it
19 . (prompt for an exitValue, e.g. 0 to 9)
20 . print last gasp and records the exitValue in its proc.existValue;
22 . becomes a ZOMBIE;
23 . gives all children to Proc1;
24 . wakeup its parent;
25 . finally, tswitch() to give up CPU.
27 Thus, Proc1 cannot die if there are other existing procs
28 (Use nproc to keep track of the number of existing procs).
30 4. Add the follwoing commands FOR DEMO:
32 p : print the status of ALL procs:
34 pid ppid status=RUNNING|READY|SLEEP(event)|ZOMBIE|FREE
36 w : wait for a child proc to die:
37 1. error if no child;
38 2. print dead child pid and exitValue
40 5. ~samples/LAB3/mtximage.gz.bin
41 (download, mv to mtximage.gz, gunzip mtximage.gz,
42 dd to FD or use it as a virtual FD).