{"id":11420,"date":"2022-12-26T12:14:26","date_gmt":"2022-12-26T12:14:26","guid":{"rendered":"https:\/\/www.prepbytes.com\/blog\/?p=11420"},"modified":"2023-05-11T13:14:04","modified_gmt":"2023-05-11T13:14:04","slug":"fcfs-scheduling-program-in-c","status":"publish","type":"post","link":"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/","title":{"rendered":"FCFS Scheduling Program in C"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672056121546-FCFS%20Scheduling%20Program%20in%20C.jpg\" alt=\"\" \/><\/p>\n<p>In this article, we will look at FCFS, which stands for First Come First Serve Scheduling Algorithm. Furthermore, we will understand how the scheduling algorithm works as well as code it from scratch, and terminologies related to the First Come, First Serve Scheduling Algorithm will be discussed. In interviews, FCFS is one of the most frequently asked questions about Operating Systems topics. Students can answer any conceptual question in interviews by focusing on the code and algorithm used in this article on the FCFS Scheduling Program in C.<\/p>\n<h2>What is FCFS Scheduling?<\/h2>\n<p>The CPU assigns tasks using a non-preemptive scheduling algorithm called First Come, First Serve. As the name implies, it prioritizes tasks based on the request that was made first.<br \/>\nNo preemption ensures that no job takes over a job that is already in progress, and the processes are executed in a queue-like fashion.<\/p>\n<p>Queues can be a viable data structure to assume the function of people at the end going out and entering from the back, waiting for their turn. Similarly, when a process requires CPU, it is placed at the end of the queue, and each process is completed one at a time, leaving the queue from the front until no processes remain and the queue is empty.<\/p>\n<p>When idle, the CPU is assigned to the queue&#8217;s head, and when the process enters the FIFO queue, the PCB is attached to the queue&#8217;s tail.<\/p>\n<h3>Terminologies Related to FCFS<\/h3>\n<ol>\n<li>\n<p><strong>Burst Time &#8211;<\/strong> The total time elapsed to execute a process is known as burst time.<\/p>\n<\/li>\n<li>\n<p><strong>Turnaround Time &#8211;<\/strong> The summation of waiting time and burst time results in turnaround time. It is the total time that a process takes right after its arrival in the queue.<\/p>\n<pre><code>Turnaround Time = Waiting Time + Burst Time<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>Waiting Time &#8211;<\/strong> The difference between the Start Time and Arrival Time can be classified as the waiting time.<\/p>\n<\/li>\n<li>\n<p><strong>Average Waiting Time<\/strong> &#8211; The sum of all the waiting times by the total number of processes can be stated as Average Waiting Time.<\/p>\n<\/li>\n<\/ol>\n<h3>Dry Run of FCFS Program in C using an Example<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672056121664-FCFS%20Scheduling%20Program%20in%20C1.png\" alt=\"\" \/><\/p>\n<p>Suppose there is a process queue, Process A enters at first with a burst time of 5 seconds. Process B enters at 3rd second with a burst time of  6 seconds. Process C enters at 8th second with a burst time of 2 seconds.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672056121665-FCFS%20Scheduling%20Program%20in%20C2.png\" alt=\"\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672056121665-FCFS%20Scheduling%20Program%20in%20C3.png\" alt=\"\" \/><\/p>\n<p>Process A will finish at 5th second and Process B will be assigned CPU at 5th second. After 2 seconds of waiting in the queue, it will finish its execution at 11th second.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672056121665-FCFS%20Scheduling%20Program%20in%20C4.png\" alt=\"\" \/><\/p>\n<p>If Process B completes at the 11th second and Process C enters the queue at the 8th second, the waiting time can be calculated by subtracting the arrival time, i.e. 8, from the starting time, i.e. 11, which equals 3 seconds.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672056121665-FCFS%20Scheduling%20Program%20in%20C5.png\" alt=\"\" \/><\/p>\n<p>Process C is completed at the 13th second because its burst time is 2 seconds.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672056121695-FCFS%20Scheduling%20Program%20in%20C6.png\" alt=\"\" \/><\/p>\n<h3>Pseudocode of the FCFS Scheduling Algorithm<\/h3>\n<ul>\n<li>Create a queue to get the requests or processes that must be stored to execute.<\/li>\n<li>On the arrival of a new process, it is placed at the end of the queue.<\/li>\n<li>If the CPU is idle, assign the request or process at the front of the queue to the CPU for processing.<\/li>\n<li>But in case the CPU is busy, wait until the current process is finished processing.<\/li>\n<li>As the execution of the current process is done, it is removed from the FIFO queue, and the next process at the front of the queue is put forward for execution.<\/li>\n<li>Repeat steps 3 to 5 until all processes have been serviced.<\/li>\n<\/ul>\n<h3>Code Implementation of FCFS Program in C<\/h3>\n<p>The preceding heading, Algorithm to FCFS Scheduling Program in C, explains how to create the FCFS Scheduling program.<\/p>\n\t\t\t\t\t\t<style>\r\n\t\t\t\t\r\n\t\t\t\t\t#tab_container_11349 {\r\n\toverflow:hidden;\r\n\tdisplay:block;\r\n\twidth:100%;\r\n\tborder:0px solid #ddd;\r\n\tmargin-bottom:30px;\r\n\t}\r\n\r\n#tab_container_11349 .tab-content{\r\n\tpadding:20px;\r\n\tborder: 1px solid #e6e6e6 !important;\r\n\tmargin-top: 0px;\r\n\tbackground-color:#ffffff !important;\r\n\tcolor: #000000 !important;\r\n\tfont-size:16px !important;\r\n\tfont-family: Open Sans !important;\r\n\t\r\n\t\tborder: 1px solid #e6e6e6 !important;\r\n\t}\r\n#tab_container_11349 .wpsm_nav-tabs {\r\n    border-bottom: 0px solid #ddd;\r\n}\r\n#tab_container_11349 .wpsm_nav-tabs > li.active > a, #tab_container_11349 .wpsm_nav-tabs > li.active > a:hover, #tab_container_11349 .wpsm_nav-tabs > li.active > a:focus {\r\n\tcolor: #000000 !important;\r\n\tcursor: default;\r\n\tbackground-color: #ffffff !important;\r\n\tborder: 1px solid #e6e6e6 !important;\r\n}\r\n\r\n#tab_container_11349 .wpsm_nav-tabs > li > a {\r\n    margin-right: 0px !important; \r\n    line-height: 1.42857143 !important;\r\n    border: 1px solid #d5d5d5 !important;\r\n    border-radius: 0px 0px 0 0 !important; \r\n\tbackground-color: #e8e8e8 !important;\r\n\tcolor: #000000 !important;\r\n\tpadding: 15px 18px 15px 18px !important;\r\n\ttext-decoration: none !important;\r\n\tfont-size: 14px !important;\r\n\ttext-align:center !important;\r\n\tfont-family: Open Sans !important;\r\n}\r\n#tab_container_11349 .wpsm_nav-tabs > li > a:focus {\r\noutline: 0px !important;\r\n}\r\n\r\n#tab_container_11349 .wpsm_nav-tabs > li > a:before {\r\n\tdisplay:none !important;\r\n}\r\n#tab_container_11349 .wpsm_nav-tabs > li > a:after {\r\n\tdisplay:none !important ;\r\n}\r\n#tab_container_11349 .wpsm_nav-tabs > li{\r\npadding:0px !important ;\r\nmargin:0px;\r\n}\r\n\r\n#tab_container_11349 .wpsm_nav-tabs > li > a:hover , #tab_container_11349 .wpsm_nav-tabs > li > a:focus {\r\n    color: #000000 !important;\r\n    background-color: #e8e8e8 !important;\r\n\tborder: 1px solid #d5d5d5 !important;\r\n\t\r\n}\r\n#tab_container_11349 .wpsm_nav-tabs > li > a .fa{\r\n\r\nmargin-right:5px !important;\r\n\r\nmargin-left:5px !important;\r\n\r\n\r\n}\r\n\r\n\t\t#tab_container_11349 .wpsm_nav-tabs a{\r\n\t\t\tbackground-image: none;\r\n\t\t\tbackground-position: 0 0;\r\n\t\t\tbackground-repeat: repeat-x;\r\n\t\t}\r\n\t\t\t\r\n\r\n\r\n#tab_container_11349 .wpsm_nav-tabs > li {\r\n    float: left;\r\n    margin-bottom: -1px !important;\r\n\tmargin-right:0px !important; \r\n}\r\n\r\n\r\n#tab_container_11349 .tab-content{\r\noverflow:hidden !important;\r\n}\r\n\r\n\r\n@media (min-width: 769px) {\r\n\r\n\t#tab_container_11349 .wpsm_nav-tabs > li{\r\n\t\tfloat:left !important ;\r\n\t\t\t\tmargin-right:-1px !important;\r\n\t\t\t\t\t}\r\n\t#tab_container_11349 .wpsm_nav-tabs{\r\n\t\tfloat:none !important;\r\n\t\tmargin:0px !important;\r\n\t}\r\n\r\n\t#tab_container_11349 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_11349 .wpsm_nav{\r\n\t\t\t}\r\n\r\n}\r\n\r\n\r\n\r\n@media (max-width: 768px) {\r\n\t#tab_container_11349 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_11349 .wpsm_nav{\r\n\t\t\t}\r\n}\r\n\r\n\r\n\t.wpsm_nav-tabs li:before{\r\n\t\tdisplay:none !important;\r\n\t}\r\n\r\n\t@media (max-width: 768px) {\r\n\t\t\t\t\r\n\t\t\t\t.wpsm_nav-tabs{\r\n\t\t\tmargin-left:0px !important;\r\n\t\t\tmargin-right:0px !important; \r\n\t\t\t\r\n\t\t}\r\n\t\t\t\t#tab_container_11349 .wpsm_nav-tabs > li{\r\n\t\t\tfloat:none !important;\r\n\t\t}\r\n\t\t\t\r\n\t}\t\t\t\t<\/style>\r\n\t\t\t\t<div id=\"tab_container_11349\" >\r\n\t \r\n\t\t\t\t\t<ul class=\"wpsm_nav wpsm_nav-tabs\" role=\"tablist\" id=\"myTab_11349\">\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<li role=\"presentation\"  class=\"active\"  onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t<a href=\"#tabs_desc_11349_1\" aria-controls=\"tabs_desc_11349_1\" role=\"tab\" data-toggle=\"tab\">\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"fa fa-code\"><\/i> \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<span>C<\/span>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t\t<\/li>\r\n\t\t\t\t\t\t\t\t\t\t\t <\/ul>\r\n\r\n\t\t\t\t\t  <!-- Tab panes -->\r\n\t\t\t\t\t  <div class=\"tab-content\" id=\"tab-content_11349\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t <div role=\"tabpanel\" class=\"tab-pane  in active \" id=\"tabs_desc_11349_1\">\r\n\t\t\t\t\t\t\t\t<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\">#include&lt;stdio.h&gt;\r\n\r\n\/\/ Function to find the waiting time for all processes\r\nvoid WaitingTime(int process_ids[], int num_processes, \r\n                     int burst_times[], int waiting_times[])\r\n{\r\n  \r\n    waiting_times[0] = 0;\r\n   \r\n\r\n    for (int i = 1; i &lt; num_processes; i++)\r\n        waiting_times[i] =  burst_times[i-1] + waiting_times[i-1];\r\n}\r\n\r\nvoid TurnAroundTime(int process_ids[], int num_processes, \r\n                        int burst_times[], int waiting_times[], int turn_around_times[])\r\n{\r\n\r\n    for (int i = 0; i &lt; num_processes; i++)\r\n        turn_around_times[i] = burst_times[i] + waiting_times[i];\r\n}\r\n   \r\n\r\nvoid avgTime(int process_ids[], int num_processes, int burst_times[])\r\n{\r\n    int waiting_times[num_processes], turn_around_times[num_processes];\r\n    int total_waiting_time = 0, total_turn_around_time = 0;\r\n   \r\n\r\n    WaitingTime(process_ids, num_processes, burst_times, waiting_times);\r\n   \r\n\r\n    TurnAroundTime(process_ids, num_processes, burst_times, waiting_times, turn_around_times);\r\n   \r\n    printf(\"Processes   Burst time   Waiting time   Turn around time&#92;n\");\r\n  \r\n    for (int i = 0; i &lt; num_processes; i++)\r\n    {\r\n        total_waiting_time += waiting_times[i];\r\n        total_turn_around_time += turn_around_times[i];\r\n        printf(\"   %d \", (i+1));\r\n        printf(\"       %d \", burst_times[i]);\r\n        printf(\"       %d\", waiting_times[i]);\r\n        printf(\"       %d&#92;n\", turn_around_times[i]);\r\n    }\r\n    int avg_waiting_time = (float)total_waiting_time \/ (float)num_processes;\r\n    int avg_turn_around_time = (float)total_turn_around_time \/ (float)num_processes;\r\n    printf(\"Average waiting time = %d\", avg_waiting_time);\r\n    printf(\"&#92;n\");\r\n    printf(\"Average turn around time = %d \", avg_turn_around_time);\r\n}\r\n   \r\n\r\nint main()\r\n{\r\n\r\n    int process_ids[] = {1, 2, 3};\r\n    int num_processes = sizeof process_ids \/ sizeof process_ids[0];\r\n   \r\n\r\n    int burst_time[] = {5,6,2};\r\n    avgTime(process_ids, num_processes,  burst_time);\r\n    return 0;\r\n}\r\n<\/pre>\t\t\t\t\t\t <\/div>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t <\/div>\r\n\t\t\t\t\t \r\n\t\t\t\t <\/div>\r\n <script>\r\n\t\tjQuery(function () {\r\n\t\t\tjQuery('#myTab_11349 a:first').tab('show')\r\n\t\t});\r\n\t\t\r\n\t\t\t\tjQuery(function(){\r\n\t\t\tvar b=\"fadeIn\";\r\n\t\t\tvar c;\r\n\t\t\tvar a;\r\n\t\t\td(jQuery(\"#myTab_11349 a\"),jQuery(\"#tab-content_11349\"));function d(e,f,g){\r\n\t\t\t\te.click(function(i){\r\n\t\t\t\t\ti.preventDefault();\r\n\t\t\t\t\tjQuery(this).tab(\"show\");\r\n\t\t\t\t\tvar h=jQuery(this).data(\"easein\");\r\n\t\t\t\t\tif(c){c.removeClass(a);}\r\n\t\t\t\t\tif(h){f.find(\"div.active\").addClass(\"animated \"+h);a=h;}\r\n\t\t\t\t\telse{if(g){f.find(\"div.active\").addClass(\"animated \"+g);a=g;}else{f.find(\"div.active\").addClass(\"animated \"+b);a=b;}}c=f.find(\"div.active\");\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\r\n\t\tfunction do_resize(){\r\n\r\n\t\t\tvar width=jQuery( '.tab-content .tab-pane iframe' ).width();\r\n\t\t\tvar height=jQuery( '.tab-content .tab-pane iframe' ).height();\r\n\r\n\t\t\tvar toggleSize = true;\r\n\t\t\tjQuery('iframe').animate({\r\n\t\t\t    width: toggleSize ? width : 640,\r\n\t\t\t    height: toggleSize ? height : 360\r\n\t\t\t  }, 250);\r\n\r\n\t\t\t  toggleSize = !toggleSize;\r\n\t\t}\r\n\r\n\r\n\t<\/script>\r\n\t\t\t\t\r\n\t\t\t\n<p>The solution&#8217;s time complexity is O(N), and its space complexity will be O(N) as well, because auxiliary space is used in this program. <\/p>\n<h3>Applications of the FCFS Scheduling Program in C<\/h3>\n<p>Now that we&#8217;ve covered the theoretical, algorithmic, and code components of the FCFS Scheduling Program in C, let&#8217;s look at the application where the algorithm is most commonly used.<\/p>\n<ul>\n<li>The FCFS Scheduling Algorithm is mostly used in operating systems to ensure that processors perform tasks properly.<\/li>\n<li>A restaurant or drive-through is a real-world example of first come, first served, with customers who ordered first being served first.<\/li>\n<\/ul>\n<p><strong>Conclusion<\/strong><br \/>\nIn this article, we learned how FCFS works according to the FIFO principle, as well as important terminologies to know when solving problems. Keep in mind that FCFS is non-preventive, and simplistic, and the average waiting time is not optimal.<\/p>\n<p>The algorithm, code, and application of the FCFS Scheduling Algorithm are described in the following sections of the article. We hope you found this article on FCFS scheduling in C informative. I hope to see you again with another insightful article in the future.<\/p>\n<h2>Frequently Asked Questions (FAQs)<\/h2>\n<p><strong>Q1. What is an example of FCFS scheduling?<\/strong><br \/>\n<strong>Ans.<\/strong> A real-life example of the FCFS method is buying a movie ticket at the ticket counter. <\/p>\n<p><strong>Q2. What is the first come first serve FCFS scheduling program?<\/strong><br \/>\n<strong>Ans.<\/strong> First Come, First Served (FCFS) is a type of scheduling algorithm used by operating systems and networks to efficiently and automatically execute queued tasks, processes, and requests in the order of their arrival.<\/p>\n<p><strong>Q3. What is the FCFS sequencing rule?<\/strong><br \/>\n<strong>Ans.<\/strong> The five priority sequencing rules are:<\/p>\n<ul>\n<li>First come, first served (FCFS); or First in, first out (FIFO):<\/li>\n<li>Jobs are sequenced in the order in which they arrive at the workstation. <\/li>\n<li>Earliest due date (EDD): <\/li>\n<li>Jobs are sequenced in the order in which they are due for delivery to the customer. <\/li>\n<\/ul>\n<p><strong>Q4. What are the advantages of FCFS?<\/strong><br \/>\n<strong>Ans.<\/strong><\/p>\n<ul>\n<li>There is no starvation in the case of FCFS.<\/li>\n<li>It is a fair algorithm as no priority of the processes is involved. <\/li>\n<li>Easy and simple implementation. <\/li>\n<li>It follows the FIFO queue to assign processes.<\/li>\n<\/ul>\n<p><strong>Q5. What is the importance of FCFS?<\/strong><br \/>\n<strong>Ans.<\/strong> Perhaps the most obvious advantage of FCFS is in the name itself. Orders are processed in the exact order that they are placed, which serves as a straightforward and fair way of processing<\/p>\n<p><strong><a href=\"https:\/\/prepbytes.com\/blog\/c-programming\/basic-c-programs-examples\/\"><br \/>\nOther C Programs<\/a><\/strong><\/p>\n<p><a href=\"https:\/\/prepbytes.com\/blog\/c-programming\/binary-search-program-in-c\/\" title=\"C Program for Binary Search\">C Program for Binary Search<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/c-programming\/c-program-to-add-two-numbers\/\" title=\"C Program to Add Two Numbers\">C Program to Add Two Numbers<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/c-programming\/c-program-to-calculate-percentage-of-5-subjects\/\" title=\"C Program to Calculate Percentage of 5 Subjects\">C Program to Calculate Percentage of 5 Subjects<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/c-programming\/c-program-to-convert-binary-number-to-decimal-number\/\" title=\"C Program to Convert Binary Number to Decimal Number\">C Program to Convert Binary Number to Decimal Number<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/c-programming\/c-program-to-convert-celsius-to-fahrenheit\/\" title=\"C Program to Convert Celsius to Fahrenheit\">C Program to Convert Celsius to Fahrenheit<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/c-programming\/c-program-to-convert-infix-to-postfix\/\" title=\"C Program to Convert Infix to Postfix\">C Program to Convert Infix to Postfix<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/c-programming\/c-program-to-find-area-of-circle\/\" title=\"C Program to Find Area of Circle\">C Program to Find Area of Circle<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/c-programming\/c-program-to-find-roots-of-quadratic-equation\/\" title=\"C Program to Find Roots of Quadratic Equation\">C Program to Find Roots of Quadratic Equation<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/c-programming\/c-program-to-reverse-a-linked-list\/\" title=\"C program to Reverse a Linked List\">C program to Reverse a Linked List<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/c-programming\/c-program-to-reverse-a-number\/\" title=\"C program to reverse a number\">C program to reverse a number<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/c-programming\/c-program-to-sort-an-array-in-ascending-order\/\" title=\"Ascending Order Program in C\">Ascending Order Program in C<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/c-programming\/menu-driven-program-for-all-operations-on-doubly-linked-list-in-c\/\" title=\"Menu Driven Program For All Operations On Doubly Linked List in C\">Menu Driven Program For All Operations On Doubly Linked List in C<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/c-programming\/what-is-the-program-of-armstrong-number-in-c\/\" title=\"C Program for Armstrong Number\">C Program for Armstrong Number<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/linked-list\/c-program-for-merge-sort-for-linked-lists\/\" title=\"C Program For Merge Sort For Linked Lists\">C Program For Merge Sort For Linked Lists<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/linked-list\/c-program-for-performing-bubble-sort-on-linked-list\/\" title=\"C program for performing Bubble sort on Linked List\">C program for performing Bubble sort on Linked List<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/c-programming\/hello-world-program-in-c\/\" title=\"Hello World Program in C\">Hello World Program in C<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/c-programming\/perfect-number-program-in-c\/\" title=\"Perfect Number Program in C\">Perfect Number Program in C<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/c-programming\/leap-year-program-in-c\/\" title=\"Leap Year Program in C\">Leap Year Program in C<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/c-programming\/odd-even-program-in-c\/\" title=\"Odd Even Program in C\">Odd Even Program in C<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/c-programming\/selection-sort-program-in-c\/\" title=\"Selection Sort Program in C\">Selection Sort Program in C<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/c-programming\/linear-search-program-in-c\/\" title=\"Linear Search Program in C\">Linear Search Program in C<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/c-programming\/while-loop-program-in-c\/\" title=\"While Loop Program in C\">While Loop Program in C<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/c-programming\/c-program-to-swap-two-numbers\/\" title=\"C Program to Swap Two Numbers\">C Program to Swap Two Numbers<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/c-programming\/calculator-program-in-c-language\/\" title=\"Calculator Program in C Language\">Calculator Program in C Language<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/c-programming\/simple-interest-program-in-c\/\" title=\"Simple Interest Program in C\">Simple Interest Program in C<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/c-programming\/compound-interest-program-in-c\/\" title=\"Compound Interest Program in C\">Compound Interest Program in C<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/c-programming\/priority-scheduling-program-in-c\/\" title=\"Priority Scheduling Program in C\">Priority Scheduling Program in C<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/c-programming\/doubly-linked-list-program-in-c\/\" title=\"Doubly Linked List Program in C\">Doubly Linked List Program in C<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we will look at FCFS, which stands for First Come First Serve Scheduling Algorithm. Furthermore, we will understand how the scheduling algorithm works as well as code it from scratch, and terminologies related to the First Come, First Serve Scheduling Algorithm will be discussed. In interviews, FCFS is one of the most [&hellip;]<\/p>\n","protected":false},"author":52,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[2],"tags":[],"class_list":["post-11420","post","type-post","status-publish","format-standard","hentry","category-c-programming"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>FCFS Scheduling Program in C<\/title>\n<meta name=\"description\" content=\"Understand how FCFS scheduling algorithm works along with coding from scratch and terminologies related to First Come First Serve Scheduling Algorithm.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"FCFS Scheduling Program in C\" \/>\n<meta property=\"og:description\" content=\"Understand how FCFS scheduling algorithm works along with coding from scratch and terminologies related to First Come First Serve Scheduling Algorithm.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/\" \/>\n<meta property=\"og:site_name\" content=\"PrepBytes Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prepbytes0211\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-12-26T12:14:26+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-05-11T13:14:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672056121546-FCFS%20Scheduling%20Program%20in%20C.jpg\" \/>\n<meta name=\"author\" content=\"Prepbytes\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Prepbytes\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/\"},\"author\":{\"name\":\"Prepbytes\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e\"},\"headline\":\"FCFS Scheduling Program in C\",\"datePublished\":\"2022-12-26T12:14:26+00:00\",\"dateModified\":\"2023-05-11T13:14:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/\"},\"wordCount\":1197,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/43.205.93.38\/#organization\"},\"image\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672056121546-FCFS%20Scheduling%20Program%20in%20C.jpg\",\"articleSection\":[\"C Programming\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/\",\"url\":\"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/\",\"name\":\"FCFS Scheduling Program in C\",\"isPartOf\":{\"@id\":\"http:\/\/43.205.93.38\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672056121546-FCFS%20Scheduling%20Program%20in%20C.jpg\",\"datePublished\":\"2022-12-26T12:14:26+00:00\",\"dateModified\":\"2023-05-11T13:14:04+00:00\",\"description\":\"Understand how FCFS scheduling algorithm works along with coding from scratch and terminologies related to First Come First Serve Scheduling Algorithm.\",\"breadcrumb\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/#primaryimage\",\"url\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672056121546-FCFS%20Scheduling%20Program%20in%20C.jpg\",\"contentUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672056121546-FCFS%20Scheduling%20Program%20in%20C.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/43.205.93.38\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C Programming\",\"item\":\"https:\/\/prepbytes.com\/blog\/category\/c-programming\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"FCFS Scheduling Program in C\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/43.205.93.38\/#website\",\"url\":\"http:\/\/43.205.93.38\/\",\"name\":\"PrepBytes Blog\",\"description\":\"ONE-STOP RESOURCE FOR EVERYTHING RELATED TO CODING\",\"publisher\":{\"@id\":\"http:\/\/43.205.93.38\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/43.205.93.38\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"http:\/\/43.205.93.38\/#organization\",\"name\":\"Prepbytes\",\"url\":\"http:\/\/43.205.93.38\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp\",\"contentUrl\":\"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp\",\"width\":160,\"height\":160,\"caption\":\"Prepbytes\"},\"image\":{\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/prepbytes0211\/\",\"https:\/\/www.instagram.com\/prepbytes\/\",\"https:\/\/www.linkedin.com\/company\/prepbytes\/\",\"https:\/\/www.youtube.com\/channel\/UC0xGnHDrjUM1pDEK2Ka5imA\"]},{\"@type\":\"Person\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e\",\"name\":\"Prepbytes\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g\",\"caption\":\"Prepbytes\"},\"url\":\"https:\/\/prepbytes.com\/blog\/author\/gourav-jaincollegedekho-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"FCFS Scheduling Program in C","description":"Understand how FCFS scheduling algorithm works along with coding from scratch and terminologies related to First Come First Serve Scheduling Algorithm.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/","og_locale":"en_US","og_type":"article","og_title":"FCFS Scheduling Program in C","og_description":"Understand how FCFS scheduling algorithm works along with coding from scratch and terminologies related to First Come First Serve Scheduling Algorithm.","og_url":"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/","og_site_name":"PrepBytes Blog","article_publisher":"https:\/\/www.facebook.com\/prepbytes0211\/","article_published_time":"2022-12-26T12:14:26+00:00","article_modified_time":"2023-05-11T13:14:04+00:00","og_image":[{"url":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672056121546-FCFS%20Scheduling%20Program%20in%20C.jpg","type":"","width":"","height":""}],"author":"Prepbytes","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Prepbytes","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/#article","isPartOf":{"@id":"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/"},"author":{"name":"Prepbytes","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e"},"headline":"FCFS Scheduling Program in C","datePublished":"2022-12-26T12:14:26+00:00","dateModified":"2023-05-11T13:14:04+00:00","mainEntityOfPage":{"@id":"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/"},"wordCount":1197,"commentCount":0,"publisher":{"@id":"http:\/\/43.205.93.38\/#organization"},"image":{"@id":"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/#primaryimage"},"thumbnailUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672056121546-FCFS%20Scheduling%20Program%20in%20C.jpg","articleSection":["C Programming"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/","url":"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/","name":"FCFS Scheduling Program in C","isPartOf":{"@id":"http:\/\/43.205.93.38\/#website"},"primaryImageOfPage":{"@id":"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/#primaryimage"},"image":{"@id":"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/#primaryimage"},"thumbnailUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672056121546-FCFS%20Scheduling%20Program%20in%20C.jpg","datePublished":"2022-12-26T12:14:26+00:00","dateModified":"2023-05-11T13:14:04+00:00","description":"Understand how FCFS scheduling algorithm works along with coding from scratch and terminologies related to First Come First Serve Scheduling Algorithm.","breadcrumb":{"@id":"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/#primaryimage","url":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672056121546-FCFS%20Scheduling%20Program%20in%20C.jpg","contentUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672056121546-FCFS%20Scheduling%20Program%20in%20C.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/prepbytes.com\/blog\/fcfs-scheduling-program-in-c\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/43.205.93.38\/"},{"@type":"ListItem","position":2,"name":"C Programming","item":"https:\/\/prepbytes.com\/blog\/category\/c-programming\/"},{"@type":"ListItem","position":3,"name":"FCFS Scheduling Program in C"}]},{"@type":"WebSite","@id":"http:\/\/43.205.93.38\/#website","url":"http:\/\/43.205.93.38\/","name":"PrepBytes Blog","description":"ONE-STOP RESOURCE FOR EVERYTHING RELATED TO CODING","publisher":{"@id":"http:\/\/43.205.93.38\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/43.205.93.38\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"http:\/\/43.205.93.38\/#organization","name":"Prepbytes","url":"http:\/\/43.205.93.38\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/","url":"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp","contentUrl":"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp","width":160,"height":160,"caption":"Prepbytes"},"image":{"@id":"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/prepbytes0211\/","https:\/\/www.instagram.com\/prepbytes\/","https:\/\/www.linkedin.com\/company\/prepbytes\/","https:\/\/www.youtube.com\/channel\/UC0xGnHDrjUM1pDEK2Ka5imA"]},{"@type":"Person","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e","name":"Prepbytes","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g","caption":"Prepbytes"},"url":"https:\/\/prepbytes.com\/blog\/author\/gourav-jaincollegedekho-com\/"}]}},"_links":{"self":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/11420","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/users\/52"}],"replies":[{"embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/comments?post=11420"}],"version-history":[{"count":3,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/11420\/revisions"}],"predecessor-version":[{"id":16275,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/11420\/revisions\/16275"}],"wp:attachment":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/media?parent=11420"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/categories?post=11420"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/tags?post=11420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}