Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A scheduler needs to determine an order in which a set of n processes will be as

ID: 3599944 • Letter: A

Question

A scheduler needs to determine an order in which a set of n processes will be assigned to a processor.
The ith process requires ti units of timw and has weight wi
. For a given schedule, define the finish
time of process i to be the time at which process i is completed by the processor. (Assume that
the processor starts processing the tasks at time 0.)
For example, consider 4 processes with t1 = 5, t2 = 2, t3 = 7, t4 = 4. And weights w1 = 1,
w2 = 3, w3 = 2, and w4 = 2. Consider the schedule 1, 3, 2, 4. The finish time for process 1 is 5, for
process 2 is t1 + t3 + t2 = 5 + 7 + 2 = 14, for process 3 is t1 + t3 = 5 + 7 = 12, and for process
4 is t1 + t3 + t2 + t4 = 5 + 7 + 2 + 4 = 18. The total weighted finish time of the schedule is then
5 · 1 + 14 · 3 + 12 · 2 + 18 · 2 = 5 + 42 + 24 + 36 = 107.
Give a greedy algorithm to determine a schedule that minimizes the total weighted finish time.
Prove the correctness of your algorithm, and analyze its worst-case running time.

Explanation / Answer

Answer:

Greedy algorithm:

a) Greedy algorithm will determine the dilemma stair by stair.

b) By the side of any step, the answer preferred by the Greedy algorithm will be restricted most favorable that can be preferred at that time.

c) The last answer will be the most favorable answer for the problem.

Greedy Algorithm for scheduler:

1. Sort the workstation based on the mass value, the procedure which has elevated mass value should come initial in the list, if similar value occurs, course with smaller time should move toward initial.

2. Choose the first progression from the sorted mass list.

3. Place the course in the plan.

4. Replicate the steps 2-4 plow the list becomes unfilled

Correctness:

Initialization:

* The algorithm begins with the uppermost mass value progression.

* Thus the maximum mass procedure will whole at first, this will decrease the higher mass growth with higher values.

*If this superior mass will processed presently, it will augmentation the “time*weight” value

Maintenance:

a) At every step, the procedure that is additional to the list will have the slighter mass in the sort.

b) Thus it will make certain the smallest amount mass time at every step.

Termination:

* The algorithm will scurry till the catalog becomes unfilled, thus there will be forever a applicable schedule will be there.

Complexity:

* Need to genus the process list, It will take “O(n log n)” time of the numeral process is “n”.

* There also require to think about the time value assessment, thus the on the total involvedness will be in “O(n2 log n)”.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote