Question
USE SIMPLE PYTHON CODE 1) Basic version with two levels of processes (master and slaves) One master process aggregates and sums the result of n
USE SIMPLE PYTHON CODE
1) Basic version with two levels of processes (master and slaves) One master process aggregates and sums the result of n slave-processes where each slaveprocess sums a different range of values in an array of 1000 random integers (please program to generate 1000 integers to populate the array).
The number of slave-processes is a parameter which the user can change. For example, if the user chooses 4 slave processes, each slave process will sum 1000/4 = 250 numbers. If the user chooses 3 slave processes, the first two may each sum 333 numbers and the third slave process sums the rest 334 numbers.
2) Advanced version with more than two levels of processes The master process creates two slave-processes where each slave-process is responsible to sum half segment of the array. Each slave process will fork/spawn two new slave-processes where each new slave-process sums half of the array segment received by its parent. Each slave process will return the subtotal to its parent process and the parent process aggregates and returns the total to its parent process. Start with 7 nodes process tree, when you are comfortable, you can extend it to a full process tree.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started