Question: #include #include /* Define structures and global constants, including: the pcb type, the children linked list type, the maximum number of processes*/ /***************************************************************/ void PROCEDURE

#include #include /* Define structures and global constants, including: the pcb type, the children linked list type, the maximum number of processes*/ /***************************************************************/ void "PROCEDURE TO PRINT HIERARCHY OF PROCESSES"() { /* declare local vars */ /* for each process index i from 0 up to (but not including) maximum number of processes*/ /* if PCB[i] is not NULL */ /* print process id, parent id, list of children processes */ } /* end of procedure */ /***************************************************************/ void "PROCEDURE FOR OPTION #1"() { /* declare local vars */ /* Allocate memory for PCB[0] */ /* Intitialize all other PCB's to NULL */ /* print hierarchy of processes */ return; } /* end of procedure */ /***************************************************************/ void "PROCDURE FOR OPTION #2"() { /* define local vars */ /* prompt for parent process index p */ /* if PCB[p] is NULL, print message process does not exist, return */ /* search for first available index q without a parent in a while loop */ /* if maximum number of processes reached, print message of no more avaiable PCBs */ /* allocate memory for new child process, initialize fields */ /* record the parent's index p in PCB[q] */ /* initialize the list of children of PCB[q] as empty */ /* append the node containing the child's index q to the children linked list of PCB[p] */ /* print hierarchy of processes */ return; } /* end of procedure */ /***************************************************************/ void "RECURSIVE PROCEDURE TO DESTROY CHILDREN PROCESSES"(parameter) { /* declare local vars */ /* check if end of linked list--if so return */ /* else call self on next node in linked list */

/* set variable q to current node's process index field */ /* call self on children of PCB[q] */ /* free memory of PCB[q] and set PCB[q] to NULL*/ /* free memory of paramter and set to NULL */ return; } /* end of procedure */ /***************************************************************/ void "PROCEDURE FOR OPTION #3"() { /* declare local vars */ /* prompt for process index p */ /* call recursive procedure to destroy children of PCB[p] */ /* reset children of PCB[p] to NULL */ /* print hierarchy of processes */ return; } /* end of procedure */ /***************************************************************/ void "PROCEDURE FOR OPTION #4"() { /* if PCB[0] is non null) /* if children of PCB[0] is not null */ /* call recursive procedure to destroy children of PCB[0] */ /* free memory of all PCB's */ return; } /* end of procedure */ /***************************************************************/ int main() { /* declare local vars */ /* while user has not chosen to quit */ /* print menu of options */ /* prompt for menu selection */ /* call appropriate procedure based on choice--use switch statement or series of if, else if, else statements */ return 1; /* indicates success */ } /* end of procedure */

CAN SOMEONE CODE THIS IN C TEST case are 1 2 2 2 2 3 4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!