Presentiaon task sheduling first come first serve FCFS

7
ن الرحيم الرحم بسمElmashreq University Faculty of engineering Electronics engineering dept Prepared by: supervisor: 1.

Transcript of Presentiaon task sheduling first come first serve FCFS

Page 1: Presentiaon  task sheduling first come first serve FCFS

بسم هللا الرحمن الرحيم

Elmashreq University Faculty of engineering

Electronics engineering dept

Prepared by: supervisor:

1.

Page 2: Presentiaon  task sheduling first come first serve FCFS

Introduction:Process that requests the CPU FIRST is allocated the CPU FIRST.

It’s simplest to understand and the simplest to implement .

Other names of this algorithm are:

• First-In-First-Out (FIFO) .

• Run-to-Completion .

• Run-Until-Done .

This is a non-preemptive algorithm.

Example on real life such as: Buying tickets !

Example on computer system likes: sharing printers.

Implementation:

• FIFO queues.

• A new process enters the tail of the queue.

• The schedule selects from the head of the queue.

Page 3: Presentiaon  task sheduling first come first serve FCFS
Page 4: Presentiaon  task sheduling first come first serve FCFS

Scheduling Algorithms: First-Come, First-Served (FCFS)

• Example: Three processes arrive in order P1, P2, P3.

– P1 burst time: 24

– P2 burst time: 3

– P3 burst time: 3

• Waiting Time

– P1: 0

– P2: 24

– P3: 27

• Completion Time:

– P1: 24

– P2: 27

– P3: 30

• Average Waiting Time: (0+24+27)/3 = 17

• Average Completion Time: (24+27+30)/3 = 27

P1 P2 P3

0 24 27 30

Page 5: Presentiaon  task sheduling first come first serve FCFS

Problems with FCFS:o Non-preemptive.

o Not optimal AWT.

Cannot utilize resources in parallel:

• Assume 1 process CPU bounded and many I/O bounded processes.

result: Convoy effect, low CPU and I/O Device utilization.

a convoy effect happens when a set of processes need to use a resource for a short time, and one process holds the resource for a long time, blocking all of the other processes. Essentially, it causes poor utilization of the other resources in the system.

Page 6: Presentiaon  task sheduling first come first serve FCFS

Advantages and Disadvantages:Advantages:

• simple

• easy to understand

• first come, first served

Disadvantages:

• Non-preemptive, that is, the process will run until it finishes.

• short processes which are at the back of the queue have to wait for the long process at the front to finish.

• Not good for time sharing systems.

• Because of its simplicity, FCFS is not very efficient.

Page 7: Presentiaon  task sheduling first come first serve FCFS