L-2.3: First Come First Serve(FCFS) CPU Scheduling Algorithm with Example

L-2.3: First Come First Serve(FCFS) CPU Scheduling Algorithm with Example

Understanding FCFS Scheduling Algorithm

Introduction to FCFS

  • The video introduces the First Come First Serve (FCFS) scheduling algorithm, explaining its basic premise and application in process management.
  • It emphasizes that the burst time or execution time of processes is crucial for understanding how FCFS operates, regardless of the unit of measurement.

Working Criteria of FCFS

  • The algorithm prioritizes processes based on their arrival times; the first process to arrive is served first.
  • It is a non-preemptive scheduling method, meaning once a process starts executing on the CPU, it runs to completion without interruption.

Gantt Chart Utilization

  • A Gantt chart is introduced as a tool to visualize and solve scheduling problems effectively.
  • The presenter begins analyzing specific processes (P1, P2, P3, P4), checking their arrival times and determining which one will execute first.

Execution Process Breakdown

  • At time 0, only P1 has arrived; thus it starts executing immediately for 2 units of time until time 2.
  • After P1 completes at time 2, P2 is next in line since it arrived at time 1 and was waiting in the ready queue.

Idle Time and Subsequent Executions

  • After executing P2 for 2 units until time 4, there’s an idle period from time 4 to 5 because no new processes have arrived.
  • At time 5, P3 arrives and executes for 3 units until time 8. Following this, P4 executes from time 8 to completion at time 12.

Completion Times and Turnaround Time Calculation

  • All processes complete by time 12. The completion times are recorded:
  • P1: completed at 2
  • P2: completed at 4
  • P3: completed at 8
  • P4: completed at 12.

Turnaround Time (TAT)

  • TAT is calculated as CT (Completion Time) minus AT (Arrival Time):
  • For example:
  • TAT for P1 = CT(2)-AT(0)=2,
  • TAT for P2 = CT(4)-AT(1)=3,
  • TAT for P3 = CT(8)-AT(5)=3,
  • TAT for P4 = CT(12)-AT(6)=6.

Waiting Time (WT)

  • WT measures how long each process waited before execution:
  • Calculated as TAT minus Burst Time:
  • WT for each process results in values like:
  • For P1: WT = TAT(2)-BT(2)=0,
  • For others similarly calculated leading to respective waiting times.

Response Time Analysis

  • Response Time indicates when a process gets CPU access relative to its arrival:
  • Example calculations show that:
  • For instance, response times are derived from initial CPU access timestamps compared with arrival times leading to values such as:
  • For example:
  • Response Time for P1 = CPU Access (0)- Arrival (0)=0,
  • Response Time for other processes follows similar logic.

Response Time and Waiting Time in Scheduling

Understanding Response Time

  • The speaker explains that calculating response time is unnecessary in this context, as it will always equal waiting time.
  • Response time becomes more relevant in scheduling algorithms like Round Robin and Shortest Job First (SJF), particularly in preemptive cases.
  • The speaker reassures that the audience won't be asked about different times beyond this point.

Average Turnaround and Waiting Times

  • A follow-up question regarding average turnaround time is anticipated; it can be calculated by dividing the total turnaround time (14) by the number of processes (4).
Video description

🚀 Enroll Now in GATE DA exam course 2025🌟 🔗To Enroll, Login to: https://www.gatesmashers.com/ 💰Course Price: 2999/- (Non-Refundable) 🕒Course starting Date: 5th March 2024 📞 Contact us: For any queries or assistance, feel free to reach us on WhatsApp or call at 8295451354. 🕒Validity of Course: 31st March, 2025 👉Subscribe to our new channel:https://www.youtube.com/@varunainashots First Come First Serve (FCFS) is an operating system scheduling algorithm that automatically executes queued requests and processes in order of their arrival. It is the easiest and simplest CPU scheduling algorithm. In this type of algorithm, processes which requests the CPU first get the CPU allocation first. This is managed with a FIFO queue. ►Operating System (Complete Playlist): https://www.youtube.com/playlist?list=PLxCzCOWd7aiGz9donHRrE9I3Mwn6XdP8p Other subject-wise playlist Links: -------------------------------------------------------------------------------------------------------------------------------------- ►Design and Analysis of algorithms (DAA): https://www.youtube.com/playlist?list=PLxCzCOWd7aiHcmS4i14bI0VrMbZTUvlTa ►Database Management System: https://www.youtube.com/playlist?list=PLxCzCOWd7aiFAN6I8CuViBuCdJgiOkT2Y ► Theory of Computation https://www.youtube.com/playlist?list=PLxCzCOWd7aiFM9Lj5G9G_76adtyb4ef7i ►Artificial Intelligence: https://www.youtube.com/playlist?list=PLxCzCOWd7aiHGhOHV-nwb0HR5US5GFKFI ►Computer Networks (Complete Playlist): https://www.youtube.com/playlist?list=PLxCzCOWd7aiGFBD2-2joCpWOLUrDLvVV_ ►Computer Architecture (Complete Playlist): https://www.youtube.com/playlist?list=PLxCzCOWd7aiHMonh3G6QNKq53C6oNXGrX ►Structured Query Language (SQL): https://www.youtube.com/playlist?list=PLxCzCOWd7aiHqU4HKL7-SITyuSIcD93id ►Discrete Mathematics: https://www.youtube.com/playlist?list=PLxCzCOWd7aiH2wwES9vPWsEL6ipTaUSl3 ►Compiler Design: https://www.youtube.com/playlist?list=PLxCzCOWd7aiEKtKSIHYusizkESC42diyc ►Number System: https://www.youtube.com/playlist?list=PLxCzCOWd7aiFOet6KEEqDff1aXEGLdUzn ►Cloud Computing & BIG Data: https://www.youtube.com/playlist?list=PLxCzCOWd7aiHRHVUtR-O52MsrdUSrzuy4 ►Software Engineering: https://www.youtube.com/playlist?list=PLxCzCOWd7aiEed7SKZBnC6ypFDWYLRvB2 ►Data Structure: https://www.youtube.com/playlist?list=PLxCzCOWd7aiEwaANNt3OqJPVIxwp2ebiT ►Graph Theory: https://www.youtube.com/playlist?list=PLxCzCOWd7aiG0M5FqjyoqB20Edk0tyzVt ►Programming in C: https://www.youtube.com/playlist?list=PLxCzCOWd7aiGmiGl_DOuRMJYG8tOVuapB ►Digital Logic: https://www.youtube.com/playlist?list=PLxCzCOWd7aiGmXg4NoX6R31AsC5LeCPHe --------------------------------------------------------------------------------------------------------------------------------------- Our social media Links: ► Subscribe to us on YouTube: https://www.youtube.com/gatesmashers ►Subscribe to our new channel: https://www.youtube.com/@varunainashots ► Like our page on Facebook: https://www.facebook.com/gatesmashers ► Follow us on Instagram: https://www.instagram.com/gate.smashers ► Follow us on Instagram: https://www.instagram.com/varunainashots ► Follow us on Telegram: https://t.me/gatesmashersofficial ► Follow us on Threads: https://www.threads.net/@gate.smashers -------------------------------------------------------------------------------------------------------------------------------------- ►For Any Query, Suggestion or notes contribution: Email us at: gatesmashers2018@gmail.com