Question: cluster has multiple processors each with 4 cores The number of tasks to handle is equal to the total number of cores in the cluster

cluster has multiple processors each with 4 cores The number of tasks to handle is equal to the total number of cores in the cluster Each task has a predicted execution time and each processor has a specified time when its cores become available Assuming that exactly 4 tasks are assigned to each processor and that those tasks run independently asynchronously on the cores of the chosen processor what is the earliest time that all tasks can be processed Example n 2 processor Time 8 10 taskTime 2 2 3 1 8 7 4 5 co One optimal solution is as follows Assign the tasks with the execution times 2 3 7 and 8 to processor 0 that start at time 8 Assign the tasks with the execution times 4 2 5 and 1 to processor 1 that start at time 10 A The first processors cores finish at times 8 2 8 3 8 7 and 8 8 which are 10 11 15 and 16 respectively The second processors cores finish at timeso 10 4 10 2 10 5 and 10 1 which are 14 12 15 and 11 respectively The maximum among those finishing times is 16 This is the earliest possible finish timeFunction Description Complete the function min Time in the editor below minTime has the following parameters int processor Timen each processor Timei denotes the time at which all 4 cores of the ith processor become available int taskTime4n each taskTimei denotes the execution time of the ith task Returns int the earliest time at which all the tasks can be finished A Constraints 1 n 10 5 1 processor Time1 106 1 s taskTimei 106Input Format For Custom Testing Sample Case 0 Sample Input For Custom Testing STDIN Function 2 number of processors n 2 20 16 processor Time 10 20 8 number of tasks 8 2 taskTime 2 3 1 2 5 8 4 3 3 125843 Sample Output 23 Explanation There are 2 processors that become available at times 10 and 20 and there are 8 tasks with execution times 2 3 1 2 5 8 4 and 3 It is optimal to do the followingAssign to the first processor which becomes available at time 10 the tasks with the following execution times 1 4 5 and 8 Assign to the second processor which becomes available at time 20 the tasks with the following execution times 2 2 3 and 3 The tasks assigned to the first processor finish at times 10 1 10 10 5 and 108 which are 11 14 15 and 18 respectively The tasks assigned to the second processor finish at times 20 2 20 2 20 3 and 20 3 which are 22 22 23 and 23 respectively The maximum amongst those finishing times is 23 There is no way to complete all tasks earlier Sample Case 1 11binpython3 10 11 12 Complete the minTime function below 13 14 The function is expected to return an INTEGER 15 The function accepts following parameters 16 1 INTEGERARRAY processorTime 17 2 INTEGERARRAY taskTime 18 19 20 def minTime processorTime taskTime 21 Write your code here 22 23 if name main

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To solve the problem of assigning tasks to processors such that the overall completion time is minimized we need to follow a structured approach 1 Sor... View full answer

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 Finance Questions!