cpu-scheduler

CPU Scheduler Project

Project’s Title

CPU Scheduler Project

Project Description

This project implements six CPU scheduling algorithms using the Qt Creator framework in C++. The scheduling algorithms implemented are:

  1. FCFS (First Come First Served)
  2. PSJF (Preemptive Shortest Job First)
  3. NPSJF (Non-Preemptive Shortest Job First)
  4. PP (Preemptive Priority)
  5. NPP (Non-Preemptive Priority)
  6. RR (Round Robin)

The project provides a graphical user interface (GUI) that allows users to input the number of processes, select a scheduling algorithm, and enter additional parameters such as time quantum for Round Robin scheduling.

How to Run the Project

Dependencies

To run this project, you need the following dependencies:

Steps to Run

  1. Install Qt Creator: Download and install Qt Creator from Qt’s official website.
  2. Clone the Repository: Clone the project repository to your local machine. ( git clone https://github.com/yourusername/cpu-scheduler.git )
  3. Open the Project in Qt Creator:
    • Launch Qt Creator.
    • Open the Cpu_scheduler.pro file in Qt Creator.
  4. Build the Project:
    • Configure the project kit as needed.
    • Click the “Build” button to compile the project.
  5. Run the Project:
    • Click the “Run” button to start the application.

Internal Working of the Project

Theory of CPU Scheduling Algorithms

  1. FCFS (First Come First Served): Processes are executed in the order they arrive in the ready queue.
  2. PSJF (Preemptive Shortest Job First): The process with the shortest remaining time is executed next, preempting the current process if necessary.
  3. NPSJF (Non-Preemptive Shortest Job First): The process with the shortest burst time is executed next without preemption.
  4. PP (Preemptive Priority): Processes are selected based on priority. If a new process with a higher priority arrives, it preempts the current process.
  5. NPP (Non-Preemptive Priority): Processes are selected based on priority, but once a process starts, it runs to completion.
  6. RR (Round Robin): Each process is assigned a fixed time slice (quantum). Processes are executed in a cyclic order, and if a process does not finish within its quantum, it is moved to the back of the queue.

GUI Implementation

The project uses Qt Widgets for the GUI. The MainWindow class handles the main interface, allowing users to input the number of processes, select a scheduling algorithm, and input the quantum for Round Robin scheduling. The interface includes input validation to ensure correct data entry.

Key UI Elements:

Code Structure

Learning Takeaways from the Project

Resources/References