 I am Majid Gundale, assistant professor at Walchin Institute of Technology, Solapur. In this lecture, we are going to just focus on the different scheduling algorithms and one of the very early algorithm is named as the first come and first serve process scheduling algorithm. In the operating system, scheduling is one of the very important criteria because that decides the efficiency of the CPU. So, we are going to justify that kind of point in this discussion, how we are going to provide a proper efficiency of execution to the CPU. And in this lecture, we are going to focus on the working principle of FCFS which is called as the first come first serve principle and second we are trying to evaluate its performance. Now, friend, in today's lectures, we are going to just talk on all this kind of points that is degree of multi-programming, then what is a role of CPU scheduler, then how we are going to define the working of FCFS scheduling algorithm and we are just trying to focus on how to find out the performance parameters of this FCFS algorithm. First we just focus on a simple term which is called degree of multi-programming, friend when this term is talking about multi-programming, but we consider the different processes we consider during execution. So, friend, the degree of multi-programming describes the maximum number of processes at a single process can execute and this process can be executed quite efficiently or we can say otherwise we can accommodate number of processes for a single processor and that can be executed by that processor effectively. So, friend, normally the operating system tries to increase the degree of multi-programming, it means that we are just going to provide number of processes for execution for the given CPU. So, that we have to call different processes in proper sequencing and we have to feed those processes to the processor so that we can achieve the higher degree of multi-programming. Now, friend, again question come, who is going to bring this process from the memory? In fact, we are going to store all these processes in the secondary memory. So, it is a scheduler which is helping us to bring this process from the secondary memory into the main memory. So friend, we also call this main memory as either RAM or this also can be called in our conventional talk as a ready queue. Now, moreover, this one more thing to be again rethink here, while bringing all these processes for execution in ready queue, we have to always consider some balance between the IO-bond processes and the CP-bond processes so that we can ensure the CP will provide me or us a very high efficiency of execution there. As I said earlier, the processes we are loading them in the main memory, this also can be called as a ready queue. And from ready queue, we are going to put these processes in the running queue. Now friend, here we are just going to talk about how we describe the working of this FCFS algorithm. So friend is quite simple to describe, it is one of the simplest of the algorithm we can have in the practice. So we can say here the processes to be executed are arranged in a sequence. In some memory part, this also can be called as a queue there. So we first decide in which proper sequence we execute all these processes and those process are brought into some memory and we are going to make them to be stored in the proper sequence here. And this corresponding queue is normally called as the job queue and we are going to supply all these processes in proper sequence from the job queue to the ready queue. What is ready queue? Friend, this is nothing but a RAM we can say. Now in this principle of this FCFS, we are going to send the process to the ready queue in some sequence. Now the sending sequence from job queue to the ready queue is in this way. So we send these processes from job queue to ready queue in that sequence in which they are coming to the job queue here. That is which process comes early in the job queue will be sent early into the ready queue here. So it is simply called as a first come and first serve basis there. Now friend in this case this one vital thing to be noted here is that we are to always note down the instance at which the process is arriving in the job queue and also we are going to send that process from job queue into the ready queue. So this time is marked by the OS here very critically because based upon that time of arrival we are going to schedule all this execution of the processes in the system. So friend this is something that I can describe in the simple way as I said earlier we are going to store all the processes in the secondary memory. This can be also hard disk here. Then as we decide to execute some processes from the secondary memory first I will locate those in the secondary memory then I will pull them from the secondary memory into some queue which is called as a job pool or job also queue and then in the same sequence we put those processes into the ready queue. So friend below a small figure shows you the processes how we store in the ready queue that is in the case of RAM. So friend at the bottom I am just showing you some of the numbers there. So 0 1 2 3 4 so at 0 time I am just going to pull the process from secondary memory into the job queue then to the ready queue and so on. So the 0 1 2 3 and 4 are those instances at which I am going to send these processes into the ready queue. So from this simple table we can say that the process one arrives in the ready queue early compared with this P2, P2 coming earlier than this P3, P3 also comes before P4 and so on. So this marks the time of arrival in this ready queue. Friend again I will describe here because how these processes are brought here from the secondary memory to the main memory here. So first we are going to allocate the processes here into the running queue then we are going to put these processes from ready queue into running queue because running queue nothing but the CPU we can say. Then this switching of a process is done properly. So switches process from waiting to ready queue suppose sometimes I have put the process in the running queue here and suppose he do not get required resources from the operating system here. So he is waiting for getting that resources free. So friend in that case I will not hold the CPUs execution here but what do I will force these processes which are in now running queue and they will send out to some other queue so that they can wait for getting other resources for their execution there. Then after finishing all this execution in the CPU we are going to terminate this process execution. So friend these are simple jobs of the scheduler we use in the case of FCFS. Friend this example is showing you a simple explanation that how we can evaluate the performance of this FCFS here. So friend this is a chart or a table that shows you the process P1, P2, P3, P4 they are arriving in some sequence here. The example says that they arrive in the given sequence that is P1 come first then P2 then P3 and P4. In the second column they are denoting the burst time which how much time the process takes for execution once that enters in the running queue. So P1 has got burst of 20, P2 is having burst of 4 and so on. So we know here friend in this FCFS we are going to use one parameter which is called the waiting time because the process arrives in the ready queue but he will not get permission to enter in the running queue for some time because CPU is having some running execution of some process. So even process is ready in ready queue here it will not get a chance to enter in the given CPU so as to wait for some time. So this waiting time is a figure of merit that will justify the performance of FCFS. So friend here I am just going to just show you how we are going to pull the process from ready queue to the running queue. So I say here the P1 is entered initially in ready queue at 0 millisecond then the P2 is entering in the CPU will be at 20 millisecond why? Because P1 once enter in the running queue he will not leave the CPU until that get executed completely here. So friend this is a chart which is called as a Gantt chart here that shows you the sequencing of a process of execution. So friend in this case we are going to use a principle which is called first come and first serve. So the bottom table shows you the two rows that one shows you the time of completion and from this we are going to find out the waiting time from the given Gantt chart here. So friend the waiting time for this process P1 is 0 because when it enters in the ready queue he get a chance to enter in the given running queue then P2 will get chance to enter in this running queue at the 20 millisecond here and so on. So friend to find this performance evaluation of this FCFS we are normally finding the average waiting time for all the processes. So here I am going to sum up the waiting time for this P1, P2, P3, P4. So sum is coming as 20 plus 24 plus 32 plus 0 upon 4 that comes to be 90 millisecond here. So friend this is a performance evaluation of this FCFS. Normally we should get less value here of this parameter. Here we are going to just mention some of the basic properties of this FCFS. FCFS normally called to be non-preemptive scheduling algorithm because once process enters in the CPU we cannot hold the CPU execution means we execute this process completely and then we can send other process in the CPU for execution. Then scheduling find to be very simple this also shows some drawbacks here. Now the biggest drawback we are finding is that the smaller process are suffering from longer waiting time. Friend this is normally called a starvation here. So friend this is the biggest drawback in the FCFS which is called the starvation. So friend this is something regarding this FCFS in a brief and thank you for listening. And one more thing is that this FCFS also is having some sort of mis-distribution between the IO1 processes and the CP1 processes because it is not able to provide a proper balance between this process selection here. So friend this is a drawback of this FCFS. Thank you friend for listening this video and hope this video is helping you to understand some basic concepts. Thank you for listening.