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

A. FCFS Answer - by the time the first job A is finished, then next job will be

ID: 644821 • Letter: A

Question

A. FCFS

Answer - by the time the first job A is finished, then next job will be B,C,D,E.

B. SJN

Answer -  by the time the first job E is finished, then next job will be B,D, C, A.

C. SRT

Answer -  by the time the first job E is finished, then next job will be B,D,C,A,C,D,A,A.

D. Round Robin

Answer -  by the time the first job A is finished, then next job will be B,C,D,E,A,C,D,A.

9. Using the same information from the previous exercise, calculate the start time and finish time for each of the five jobs using each of the following scheduling algorithms. It may help to draw the timeline. a. FCFS b. SJN c. SRT d. Round Robin (use a time quantum of 5, but ignore the time required for context switching and natural wait) 10. Using the same information given for Exercise 8, compute the turnaround time for every job for each of the following scheduling algorithms (ignore context switching overhead times). It may help to draw the timeline. a. FCFS b. 94 c. SRT d. Round Robin (using a time quantum of 5) 8. Given the following information:

Explanation / Answer

9)a

10a)

First Come First Served Scheduling

The process that requests the cpu first is allocated the CPU first.

Managed with a FIFO queue when a process enters the ready queue, its PCB is linked to the tail of the queue and when the cpu is free, it is allocated to the process at the head of the queue.

Process

Burst time

Arrival Time

Starting Time

Waiting Time

Finishing Time

Turnaround Time

P1

10

0

0

0

10

10

P2

29

0

10

10

39

39

P3

3

0

39

39

42

42

P4

7

0

42

42

49

49

P5

12

0

49

49

61

61

P1

P2

P3

P4

P5

Gantt Chart:

0                       10                         39                        42                         49                   61

Avg waiting time=(0+10+39+42+49)/5=28

Avg Turnaround time=(10+39+42+49+61)/5=40.2

9) b

10)b)

Shortest Job Next(SJN)

  

It is also known as Shortest Job First(SJF) or Shortest Process Next(SPN) .

It selects the waiting process with the smallest execution time to execute next.SJN is non preemptive algorithm. it minimizes the average amount of time each process has to wait until its execution is complete

It has the potential for process starvation which will require a long time to complete if short processes are continually added. Highest response ration next is similar but provides a solution to this problem.

Another disadvantage of using shortest job next is that the total execution time of a job must be known before execution. While it is not possible to perfectly predict execution time, several methods can be used to estimate the execution time for a job, such as a weighted average of previous execution times.

Shortest job next can be effectively used with interactive processes which generally follow a pattern of alternating between waiting for a command and executing it. If the execution burst of a process is regarded as a separate "job", past behaviour can indicate which process to run next, based on an estimate of its running time.

Shortest job next is used in specialized environments where accurate estimates of running time are available. Estimating the running time of queued processes is sometimes done using a technique called aging..

The Gantt chart is:

P2

P1

P3

P4

P0

                       0    10           30           50              100           180

Average waiting time calculation:

Waiting time for process

p0 = 0 sec.

p1 =10 sec

p2 = 30 sec.

p3 = 50 sec.

p4 = 100 sec.

Therefore, the average waiting time is = (0+10+30+50+100)/5=38

c) Shortest remaining time first(SRT)

It selects the process for executing which has the smallest amount of time remaining until completion. SRT algorithm may lead to starvation.If the short processes are continually added to the cpu scheduler than the currently running process will never be able to execute, hence SRT is not starvation free.

Process

Burst time

Arrival time

Start time

Wait time

Finish time

Turnaround time

1

8

0

0

9

17

17

2

4

1

1

0

5

4

3

9

2

17

15

26

24

4

5

3

5

2

10

7

Gantt Chart

P1

P2

P4

P1

P3

   0                1                      5                       10                    17                                    26

9) d

10) d) Round Robin

   

(q = 10):

Process

Burst Time

Arrival

Start

Wait

Finish

TA

1

10

0

0

0

10

10

2

29

0

10

32

61

61

3

3

0

20

20

23

23

4

7

0

23

23

30

30

5

12

0

30

40

52

52

Gantt chart:



average waiting time: (0+32+20+23+40)/5 = 23

average turnaround time: (10+39+42+49+61)/5 = 35.2

Process

Burst time

Arrival Time

Starting Time

Waiting Time

Finishing Time

Turnaround Time

P1

10

0

0

0

10

10

P2

29

0

10

10

39

39

P3

3

0

39

39

42

42

P4

7

0

42

42

49

49

P5

12

0

49

49

61

61

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