Process Management in the MT Multitasking System

This section presents a programming exercise for the reader to refine the base MT system to implement process management functions for the MT system. Specifically,

  1.  Implement process family tree as a binary tree.
  2.  Implement ksleep() and kwakeup() for process synchronization.
  3.  Implement kexit() and kwait() for process management.
  4.  Add a ‘w’ command to test and demonstrate the wait operation.

Sample solution to the programming exercise is available online for download. Figure 3.3 shows the sample outputs of running the modified MT system. As the figure shows, P1 forked a child P2, which forked its own children P3 and P4. Then P2 executes the ‘q’ command to terminate. The figure shows that P2 becomes a ZOMBIE and sends all the orphan children to P1, whose children list now includes all the orphans from P2. When P1 executes the ‘w’ command, it finds the ZOMBIE child P2 and returns it to the freeList. Alternatively, the reader may change the child-exit and parent-wait order to verify that the order does not matter.

Source: Wang K.C. (2018), Systems Programming in Unix/Linux, Springer; 1st ed. 2018 edition.

Leave a Reply

Your email address will not be published. Required fields are marked *