0% found this document useful (0 votes)
4 views6 pages

FCFS Server Request Management in Python

The project titled 'Server Request Management System using FCFS in Python' simulates a server managing client requests based on the First-Come, First-Served scheduling algorithm. It includes a GitHub repository containing the Python code, documentation, and output screenshots, and generates a detailed scheduling table along with performance metrics. The project addresses challenges such as incorrect waiting time calculations and Gantt chart misalignment, implementing fixes for accurate results.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views6 pages

FCFS Server Request Management in Python

The project titled 'Server Request Management System using FCFS in Python' simulates a server managing client requests based on the First-Come, First-Served scheduling algorithm. It includes a GitHub repository containing the Python code, documentation, and output screenshots, and generates a detailed scheduling table along with performance metrics. The project addresses challenges such as incorrect waiting time calculations and Gantt chart misalignment, implementing fixes for accurate results.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

The Superior University

📝 Operating Systems Lab – Project


Documentation Template
📌 Project Title
Server Request Management System using FCFS (First-Come, First-Served) in
Python.

Group Members

 Abdul Rehman (SU92-BSSEM-F23-007)


 Hafiz Shaheer Ahmed (SU92-BSSEM-F23-014)
 Muhammad Bilal Saqib (SU92-BSSEM-F23-022)
 Muhammad Dawood (SU92-BSSEM-F23-002)

📂 GitHub Repository

[Link]
✅ Both the Python code file and this documentation must be uploaded to a public GitHub
repository.

GitHub Repository Link:

[Paste your public repo link here]

Your repository should include:

 ✔ Python .py file containing the scheduling algorithm


 ✔ [Link] with basic project info and instructions
 ✔ This completed documentation file (.docx or .pdf)
 ✔ At least 2–3 output screenshots

🔧 🔧 Scheduling Algorithm Implemented

 ✅ FCFS (First Come First Serve)


 ⬜ SJF (Shortest Job First – Non-Preemptive)
 ⬜ SJF (Preemptive)
 ⬜ Round Robin

📄 Project Description
What problem your project solves

The project simulates a server managing multiple client requests using the First-Come, First-
Served (FCFS) algorithm. It ensures that incoming requests are handled based on their arrival
order, helping understand how operating systems or servers manage tasks under simple
scheduling policies.

What inputs are required (arrival time, burst time, time quantum)

Arrival Time: When a request arrives at the server.


Processing Time (Burst Time): How long the request takes to complete.
(No Time Quantum needed for FCFS)
What outputs are generated
A detailed scheduling table with:
 Start Time
 Completion Time
 Waiting Time
 Turnaround Time

 A Gantt chart visualizing the schedule


 Performance metrics: Average Waiting Time, Turnaround Time, Idle Time,
Server Utilization

How the algorithm is implemented

 Requests are sorted by arrival time.


 Each request starts only after the previous one finishes (or when it arrives).
 The scheduling is performed iteratively, updating each request's start and completion
time accordingly.

Output Screenshots
1st Output:
Output#02:

Code Structure & Explanation


Functions or classes used

Purpose
Function Name

get_requests_input() Takes user input for number of requests,


arrival time, and processing time.
fcfs_schedule() Implements the FCFS algorithm and
calculates scheduling details.

display_request_table() Displays request details in a formatted table


using the tabulate library.

draw_gantt_chart() Visualizes scheduling using a Gantt chart via


the matplotlib library.

calculate_metrics() Calculates and displays average waiting time,


turnaround time, and server utilization.

main block Controls the program flow by calling the


functions in sequence.

No classes are used—this script is function-based.

Core logic of the scheduling algorithm

The FCFS logic is implemented in the fcfs_schedule() function. It works like that:
Sort Requests by Arrival Time
Ensures that requests are processed in the order they arrive.
Initialize Time Trackers
 current_time tracks the timeline of execution.
 idle_time tracks when the server is not processing any request.
Process Each Request in Order
 Set the start_time to the later of the current time or request’s arrival time.
 If the server is idle, add the gap to idle_time.
 Calculate completion_time, waiting_time, and turnaround_time.
 Update current_time for the next request.
Return Idle Time
 This helps in calculating server utilization.

Any external libraries (e.g., matplotlib, tabulate) used for output formatting or
visualization

matplotlib: Used to draw the Gantt chart.


tabulate: Formats tables for clear and readable output.
PerformanceMetrics
Metric Value

Average Waiting The average time each server request spends waiting in the queue before
Time processing begins.

Average The average total time taken from the arrival of a request to its
Turnaround Time completion (includes both waiting and processing time).

Time Quantum (if Not applicable in FCFS, as First-Come, First-Served is a non-preemptive


RR) scheduling algorithm and does not use time quantum.

Challenges Faced
Incorrect Waiting Time Calculation

 Issue: Initially calculated waiting time as start_time - processing_time.

 Fix: Corrected to start_time - arrival_time.

2. Gantt Chart Misalignment

 Issue: Request bars were overlapping or misaligned.

 Fix: Used broken_barh() with consistent spacing and color coding.

3. Idle Time Calculation

 Issue: Ignored time gaps between requests.

 Fix: Added logic to count time when server was idle between arrivals.

You might also like