{"id":3238,"date":"2025-06-07T14:19:07","date_gmt":"2025-06-07T14:19:07","guid":{"rendered":"https:\/\/diznr.com\/?p=3238"},"modified":"2025-06-07T14:19:07","modified_gmt":"2025-06-07T14:19:07","slug":"day-02part-04-operating-system-for-gate-computer-first-come-first-serve-basic-fcfs-algorithms","status":"publish","type":"post","link":"https:\/\/www.reilsolar.com\/pdf\/day-02part-04-operating-system-for-gate-computer-first-come-first-serve-basic-fcfs-algorithms\/","title":{"rendered":"Day 02Part 04 &#8211; Operating system for gate computer &#8211; First come first serve basic algorithms (FCFS)"},"content":{"rendered":"<p>Day 02Part 04 &#8211; Operating system for gate computer &#8211; First come first serve basic algorithms (FCFS)<\/p>\n<p>[fvplayer id=&#8221;317&#8243;]<\/p>\n<h3 class=\"\" data-start=\"0\" data-end=\"60\"><strong data-start=\"4\" data-end=\"58\">First Come First Serve (FCFS) Scheduling Algorithm<\/strong><\/h3>\n<h4 class=\"\" data-start=\"62\" data-end=\"85\"><strong data-start=\"67\" data-end=\"83\">Introduction<\/strong><\/h4>\n<p class=\"\" data-start=\"86\" data-end=\"307\"><strong data-start=\"86\" data-end=\"119\">First Come First Serve (FCFS)<\/strong> is the <strong data-start=\"127\" data-end=\"139\">simplest<\/strong> CPU scheduling algorithm, where the process that arrives <strong data-start=\"197\" data-end=\"206\">first<\/strong> in the ready queue gets executed <strong data-start=\"240\" data-end=\"249\">first<\/strong>. It follows the <strong data-start=\"266\" data-end=\"296\">FIFO (First In, First Out)<\/strong> principle.<\/p>\n<h4 class=\"\" data-start=\"314\" data-end=\"349\"><strong data-start=\"319\" data-end=\"347\">Characteristics of FCFS:<\/strong><\/h4>\n<p class=\"\" data-start=\"350\" data-end=\"701\"><strong data-start=\"352\" data-end=\"371\">Non-Preemptive:<\/strong> Once a process starts execution, it cannot be stopped until it completes.<br data-start=\"445\" data-end=\"448\" \/><strong data-start=\"450\" data-end=\"470\">Simple and Easy:<\/strong> The implementation is straightforward using a queue.<br data-start=\"523\" data-end=\"526\" \/><strong data-start=\"528\" data-end=\"541\">Fairness:<\/strong> Every process gets CPU time based on arrival order.<br data-start=\"593\" data-end=\"596\" \/><strong data-start=\"598\" data-end=\"614\">Not Optimal:<\/strong> High waiting time due to the <strong data-start=\"644\" data-end=\"661\">Convoy Effect<\/strong> (slower processes delay faster ones).<\/p>\n<h4 class=\"\" data-start=\"708\" data-end=\"746\"><strong data-start=\"713\" data-end=\"744\">Example of FCFS Scheduling:<\/strong><\/h4>\n<p class=\"\" data-start=\"747\" data-end=\"821\">Let&#8217;s consider <strong data-start=\"762\" data-end=\"777\">3 processes<\/strong> with the following arrival and burst times:<\/p>\n<div class=\"overflow-x-auto contain-inline-size\">\n<table data-start=\"823\" data-end=\"1019\">\n<thead data-start=\"823\" data-end=\"862\">\n<tr data-start=\"823\" data-end=\"862\">\n<th data-start=\"823\" data-end=\"833\">Process<\/th>\n<th data-start=\"833\" data-end=\"848\">Arrival Time<\/th>\n<th data-start=\"848\" data-end=\"862\">Burst Time<\/th>\n<\/tr>\n<\/thead>\n<tbody data-start=\"903\" data-end=\"1019\">\n<tr data-start=\"903\" data-end=\"941\">\n<td>P1<\/td>\n<td>0 ms<\/td>\n<td>5 ms<\/td>\n<\/tr>\n<tr data-start=\"942\" data-end=\"980\">\n<td>P2<\/td>\n<td>1 ms<\/td>\n<td>3 ms<\/td>\n<\/tr>\n<tr data-start=\"981\" data-end=\"1019\">\n<td>P3<\/td>\n<td>2 ms<\/td>\n<td>8 ms<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p class=\"\" data-start=\"1021\" data-end=\"1073\"><strong data-start=\"1024\" data-end=\"1071\">Step-by-Step Execution Order (Gantt Chart):<\/strong><\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary\">\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre\">| P1  | P2  | P3  |<br \/>\n0     5     8    16<br \/>\n<\/code><\/div>\n<\/div>\n<h4 class=\"\" data-start=\"1128\" data-end=\"1160\"><strong data-start=\"1133\" data-end=\"1158\">Calculations in FCFS:<\/strong><\/h4>\n<p class=\"\" data-start=\"1161\" data-end=\"1191\"><strong data-start=\"1161\" data-end=\"1189\">1. Completion Time (CT):<\/strong><\/p>\n<ul data-start=\"1195\" data-end=\"1297\">\n<li class=\"\" data-start=\"1195\" data-end=\"1226\">\n<p class=\"\" data-start=\"1197\" data-end=\"1226\"><strong data-start=\"1197\" data-end=\"1203\">P1<\/strong> finishes at <strong data-start=\"1216\" data-end=\"1224\">5 ms<\/strong><\/p>\n<\/li>\n<li class=\"\" data-start=\"1230\" data-end=\"1261\">\n<p class=\"\" data-start=\"1232\" data-end=\"1261\"><strong data-start=\"1232\" data-end=\"1238\">P2<\/strong> finishes at <strong data-start=\"1251\" data-end=\"1259\">8 ms<\/strong><\/p>\n<\/li>\n<li class=\"\" data-start=\"1265\" data-end=\"1297\">\n<p class=\"\" data-start=\"1267\" data-end=\"1297\"><strong data-start=\"1267\" data-end=\"1273\">P3<\/strong> finishes at <strong data-start=\"1286\" data-end=\"1295\">16 ms<\/strong><\/p>\n<\/li>\n<\/ul>\n<p class=\"\" data-start=\"1299\" data-end=\"1330\"><strong data-start=\"1299\" data-end=\"1328\">2. Turnaround Time (TAT):<\/strong><\/p>\n<p><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\">TAT=CT\u2212ArrivalTimeTAT = CT &#8211; Arrival Time<\/span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"mord mathnormal\">T<\/span><span class=\"mord mathnormal\">A<\/span><span class=\"mord mathnormal\">T<\/span><span class=\"mrel\">=<\/span><\/span><span class=\"base\"><span class=\"mord mathnormal\">CT<\/span><span class=\"mbin\">\u2212<\/span><\/span><span class=\"base\"><span class=\"mord mathnormal\">A<\/span><span class=\"mord mathnormal\">rr<\/span><span class=\"mord mathnormal\">i<\/span><span class=\"mord mathnormal\">v<\/span><span class=\"mord mathnormal\">a<\/span><span class=\"mord mathnormal\">lT<\/span><span class=\"mord mathnormal\">im<\/span><span class=\"mord mathnormal\">e<\/span><\/span><\/span><\/span><\/span><\/p>\n<ul data-start=\"1364\" data-end=\"1440\">\n<li class=\"\" data-start=\"1364\" data-end=\"1386\">\n<p class=\"\" data-start=\"1366\" data-end=\"1386\"><strong data-start=\"1366\" data-end=\"1372\">P1<\/strong> = 5 &#8211; 0 = 5<\/p>\n<\/li>\n<li class=\"\" data-start=\"1390\" data-end=\"1412\">\n<p class=\"\" data-start=\"1392\" data-end=\"1412\"><strong data-start=\"1392\" data-end=\"1398\">P2<\/strong> = 8 &#8211; 1 = 7<\/p>\n<\/li>\n<li class=\"\" data-start=\"1416\" data-end=\"1440\">\n<p class=\"\" data-start=\"1418\" data-end=\"1440\"><strong data-start=\"1418\" data-end=\"1424\">P3<\/strong> = 16 &#8211; 2 = 14<\/p>\n<\/li>\n<\/ul>\n<p class=\"\" data-start=\"1442\" data-end=\"1469\"><strong data-start=\"1442\" data-end=\"1467\">3. Waiting Time (WT):<\/strong><\/p>\n<p><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\">WT=TAT\u2212BurstTimeWT = TAT &#8211; Burst Time<\/span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"mord mathnormal\">W<\/span><span class=\"mord mathnormal\">T<\/span><span class=\"mrel\">=<\/span><\/span><span class=\"base\"><span class=\"mord mathnormal\">T<\/span><span class=\"mord mathnormal\">A<\/span><span class=\"mord mathnormal\">T<\/span><span class=\"mbin\">\u2212<\/span><\/span><span class=\"base\"><span class=\"mord mathnormal\">B<\/span><span class=\"mord mathnormal\">u<\/span><span class=\"mord mathnormal\">rs<\/span><span class=\"mord mathnormal\">tT<\/span><span class=\"mord mathnormal\">im<\/span><span class=\"mord mathnormal\">e<\/span><\/span><\/span><\/span><\/span><\/p>\n<ul data-start=\"1501\" data-end=\"1576\">\n<li class=\"\" data-start=\"1501\" data-end=\"1523\">\n<p class=\"\" data-start=\"1503\" data-end=\"1523\"><strong data-start=\"1503\" data-end=\"1509\">P1<\/strong> = 5 &#8211; 5 = 0<\/p>\n<\/li>\n<li class=\"\" data-start=\"1527\" data-end=\"1549\">\n<p class=\"\" data-start=\"1529\" data-end=\"1549\"><strong data-start=\"1529\" data-end=\"1535\">P2<\/strong> = 7 &#8211; 3 = 4<\/p>\n<\/li>\n<li class=\"\" data-start=\"1553\" data-end=\"1576\">\n<p class=\"\" data-start=\"1555\" data-end=\"1576\"><strong data-start=\"1555\" data-end=\"1561\">P3<\/strong> = 14 &#8211; 8 = 6<\/p>\n<\/li>\n<\/ul>\n<p class=\"\" data-start=\"1578\" data-end=\"1611\"><strong data-start=\"1581\" data-end=\"1609\">Average Turnaround Time:<\/strong><\/p>\n<p><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\">(5+7+14)\/3=8.67ms(5 + 7 + 14) \/ 3 = 8.67 ms<\/span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"mopen\">(<\/span><span class=\"mord\">5<\/span><span class=\"mbin\">+<\/span><\/span><span class=\"base\"><span class=\"mord\">7<\/span><span class=\"mbin\">+<\/span><\/span><span class=\"base\"><span class=\"mord\">14<\/span><span class=\"mclose\">)<\/span><span class=\"mord\">\/3<\/span><span class=\"mrel\">=<\/span><\/span><span class=\"base\"><span class=\"mord\">8.67<\/span><span class=\"mord mathnormal\">m<\/span><span class=\"mord mathnormal\">s<\/span><\/span><\/span><\/span><\/span><\/p>\n<p class=\"\" data-start=\"1646\" data-end=\"1676\"><strong data-start=\"1649\" data-end=\"1674\">Average Waiting Time:<\/strong><\/p>\n<p><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\">(0+4+6)\/3=3.33ms(0 + 4 + 6) \/ 3 = 3.33 ms<\/span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"mopen\">(<\/span><span class=\"mord\">0<\/span><span class=\"mbin\">+<\/span><\/span><span class=\"base\"><span class=\"mord\">4<\/span><span class=\"mbin\">+<\/span><\/span><span class=\"base\"><span class=\"mord\">6<\/span><span class=\"mclose\">)<\/span><span class=\"mord\">\/3<\/span><span class=\"mrel\">=<\/span><\/span><span class=\"base\"><span class=\"mord\">3.33<\/span><span class=\"mord mathnormal\">m<\/span><span class=\"mord mathnormal\">s<\/span><\/span><\/span><\/span><\/span><\/p>\n<h4 class=\"\" data-start=\"1715\" data-end=\"1745\"><strong data-start=\"1720\" data-end=\"1743\">Advantages of FCFS:<\/strong><\/h4>\n<p class=\"\" data-start=\"1746\" data-end=\"1852\"><strong data-start=\"1749\" data-end=\"1770\">Easy to implement<\/strong> (uses a queue).<br data-start=\"1786\" data-end=\"1789\" \/><strong data-start=\"1792\" data-end=\"1818\">Fair for all processes<\/strong> (executes in order of arrival).<\/p>\n<h4 class=\"\" data-start=\"1854\" data-end=\"1887\"><strong data-start=\"1859\" data-end=\"1885\">Disadvantages of FCFS:<\/strong><\/h4>\n<p class=\"\" data-start=\"1888\" data-end=\"2025\"><strong data-start=\"1890\" data-end=\"1907\">Convoy Effect<\/strong> (a long process can delay all others).<br data-start=\"1946\" data-end=\"1949\" \/><strong data-start=\"1951\" data-end=\"1982\">Higher Average Waiting Time<\/strong> compared to other scheduling algorithms.<\/p>\n<h4 class=\"\" data-start=\"2032\" data-end=\"2053\"><strong data-start=\"2037\" data-end=\"2051\">Conclusion<\/strong><\/h4>\n<p class=\"\" data-start=\"2054\" data-end=\"2336\">FCFS is a <strong data-start=\"2064\" data-end=\"2090\">simple but inefficient<\/strong> CPU scheduling algorithm, suitable for basic systems but <strong data-start=\"2148\" data-end=\"2186\">not ideal for time-sharing systems<\/strong> due to high waiting times. <strong data-start=\"2214\" data-end=\"2336\" data-is-last-node=\"\">Other scheduling algorithms like SJF (Shortest Job First) and Round Robin perform better in most real-world scenarios.<\/strong><\/p>\n<h3 data-start=\"2054\" data-end=\"2336\"><a href=\"https:\/\/www.vbspu.ac.in\/e-content\/Scheduling-Algorithm.pdf\" target=\"_blank\" rel=\"noopener\">Day 02Part 04 &#8211; Operating system for gate computer &#8211; First come first serve basic algorithms (FCFS)<\/a><\/h3>\n<h3 class=\"LC20lb MBeuO DKV0Md\"><a href=\"https:\/\/sriindu.ac.in\/wp-content\/uploads\/2023\/10\/R20CSE2202-OPERATING-SYSTEMS.pdf\" target=\"_blank\" rel=\"noopener\">OPERATING SYSTEM Lecture Notes On<\/a><\/h3>\n<h3 class=\"LC20lb MBeuO DKV0Md\"><a href=\"https:\/\/www.apgcm.ac.in\/images\/nirf%20mca\/os-lab-manual.pdf\" target=\"_blank\" rel=\"noopener\">Lab Manual &#8211; OPERATING SYSTEMS<\/a><\/h3>\n<h3 class=\"LC20lb MBeuO DKV0Md\"><a href=\"https:\/\/aissmspoly.org.in\/wp-content\/uploads\/2020\/01\/CPU-Scheduling-and-Algorithm-.pdf\" target=\"_blank\" rel=\"noopener\">Unit IV \u2013 CPU Scheduling and Algorithm<\/a><\/h3>\n<p data-start=\"0\" data-end=\"211\">Here is a complete and simple explanation of <strong data-start=\"45\" data-end=\"78\">First Come First Serve (FCFS)<\/strong> \u2014 the <strong data-start=\"85\" data-end=\"119\">basic CPU scheduling algorithm<\/strong> in Operating Systems, commonly covered in <strong data-start=\"162\" data-end=\"180\">Day 02 Part 04<\/strong> of GATE\/Computer Science prep.<\/p>\n<hr data-start=\"213\" data-end=\"216\" \/>\n<h2 data-start=\"218\" data-end=\"266\">\ud83d\udcd8 <strong data-start=\"224\" data-end=\"266\">What is FCFS (First Come First Serve)?<\/strong><\/h2>\n<p data-start=\"268\" data-end=\"410\"><strong data-start=\"268\" data-end=\"301\">First Come First Serve (FCFS)<\/strong> is the <strong data-start=\"309\" data-end=\"346\">simplest CPU scheduling algorithm<\/strong> where the process that <strong data-start=\"370\" data-end=\"387\">arrives first<\/strong> is executed <strong data-start=\"400\" data-end=\"409\">first<\/strong>.<\/p>\n<p data-start=\"412\" data-end=\"497\">\ud83d\udfe2 <strong data-start=\"415\" data-end=\"456\">It\u2019s like a queue at a ticket counter<\/strong> \u2014 whoever comes first gets served first.<\/p>\n<hr data-start=\"499\" data-end=\"502\" \/>\n<h2 data-start=\"504\" data-end=\"534\">\ud83d\udd27 <strong data-start=\"510\" data-end=\"534\">Key Characteristics:<\/strong><\/h2>\n<div class=\"_tableContainer_16hzy_1\">\n<div class=\"_tableWrapper_16hzy_14 group flex w-fit flex-col-reverse\">\n<table class=\"w-fit min-w-(--thread-content-width)\" data-start=\"536\" data-end=\"1158\">\n<thead data-start=\"536\" data-end=\"613\">\n<tr data-start=\"536\" data-end=\"613\">\n<th data-start=\"536\" data-end=\"566\" data-col-size=\"sm\">Feature<\/th>\n<th data-start=\"566\" data-end=\"613\" data-col-size=\"md\">Description<\/th>\n<\/tr>\n<\/thead>\n<tbody data-start=\"692\" data-end=\"1158\">\n<tr data-start=\"692\" data-end=\"769\">\n<td data-start=\"692\" data-end=\"722\" data-col-size=\"sm\">Scheduling Type<\/td>\n<td data-start=\"722\" data-end=\"769\" data-col-size=\"md\">Non-preemptive<\/td>\n<\/tr>\n<tr data-start=\"770\" data-end=\"847\">\n<td data-start=\"770\" data-end=\"800\" data-col-size=\"sm\">Basis of Execution<\/td>\n<td data-start=\"800\" data-end=\"847\" data-col-size=\"md\">Arrival Time<\/td>\n<\/tr>\n<tr data-start=\"848\" data-end=\"924\">\n<td data-start=\"848\" data-end=\"877\" data-col-size=\"sm\">Implementation<\/td>\n<td data-col-size=\"md\" data-start=\"877\" data-end=\"924\">Simple FIFO Queue (First In First Out)<\/td>\n<\/tr>\n<tr data-start=\"925\" data-end=\"1002\">\n<td data-start=\"925\" data-end=\"955\" data-col-size=\"sm\">Starvation Possible?<\/td>\n<td data-col-size=\"md\" data-start=\"955\" data-end=\"1002\">\u274c No<\/td>\n<\/tr>\n<tr data-start=\"1003\" data-end=\"1080\">\n<td data-start=\"1003\" data-end=\"1033\" data-col-size=\"sm\">Best for<\/td>\n<td data-col-size=\"md\" data-start=\"1033\" data-end=\"1080\">Batch systems<\/td>\n<\/tr>\n<tr data-start=\"1081\" data-end=\"1158\">\n<td data-start=\"1081\" data-end=\"1111\" data-col-size=\"sm\">Poor Performance When<\/td>\n<td data-col-size=\"md\" data-start=\"1111\" data-end=\"1158\">Longer processes arrive before shorter ones<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"sticky end-(--thread-content-margin) h-0 self-end select-none\">\n<div class=\"absolute end-0 flex items-end\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<hr data-start=\"1160\" data-end=\"1163\" \/>\n<h2 data-start=\"1165\" data-end=\"1201\">\ud83e\uddee <strong data-start=\"1171\" data-end=\"1201\">Example of FCFS Scheduling<\/strong><\/h2>\n<p data-start=\"1203\" data-end=\"1226\">Let&#8217;s take 3 processes:<\/p>\n<div class=\"_tableContainer_16hzy_1\">\n<div class=\"_tableWrapper_16hzy_14 group flex w-fit flex-col-reverse\">\n<table class=\"w-fit min-w-(--thread-content-width)\" data-start=\"1228\" data-end=\"1427\">\n<thead data-start=\"1228\" data-end=\"1267\">\n<tr data-start=\"1228\" data-end=\"1267\">\n<th data-start=\"1228\" data-end=\"1238\" data-col-size=\"sm\">Process<\/th>\n<th data-start=\"1238\" data-end=\"1253\" data-col-size=\"sm\">Arrival Time<\/th>\n<th data-start=\"1253\" data-end=\"1267\" data-col-size=\"sm\">Burst Time<\/th>\n<\/tr>\n<\/thead>\n<tbody data-start=\"1308\" data-end=\"1427\">\n<tr data-start=\"1308\" data-end=\"1347\">\n<td data-start=\"1308\" data-end=\"1318\" data-col-size=\"sm\">P1<\/td>\n<td data-col-size=\"sm\" data-start=\"1318\" data-end=\"1333\">0 ms<\/td>\n<td data-col-size=\"sm\" data-start=\"1333\" data-end=\"1347\">4 ms<\/td>\n<\/tr>\n<tr data-start=\"1348\" data-end=\"1387\">\n<td data-start=\"1348\" data-end=\"1358\" data-col-size=\"sm\">P2<\/td>\n<td data-col-size=\"sm\" data-start=\"1358\" data-end=\"1373\">1 ms<\/td>\n<td data-col-size=\"sm\" data-start=\"1373\" data-end=\"1387\">3 ms<\/td>\n<\/tr>\n<tr data-start=\"1388\" data-end=\"1427\">\n<td data-start=\"1388\" data-end=\"1398\" data-col-size=\"sm\">P3<\/td>\n<td data-start=\"1398\" data-end=\"1413\" data-col-size=\"sm\">2 ms<\/td>\n<td data-col-size=\"sm\" data-start=\"1413\" data-end=\"1427\">1 ms<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"sticky end-(--thread-content-margin) h-0 self-end select-none\">\n<div class=\"absolute end-0 flex items-end\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3 data-start=\"1429\" data-end=\"1486\">\ud83d\udd39 Step 1: Order of Execution (based on Arrival Time)<\/h3>\n<p data-start=\"1487\" data-end=\"1501\">\u2192 P1 \u2192 P2 \u2192 P3<\/p>\n<h3 data-start=\"1503\" data-end=\"1529\">\ud83d\udd39 Step 2: Gantt Chart<\/h3>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none rounded-t-[5px]\">lua<\/div>\n<div class=\"sticky top-9\">\n<div class=\"absolute end-0 bottom-0 flex h-9 items-center pe-2\">\n<div class=\"bg-token-sidebar-surface-primary text-token-text-secondary dark:bg-token-main-surface-secondary flex items-center rounded-sm px-2 font-sans text-xs\"><button class=\"flex gap-1 items-center select-none px-4 py-1\" aria-label=\"Copy\">Copy<\/button><span class=\"\" data-state=\"closed\"><button class=\"flex items-center gap-1 px-4 py-1 select-none\">Edit<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"whitespace-pre!\">| P1 |<span class=\"hljs-comment\">------4------| P2 |---3---| P3 |-1-|<\/span><br \/>\n<span class=\"hljs-number\">0<\/span>            <span class=\"hljs-number\">4<\/span>     <span class=\"hljs-number\">7<\/span>       <span class=\"hljs-number\">8<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<h3 data-start=\"1616\" data-end=\"1681\">\ud83d\udd39 Step 3: Calculate Completion, Turnaround, and Waiting Time<\/h3>\n<div class=\"_tableContainer_16hzy_1\">\n<div class=\"_tableWrapper_16hzy_14 group flex w-fit flex-col-reverse\">\n<table class=\"w-fit min-w-(--thread-content-width)\" data-start=\"1683\" data-end=\"2012\">\n<thead data-start=\"1683\" data-end=\"1748\">\n<tr data-start=\"1683\" data-end=\"1748\">\n<th data-start=\"1683\" data-end=\"1693\" data-col-size=\"sm\">Process<\/th>\n<th data-start=\"1693\" data-end=\"1703\" data-col-size=\"sm\">Arrival<\/th>\n<th data-start=\"1703\" data-end=\"1711\" data-col-size=\"sm\">Burst<\/th>\n<th data-start=\"1711\" data-end=\"1724\" data-col-size=\"sm\">Completion<\/th>\n<th data-start=\"1724\" data-end=\"1737\" data-col-size=\"sm\">Turnaround<\/th>\n<th data-start=\"1737\" data-end=\"1748\" data-col-size=\"sm\">Waiting<\/th>\n<\/tr>\n<\/thead>\n<tbody data-start=\"1815\" data-end=\"2012\">\n<tr data-start=\"1815\" data-end=\"1880\">\n<td data-start=\"1815\" data-end=\"1825\" data-col-size=\"sm\">P1<\/td>\n<td data-start=\"1825\" data-end=\"1835\" data-col-size=\"sm\">0<\/td>\n<td data-start=\"1835\" data-end=\"1843\" data-col-size=\"sm\">4<\/td>\n<td data-col-size=\"sm\" data-start=\"1843\" data-end=\"1856\">4<\/td>\n<td data-col-size=\"sm\" data-start=\"1856\" data-end=\"1869\">4<\/td>\n<td data-col-size=\"sm\" data-start=\"1869\" data-end=\"1880\">0<\/td>\n<\/tr>\n<tr data-start=\"1881\" data-end=\"1946\">\n<td data-start=\"1881\" data-end=\"1891\" data-col-size=\"sm\">P2<\/td>\n<td data-col-size=\"sm\" data-start=\"1891\" data-end=\"1901\">1<\/td>\n<td data-col-size=\"sm\" data-start=\"1901\" data-end=\"1909\">3<\/td>\n<td data-col-size=\"sm\" data-start=\"1909\" data-end=\"1922\">7<\/td>\n<td data-col-size=\"sm\" data-start=\"1922\" data-end=\"1935\">6<\/td>\n<td data-col-size=\"sm\" data-start=\"1935\" data-end=\"1946\">3<\/td>\n<\/tr>\n<tr data-start=\"1947\" data-end=\"2012\">\n<td data-start=\"1947\" data-end=\"1957\" data-col-size=\"sm\">P3<\/td>\n<td data-col-size=\"sm\" data-start=\"1957\" data-end=\"1967\">2<\/td>\n<td data-col-size=\"sm\" data-start=\"1967\" data-end=\"1975\">1<\/td>\n<td data-col-size=\"sm\" data-start=\"1975\" data-end=\"1988\">8<\/td>\n<td data-col-size=\"sm\" data-start=\"1988\" data-end=\"2001\">6<\/td>\n<td data-col-size=\"sm\" data-start=\"2001\" data-end=\"2012\">5<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"sticky end-(--thread-content-margin) h-0 self-end select-none\">\n<div class=\"absolute end-0 flex items-end\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<blockquote data-start=\"2014\" data-end=\"2106\">\n<p data-start=\"2016\" data-end=\"2106\">\ud83d\udd39 <strong data-start=\"2019\" data-end=\"2038\">Turnaround Time<\/strong> = Completion &#8211; Arrival<br data-start=\"2061\" data-end=\"2064\" \/>\ud83d\udd39 <strong data-start=\"2069\" data-end=\"2085\">Waiting Time<\/strong> = Turnaround &#8211; Burst<\/p>\n<\/blockquote>\n<hr data-start=\"2108\" data-end=\"2111\" \/>\n<h2 data-start=\"2113\" data-end=\"2148\">\ud83d\udcca <strong data-start=\"2119\" data-end=\"2148\">Average Time Calculations<\/strong><\/h2>\n<ul data-start=\"2150\" data-end=\"2270\">\n<li data-start=\"2150\" data-end=\"2211\">\n<p data-start=\"2152\" data-end=\"2211\"><strong data-start=\"2152\" data-end=\"2179\">Average Turnaround Time<\/strong> = (4 + 6 + 6) \/ 3 = <strong data-start=\"2200\" data-end=\"2211\">5.33 ms<\/strong><\/p>\n<\/li>\n<li data-start=\"2212\" data-end=\"2270\">\n<p data-start=\"2214\" data-end=\"2270\"><strong data-start=\"2214\" data-end=\"2238\">Average Waiting Time<\/strong> = (0 + 3 + 5) \/ 3 = <strong data-start=\"2259\" data-end=\"2270\">2.67 ms<\/strong><\/p>\n<\/li>\n<\/ul>\n<hr data-start=\"2272\" data-end=\"2275\" \/>\n<h2 data-start=\"2277\" data-end=\"2304\">\u274c Disadvantages of FCFS:<\/h2>\n<ol data-start=\"2306\" data-end=\"2452\">\n<li data-start=\"2306\" data-end=\"2359\">\n<p data-start=\"2309\" data-end=\"2359\"><strong data-start=\"2309\" data-end=\"2326\">Convoy Effect<\/strong>: Long process delays short ones.<\/p>\n<\/li>\n<li data-start=\"2360\" data-end=\"2407\">\n<p data-start=\"2363\" data-end=\"2407\"><strong data-start=\"2363\" data-end=\"2392\">Poor average waiting time<\/strong> in some cases.<\/p>\n<\/li>\n<li data-start=\"2408\" data-end=\"2452\">\n<p data-start=\"2411\" data-end=\"2452\"><strong data-start=\"2411\" data-end=\"2452\">Not suitable for interactive systems.<\/strong><\/p>\n<\/li>\n<\/ol>\n<hr data-start=\"2454\" data-end=\"2457\" \/>\n<h2 data-start=\"2459\" data-end=\"2483\">\u2705 Advantages of FCFS:<\/h2>\n<ul data-start=\"2485\" data-end=\"2574\">\n<li data-start=\"2485\" data-end=\"2516\">\n<p data-start=\"2487\" data-end=\"2516\">Simple and easy to implement.<\/p>\n<\/li>\n<li data-start=\"2517\" data-end=\"2574\">\n<p data-start=\"2519\" data-end=\"2574\">Fair \u2014 in the sense that it serves in order of arrival.<\/p>\n<\/li>\n<\/ul>\n<hr data-start=\"2576\" data-end=\"2579\" \/>\n<h2 data-start=\"2581\" data-end=\"2605\">\ud83e\udde0 Tip for GATE Exam:<\/h2>\n<ul data-start=\"2607\" data-end=\"2763\">\n<li data-start=\"2607\" data-end=\"2647\">\n<p data-start=\"2609\" data-end=\"2647\">Always sort by <strong data-start=\"2624\" data-end=\"2640\">arrival time<\/strong> first.<\/p>\n<\/li>\n<li data-start=\"2648\" data-end=\"2695\">\n<p data-start=\"2650\" data-end=\"2695\">Use a <strong data-start=\"2656\" data-end=\"2671\">Gantt Chart<\/strong> to visualize execution.<\/p>\n<\/li>\n<li data-start=\"2696\" data-end=\"2763\">\n<p data-start=\"2698\" data-end=\"2763\">Watch out for <strong data-start=\"2712\" data-end=\"2730\">arrival delays<\/strong> while calculating waiting times.<\/p>\n<\/li>\n<\/ul>\n<hr data-start=\"2765\" data-end=\"2768\" \/>\n<p data-start=\"2770\" data-end=\"2794\">Let me know if you want:<\/p>\n<ul data-start=\"2795\" data-end=\"2902\" data-is-last-node=\"\" data-is-only-node=\"\">\n<li data-start=\"2795\" data-end=\"2840\">\n<p data-start=\"2797\" data-end=\"2840\"><strong data-start=\"2797\" data-end=\"2837\">FCFS code implementation in C\/Python<\/strong>,<\/p>\n<\/li>\n<li data-start=\"2841\" data-end=\"2857\">\n<p data-start=\"2843\" data-end=\"2857\"><strong data-start=\"2843\" data-end=\"2851\">MCQs<\/strong>, or<\/p>\n<\/li>\n<li data-start=\"2858\" data-end=\"2902\" data-is-last-node=\"\">\n<p data-start=\"2860\" data-end=\"2902\" data-is-last-node=\"\"><strong data-start=\"2860\" data-end=\"2902\" data-is-last-node=\"\">Comparison with SJF, Round Robin, etc<\/strong><\/p>\n<\/li>\n<\/ul>\n<h3><a href=\"https:\/\/ijcsn.org\/IJCSN-2014\/3-6\/Simulation-of-First-Come-First-Served-_FCFS_-and-Shortest-Job-First-_SJF_-Algorithms.pdf\" target=\"_blank\" rel=\"noopener\">Day 02Part 04 &#8211; Operating system for gate computer &#8211; First come first serve basic algorithms (FCFS)<\/a><\/h3>\n","protected":false},"excerpt":{"rendered":"<p>Day 02Part 04 &#8211; Operating system for gate computer &#8211; First come first serve basic algorithms (FCFS) [fvplayer id=&#8221;317&#8243;] First Come First Serve (FCFS) Scheduling Algorithm Introduction First Come First Serve (FCFS) is the simplest CPU scheduling algorithm, where the process that arrives first in the ready queue gets executed first. It follows the FIFO [&hellip;]<\/p>\n","protected":false},"author":66,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[78],"tags":[],"class_list":["post-3238","post","type-post","status-publish","format-standard","hentry","category-operating-system"],"_links":{"self":[{"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/posts\/3238","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/users\/66"}],"replies":[{"embeddable":true,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/comments?post=3238"}],"version-history":[{"count":0,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/posts\/3238\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/media?parent=3238"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/categories?post=3238"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/tags?post=3238"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}