Name: Omofade Olusegun Matriculation number: 13/SCI01/018 Department: Computer Science College: Science Date: 21/12/2014 Course: CSC 203 Course lecturer: Mrs. Gbemisola Balalola GROUP 1 Table of Contents: Page 1.0 Introduction 2 1.1 Definition 3 1.2 Merits and Demits 4 1.3 My analogy 5 1.4 Examples 6 1.4.1 Example 1 1.4.2 Example 2 1.4.3 Exampl3 3 1.5 Summary 9 1.6 References 9 FIRST COME, FIRST SERVE. Topic: 1.0 Introduction: The first come, first served (commonly called FIFO ‒ first in, first out) processscheduling algorithm is the simplest process-scheduling algorithm. The FirstCome-First-Served algorithm is rarely used as a master scheme in modern operating systems but it is often embedded within other schemes. It is used in Batch Processing. Other names of this algorithm are: First-In-First-Out (FIFO) Run-to-Completion 2 Run-Until-Done 1.1 Definition: What does first come, first served (FCFS) mean? First come, first served (FCFS) is an operating system process scheduling algorithm mechanism that automatically executes queued requests and processes by the order of their arrival. With first come, first served, what comes first is handled first; the next request in line will be executed once the one before it is complete. 3 The first operation is processed; the next process in queue is handled once the one before is complete. FCFS is very simple - Just a FIFO queue, like customers waiting in line at the bank or the post office or at a copying machine. 1.2 Merits and demerits: Perhaps, First-Come-First-Served algorithm is the simplest scheduling algorithm is the simplest scheduling algorithm. Processes are dispatched according to their arrival time on the ready queue. Being a non-preemptive discipline, once a process has a CPU, it runs to completion. The FCFS scheduling is fair in the formal sense or human sense of fairness but it is unfair in the sense that long jobs make short jobs wait and unimportant jobs make important jobs wait. FCFS is more predictable than most of other schemes since it offers time. FCFS scheme is not useful in scheduling interactive users because it cannot guarantee good response time. The code for FCFS scheduling is simple to write and understand. Advantages/Merits: 4 Easy to understand FIFO scheduling is simple to implement. It is also intuitively fair (the first one in line gets to run first). It is the simplest CPU scheduling algorithm. Disadvantages/Demerits: This scheduling method is non preemptive, that is, the process will run until it finishes. Because of this non-preemptive scheduling, It is not suitable for interactive jobs. In addition, short processes, which are at the back of the queue, have to wait for the long process at the front to finish execution. Which mean that a long-running process will delay all jobs behind it. The average waiting time under FCFS is long. 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. 5 FCFS can also block the system in a busy dynamic system in another way, known as the convoy effect. When one CPU intensive process blocks the CPU, a number of I/O intensive processes can get backed up behind it, leaving the I/O devices idle. When the CPU hog finally relinquishes the CPU, then the I/O processes pass through the CPU quickly, leaving the CPU idle while everyone queues up for I/O, and then the cycle repeats itself when the CPU intensive process gets back to the ready queue. FCFS can also block the system in a busy dynamic system in another way, known as the convoy effect. When one CPU intensive process blocks the CPU, a number of I/O intensive processes can get backed up. In general, a convoy effect happens when a se 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. 1.3 My analogy of FCFS: An example is to use a printer; several documents are to be printed from a computer system, which are sent to the printer. The printer queues the documents to be printed upon arrival and prints the first document that arrived following the others in line. Steps: 6 1. Here the “Open Printer Queue” button is selected. 2. Here 3 Documents are sent to the printer to be printed. 3. Here the 3 documents are printed by First come, first serve. ORDER OF EXECUTION 1 7 2 3 Explanation: The first document (OPERATION) OMOFADE SEGUN.docx is printed first (EXECUTED), following is the second Document (OPERATION) Document 1 which is printed (EXECUTED) after the completion of the printing of the document before it, lastly to be printed (EXECUTED) is the document (OPERATION) TRAVERSING OF AN ARRAY.docx which comes last in order. 1.4 Examples: Let's take a look at how FCFS process scheduling works. 1.4.1 Example 1: 8 Suppose there are three processes in a queue: P1, P2 and P3. P1 is placed in the processing register with a waiting time of zero seconds and 10 seconds for complete processing. The next process, P2, must wait 10 seconds and is placed in the processing cycle until P1 is processed. Assuming that P2 will take 15 seconds to complete, The final process, P3, must wait 25 seconds to be processed. In first come first serve scheduling the jobs are served in the order they arrive. 1.4.2 Example 2: Let’s make a diagrammatic representation of how the jobs will look in a relative time scale. Since Job A was the first one to arrive so Job A is scheduled first. At time t=5, job A finishes its execution. The second job to arrive was job B so job B is scheduled then and so on till all the jobs execute and exit. This is represented graphically as shown below: This graphical representation of the execution of jobs is called a Gantt chart. FCFS may not be the fastest process-scheduling algorithm, as it does not check for priorities associated with processes. These priorities may depend on the processes' individual execution times. 9 1.4.3: a. b. 10 Possibly the most straightforward approach to scheduling processes is to maintain a FIFO (first-in, first-out) run queue. New processes go to the end of the queue. When the scheduler needs to run a process, it picks the process that is at the head of the queue. The scheduler is non-preemptive. If the process has to block on I/O, it enters the waiting state and the scheduler picks the process from the head of the queue. When I/O is complete and the process is ready to run again, it gets put at the end of the queue. 11 1.5 Summary: FCFS provides an efficient, simple and error-free process-scheduling algorithm that saves valuable CPU resources. It uses non-preemptive scheduling in which a process is automatically queued and processing occurs according to an incoming request or process order. FCFS derives its concept from real-life customer service where the first person is attended to following the second person and so on. In FCFS, a process that arrives first will be served first. When it arrives at the same time, the services performed by the order they are in the queue. It does not matter whether they are short or a long process. To be able to be serviced by the processor, process the queue behind must wait until all processes carried out in front of it completed. 1.6 References: http://naharhasyim.blogspot.com/2013/03/algorithm-first-come-firstserved.html http://www.os-concepts.thiyagaraaj.com/scheduling-algorithms/firstcome-first-served--fcfs--scheduling http://tanmayonrun.blogspot.com/2011/12/explain-and-solve-firstcome-first.html http://www.tutorialspoint.com/operating_system/os_process_schedul ing_algorithms.htm http://www.gitam.edu/eresource/comp/gvr(os)/5.3.htm http://en.wikipedia.org/wiki/Scheduling_(computing) 12 Merry Christmas. 13
© Copyright 2026 Paperzz