Question: Part A: Parents, Children and Threads ( 5 5 marks ) PART A . 1 . ( 3 0 marks: 5 for Phase 1 and
Part A: Parents, Children and Threads marks
PART A marks: for Phase and for Phase and for Phase Write a WINDOWS program that creates multiple threads that each perform the same function compute squares of positive integers in parallel until a deadline, without synchronization between the processesthreads of any kind. The number of child threads threads and the deadline deadline and the maximum integer size are to be commandline parameters. Each thread does the same task. The task is given below which utilizes the third commandline parameter size The usage is as follows: partA threads deadline size.
Parent thread functionality:
The application should have a parent thread create M child threads.
The parent should then sleep until the deadline. The simplest way to do this is to use the system call Sleep.
If the deadline occurs before all children complete, inform the child threads that they should exit. One possible strategy is if the deadline has passed, the parent sets a global variable named something like keepRunning to have the value FALSE. The child threads would read this variable each time Square is called from the main loop of the thread that calls Square If you find some other way to do this, you may do so Please document your solution carefully.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
