Question: In java , add comments please Develop a program in JAVA to simulate and compare the performance of process creation and destruction when implemented with

In java , add comments please

In java , add comments please Develop a program in JAVA tosimulate and compare the performance of process creation and destruction when implemented

Develop a program in JAVA to simulate and compare the performance of process creation and destruction when implemented with (version 1) and without linked lists (version 2). Description Version 1 of the process creation hierarchy uses linked lists to keep track of child processes as described in section "The process control block", subsection "The PCB data structure" of the textbook. For the purposes of performance evaluation, the PCBs are simplified as follows: All PCBs are implemented as an array of size n. Each process is referred to by the PCB index, 0 through n-1. Each PCB is a structure consisting of only the two fields: o parent: a PCB index corresponding to the process's creator o children: a pointer to a linked list, where each list element contains the PCB index of one child process The necessary functions are simplified as follows: create(p) represents the create function executed by process PCB[p]. The function creates a new child process PCB[q] of process PCB[p] by performing the following tasks: o allocate a free PCB[q] o record the parent's index, p, in PCB[q] o initialize the list of children of PCB[q] as empty o create a new link containing the child's index q and appends the link to the linked list of PCB[p] destroy(p) represents the destroy function executed by process PCB[p]. The function recursively destroys all descendent processes (child, grandchild, etc.) of process PCB[p] by performing the following tasks: o for each element q on the linked list of children of PCB[p] destroy(q) /* recursively destroy all progenies */ free PCB[q] deallocate the element q from the linked list Version 2 of the same process creation hierarchy uses no linked lists. Instead, each PCB contains the 4 integer fields parent, first_child, younger sibling, and older_sibling, as described in the subsection "Avoiding linked lists". Assignment 1. Implement the two versions of the process creation hierarchy. 2. Assume that PCB[O] is the only currently existing process and write 4 test program that performs a series of process creations and destructions. An example of such a test program is given below. Create (0) /* creates 1st child of PCB[0] at PCB [1] */ Create (0) /* creates 2nd child of PCB[0] at PCB [2] */ Create (2) /* creates 1st child of PCB [2] at PCB [3] */ Create (0) /* creates 3rd child of PCB [0] at PCB [4] */ Destroy (0) I* destroys all descendents of PCB [0], which includes processes PCB[1] through PCB [4] */ 3. Run the test programs repeatedly in a long loop using both versions and compare the running times to see how much time is saved in version 2, which avoids dynamic memory management. 4. Provide your analysis and interpretations of the results. Develop a program in JAVA to simulate and compare the performance of process creation and destruction when implemented with (version 1) and without linked lists (version 2). Description Version 1 of the process creation hierarchy uses linked lists to keep track of child processes as described in section "The process control block", subsection "The PCB data structure" of the textbook. For the purposes of performance evaluation, the PCBs are simplified as follows: All PCBs are implemented as an array of size n. Each process is referred to by the PCB index, 0 through n-1. Each PCB is a structure consisting of only the two fields: o parent: a PCB index corresponding to the process's creator o children: a pointer to a linked list, where each list element contains the PCB index of one child process The necessary functions are simplified as follows: create(p) represents the create function executed by process PCB[p]. The function creates a new child process PCB[q] of process PCB[p] by performing the following tasks: o allocate a free PCB[q] o record the parent's index, p, in PCB[q] o initialize the list of children of PCB[q] as empty o create a new link containing the child's index q and appends the link to the linked list of PCB[p] destroy(p) represents the destroy function executed by process PCB[p]. The function recursively destroys all descendent processes (child, grandchild, etc.) of process PCB[p] by performing the following tasks: o for each element q on the linked list of children of PCB[p] destroy(q) /* recursively destroy all progenies */ free PCB[q] deallocate the element q from the linked list Version 2 of the same process creation hierarchy uses no linked lists. Instead, each PCB contains the 4 integer fields parent, first_child, younger sibling, and older_sibling, as described in the subsection "Avoiding linked lists". Assignment 1. Implement the two versions of the process creation hierarchy. 2. Assume that PCB[O] is the only currently existing process and write 4 test program that performs a series of process creations and destructions. An example of such a test program is given below. Create (0) /* creates 1st child of PCB[0] at PCB [1] */ Create (0) /* creates 2nd child of PCB[0] at PCB [2] */ Create (2) /* creates 1st child of PCB [2] at PCB [3] */ Create (0) /* creates 3rd child of PCB [0] at PCB [4] */ Destroy (0) I* destroys all descendents of PCB [0], which includes processes PCB[1] through PCB [4] */ 3. Run the test programs repeatedly in a long loop using both versions and compare the running times to see how much time is saved in version 2, which avoids dynamic memory management. 4. Provide your analysis and interpretations of the results

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!