FCFS Scheduling Algorithm

Jul 14, 2024

FCFS Scheduling Algorithm

Overview

  • FCFS stands for First Come First Serve
  • It is a scheduling algorithm
  • Jobs are executed in the order they arrive

Example Problem

  • Context: 200 cylinders (0 to 199)
  • Disk queue requests: 98, 183, 37, 122, 14, 124, 65, 67
  • Initial read/write head position: Cylinder 53
  • Objective: Find total head movements

Steps to Calculate Total Head Movements

  1. Initial Position: 53
  2. Move to 98:
    • Head movement: (98 - 53 = 45)
  3. Move to 183:
    • Head movement: (183 - 98 = 85)
  4. Move to 37:
    • Head movement: (183 - 37 = 146)
  5. Move to 122:
    • Head movement: (122 - 37 = 85)
  6. Move to 14:
    • Head movement: (122 - 14 = 108)
  7. Move to 124:
    • Head movement: (124 - 14 = 110)
  8. Move to 65:
    • Head movement: (124 - 65 = 59)
  9. Move to 67:
    • Head movement: (67 - 65 = 2)

Total Head Movements Calculation

  • Head movements:
    • 45 (53 to 98)
    • 85 (98 to 183)
    • 146 (183 to 37)
    • 85 (37 to 122)
    • 108 (122 to 14)
    • 110 (14 to 124)
    • 59 (124 to 65)
    • 2 (65 to 67)
  • Total: 640

Summary

  • FCFS scheduling executes jobs in the sequence they arrive.
  • For the given disk queue, 640 total head movements are required based on FCFS scheduling.