CS460 Takehome Midterm Exam #2
                      DUE: 9/21/2023
   NOTE: as EXAM, all independent work, NO discussions allowed

1. READ Process Management PDF
		
   Processes begins from P0, which kfork a P1, switch to run P1, which may
   kfork other procs. The processes form a family tree, which looks like this:
		
		P0
		|
		P1   (never let P1 exit)
		|
     ------------------------
         P2     P3    P4		
                |
	     --------
	     P5   P6

BASE CODE: samples/MID2/mid2.tgz. It supports
     switch: tswitch() to switch process	
     Kfork : kfork(body,1) to kfork a child process

(1). ADD a ps command, which prints the status of all PROCS
		
(2). Modify kfork() to implement process family tree as a BINARY tree by using
     the child, sibling, parent pointers.

(3). Implement ksleep()/kwakeup() as in Chapter 5.6.1
     Implement a sleepList for all SLEEP process		
     ADD sleep, wakeup commands and show they work.

When a process runs, show its pid, ppid and child list.
For clarity, also show freeList, readyQueue and sleepList
		

(4). Implement kexit(int exitCode) as in Section 2 of the PDF file
		
(5). Implement pid = wait(int *status) as in Section 4 of the PDF file

For testing: ADD a wait command for ANY process to wait for a ZOMBIE child.