debai.jpg

Question 1: Use FCFS algorithm to find the completing time of P3 ?

We all know that, FCFS stand for First Come First Served. This is the easiest algorithm of CPU scheduling, I swear. In the real life, if we go to any shop to buy something, and in that time has many people make a long line to counter to buy their things. Yes, we can understand it like “queue”. And if you come to this place, you have to linked onto the tail of the queue, not in head of it’s. We realize that if say that, many people will think that a long definition. So that, we just call it base on feature’s queue – First Come First Served.

Back to problem, let’s solve it to find the correct answer. Base on the table, we altogether know that 5 Process in the table all have information about time come to queue – in here it called Arrival Time. Thus, we can’t draw the Gantt chart follow the order in the table – from the head to tail and don’t care about Arrival Time. We have to illustrates each process with their time of arrival. Of course we also note under the Gantt chart these number indicate for the start and finish times of each of the participating processess.

Now, we have the picture illustrates the result of algorithm FCFS.

fcfs.jpg

And everything come to this place so clearly for you to see the way to get the key.

Just remember a little secret about these number under the chart. The number was set on the left is the waiting time of process. And in the other side of it’s is the completing times.

What are you waiting for? Let’s calculate the completing time of P3! But hold on! You just need to keep in mind that, before give your teacher the number you think, let’s minus the completing time with the arrival time’s number.

In this example, if you want to calculate the completing time’s P3, just do like this below:

P3 = 33 – 3 = 30 milliseconds.

Question 2: Use FCFS algorithm to find the average completing time ?

We have done the quest 1, so this can’t make we confuse, right? Yup! Continue to find the truth!

Now the teacher want you find out the average time for complete all these processes. You must calculate each completing time for each process. After that, we have a list like this:

P1 = 7 – 0 = 7 ms

P2 = 23 – 1 = 22 ms

P3 = 33 – 3 = 30 ms

P4 = 36 – 4 = 32 ms

P5 = 25 – 2 = 23 ms

What is the average? If you have been learn Microsoft Excel before, you would found the correct answer from yourself. Make it bright, if you have 2 apple, 4 lemon and 4 bread, then you will get the average of package is 10/3 (include apple, lemon and bread). Clearly?

Now, we do some steps to find out average. Just do like function below:

c func.jpg

Question 3: Use FCFS algorithm to find the average waiting time ?

Oh, it’s clearly want you play with all the number on the left edge of each process. Just keep in mind to minus first all left number to arrival time before get the final number you want. Same, we also have list:

P1 = 0 ms

P2 = 7 – 1 = 6 ms

P3 = 25 – 3 = 22 ms

P4 = 33 – 4 = 29 ms

P5 = 23 – 2 = 21 ms

And now, the function we get:

w func.jpg

Thanks.

Vo Tinh Thuong

votinhthuong9@gmail.com

Advertisements