There is a dual-core processor with ane process queue for each core. There are…
- User
There is a dual-core processor with ane process queue for each core. There are processes, where the time to process the process is denoted by time[i] (1 sisn). There is a latch that helps decide which process is processed by which core, Initially, the first core has the latch. Suppose the latch is currently with the cth core, where cis either 1 or 2, and the process needs to be assigned. Then one of the following operations must be performed: The process is assigned to the core c, and the latch is given to the other core. 7 The process is assigned to the other core, and the latch is retained by the core c 2 The aim of each core is to have a maximum sum of time of processes with then for better performance. So, while assigning the th process, the core with the latch decides the operation to be performed such that the total sum of time of processes assigned to it is maximized after all the processes are assigned. 3 1 Find the sum of the time of processes assigned to the first and second cores if both the cores work optimally. Return an array of two Integers, where the first Integer is the sum of the time of processes assigned to the first core, and the second Integer is the sum of the time of processes assigned to the second core. Example Given n = 5 and time = [10, 21, 10, 21, 10]. Let's have an assignment as follows. Latch Time Assigned Core New Latch 1 10 2nd 1 Complete t The funct The funct vectorston 19) 20 21 lot maint 21 1st 2 2 10 1st 2 2 21 1st 2
- Assistant
To solve this problem, we need to optimally assign processes to two cores based on the latch rules to maximize the sum of processing times for each core.
Problem Breakdown:
- Cores: Two cores, Core 1 and Core 2.