0

I have $P$ different processes given along with their respective Burst time and arrival time. The time quantum is $1$ sec i.e. each process can only run for $1$ sec. There's a total time $F$ given for which computer will be available to perform these processes. Also for each process $P_i$ there exists a respective cost/sec for not performing it. There's no penalty for the waiting time. Penalty is on the basis of how much percaentage of burst time was left. Preemption is allowed.

For Eg- If $P=3$,$F=10$. $P_1$ has burst time of $9$ sec and penalty of $10/sec$ for $P_1$ Suppose the Gantt Chart comes out to be $|P_1P_2P_3P_1P_2P_2P_1P_1P_2P_1|$

Since $P_1$ was allowed to run for only $5$ sec till the end of all processes so total penalty will be $(9-5)*10= 40$ .

I have to schedule the process in so as to minimize the sum of penalty for all processes.

If priority was given instead of penalty for no-operation, I would simply select the process first on basis of arrival time and then on the basis of priority and then preempt the process like Preemptive Priority scheduling.

I tried it by using greedy approach. First I sort the jobs on basis of Arrival time and then if clash occurs then on the basis on cost so as to minimize the sum of total cost incurred. I choose the job with min Arrival time and maximum Cost.

Is there any more optimal and efficient way to minimize the total cost ?

Bash
  • 11
  • 1
  • Welcome to CS.SE! Are you looking for an algorithm to find the optimal schedule? Is this a streaming/on-line situation (where you are only told about the existence of a process when it arrives) or a batch situation (where you know about all processes in advance)? Do you care about how efficient the algorithm is? Can $P$ be considered a small constant for purposes of running time analysis? What algorithm design paradigms have you already tried? it sounds like you are investigating greedy algorithms; for that, take a look at https://cs.stackexchange.com/q/59964/755. – D.W. Jul 08 '17 at 18:05
  • @D.W. This is a batch situation i.e. all information is known before hand. And I am looking for an efficient algorithm to find the optimal schedule. $P$ is fairly large for practical purposes i.e. around $10^3$. I have updated my answer to what I have tried. – Bash Jul 09 '17 at 09:42
  • I suggest you use the techniques in https://cs.stackexchange.com/q/59964/755 to try to determine if your method produces the optimal solution: implement and use random testing, and if it always seems optimal, try to prove it. – D.W. Jul 09 '17 at 15:20
  • @D.W. Thanks, I have tried random testing. My solution seems to be efficient but not optimal. I think the greedy solution may be not be optimal here. – Bash Jul 09 '17 at 18:11

0 Answers0