Process Creation Hierarchy

Introduction to Operating Systems and System Architecture
Assignment #1–Process Creation Hierarchy
Objective:
To simulate process creation and destruction when implemented with linked lists.
Specification:
The program creates/destroys child processes based on choosing from a menu of choices, where each
choice calls the appropriate procedure, where the choices are:
1) Enter parameters
2) Create a new child process
3) Destroy all descendants of a process
4) Quit program and free memory
Assignment:
• Create a process creation hierarchy as a dynamic array of length n which references the process
control blocks (PCBs), indexed 0 to n-1
• Each PCB is a structure consisting of two fields:
o parent: a PCB index corresponding to the process’ creator
o children: a pointer to a linked list, where each node contains the PCB index of one child
process and a link to the next child in the list
• The necessary functions are simplified as follows:
o create() represents the create function, which prompts for the parent process PCB[p]. The
function creates a new child process PCB[q] of process PCB[p] by performing the following
tasks:
▪ allocate a free PCB[q]
▪ record the parent’s index, p, in PCB[q]
▪ initialize the list of children of PCB[q] as empty (NULL)
▪ create a new link containing the child’s index q and append the link to the linked list
of PCB[p]
o destroy() represents the destroy function, which prompts for the parent process PCB[p]. The
function recursively destroys all descendent processes (child, grandchild, etc.) of process
PCB[p] by performing the following tasks: for each element q on the linked list of children of
PCB[p]:
▪ destroy(q) /* recursively destroy all descendants */
▪ free PCB[q]
▪ deallocate the element q from the linked list
What NOT to do:
• Do NOT modify the choice values (1,2,3,4) or input characters and then try to convert them to
integers–the test script used for grading your assignment will not work correctly.
• Do NOT turn in an alternate version of the assignment downloaded from the Internet (coursehero,
chegg, reddit, github, etc.) or submitted from you or another student from a previous semester—the
test cases from this semester will not work on a previous semester’s assignment.
• Do NOT turn in your assignment coded in another programming language (C++, C#, Java).
What to turn in:
• The source code as a C file uploaded to Canvas by the deadline of 11:59pm PST (-20% per
consecutive day for late submissions, up to the 4th day—note 1 minute late counts as a day late, 1 day
and 1 minute late counts as 2 days late, etc.)
• As a note, even though your code may compile on a compiler you have installed on your computer, I
do not have access to your computer. I will be using the following free online compiler for testing, so
make sure your code compiles with the following online C compiler before submitting:
https://www.onlinegdb.com/online_c_compiler
Sample output
Process creation and destruction
——————————–
1) Enter parameters
2) Create a new child process
3) Destroy all descendants of a process
4) Quit program and free memory
Enter selection: 1
Enter maximum number of processes: 5
Process creation and destruction
——————————–
1) Enter parameters
2) Create a new child process
3) Destroy all descendants of a process
4) Quit program and free memory
Enter selection: 2
Enter the parent process index: 0
PCB[0] is the parent of: PCB[1]
Process creation and destruction
——————————–
1) Enter parameters
2) Create a new child process
3) Destroy all descendants of a process
4) Quit program and free memory
Enter selection: 2
Enter the parent process index: 0
PCB[0] is the parent of: PCB[1] PCB[2]
Process creation and destruction
——————————–
1) Enter parameters
2) Create a new child process
3) Destroy all descendants of a process
4) Quit program and free memory
Enter selection: 2
Enter the parent process index: 2
PCB[0] is the parent of: PCB[1] PCB[2]
PCB[2] is the parent of: PCB[3]
Process creation and destruction
——————————–
1) Enter parameters
2) Create a new child process
3) Destroy all descendants of a process
4) Quit program and free memory
Enter selection: 2
Enter the parent process index: 0
PCB[0] is the parent of: PCB[1] PCB[2] PCB[4]
PCB[2] is the parent of: PCB[3]
Process creation and destruction
——————————–
1) Enter parameters
2) Create a new child process
3) Destroy all descendants of a process
4) Quit program and free memory
Enter selection: 3
Enter the index of the process whose descendants are to be destroyed: 0
Process creation and destruction
——————————–
1) Enter parameters
2) Create a new child process
3) Destroy all descendants of a process
4) Quit program and free memory
Enter selection: 4
Quitting program…

Don't use plagiarized sources. Get Your Custom Essay on
Process Creation Hierarchy
Just from $13/Page
Order Essay
Academic Heros
Calculate your paper price
Pages (550 words)
Approximate price: -

Why Work with Us

Top Quality and Well-Researched Papers

Our writers are encouraged to read and research widely to have rich information before writing clients’ papers. Therefore, be it high school or PhD level paper, it will always be a well-researched work handled by experts.

Professional and Experienced Academic Writers

For one to become part of our team, thorough interview and vetting is undertaken to make sure their academic level and experience are beyond reproach, hence enabling us give our clients top quality work.

Free Unlimited Revisions

Once you have received your paper and feel that some issues have been missed, just request for revision and it will be done. In addition, you can present your work to the tutor and he/she asks for improvement/changes, we are always ready to assist.

Prompt Delivery and 100% Money-Back-Guarantee

All our papers are sent to the clients before the deadline to allow them time to review the work before presenting to the tutor. If for some reason we feel our writers cannot meet the deadline, we will contact you to ask for more time. If this is not possible, then the paid amount will be refunded.

Original & Confidential

Our writers have been trained to ensure work produced is free of plagiarism. Software to check originality are also applied. Our clients’ information is highly guarded from third parties to ensure confidentiality is maintained.

24/7 Customer Support

Our support team is available 24 hours, 7 days a week. You can reach the team via live chat, email or phone call. You can always get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

You have had a hectic day, and still need to complete your assignment, yet it is late at night. No need to panic. Place your order with us, retire to bed, and once you wake up, the paper will be ready.

Essays

Essay Writing Service

It does not matter the urgency of your paper, or the academic level, our team is ready to help you 24/7. Just contact us and all your academic needs will be sorted.

Admissions

Admission Essays & Business Writing Help

A student is often required to write an admission letter requesting to be admitted in a certain institution. For you to be gain that admission in your dream institution, you must write a convincing letter. You can depend on our team for the best admission letters.

Reviews

Editing Support

Academic writing is not just about getting information and throwing it all over. Our team will ensure you have a polished paper that is coherent and has a good flow of information. We also ensure the paper follows the correct formatting styles like APA, Harvard, MLA, Chicago/Turabian.

Reviews

Revision Support

If our writers write a paper but you are not satisfied in one way or another, you can always ask for revision. This is totally free. Our writers and editors will revise your paper untill you are be totally satisfied. We as well offer revision for papers not done by our writers at a small fee.