Skip to content

fatema123elfiky/CPU-Scheduling

Repository files navigation

CPU-Scheduling

1. AG Scheduling Algorithm

AG Scheduling

AG Scheduling (Adaptive General Scheduling) is a CPU scheduling algorithm that dynamically combines FCFS, Priority, and Shortest Job First (SJF) based on the execution phase of each process.

Each process is assigned a static time slice called Quantum.

The execution of a process is divided into three phases:

  1. FCFS Phase – Non-preemptive execution for a fraction of its quantum.
  2. Priority Phase – Preemptive execution based on priority for the next fraction of its quantum.
  3. SJF Phase – Preemptive execution based on remaining burst time for the rest of its quantum.

Process Execution Rules

  1. Quantum Usage:

    • The process runs according to its current phase (FCFS → Priority → SJF).
    • Quantum is updated based on whether the process completes or is preempted.
  2. Scenarios:

    Scenario 1: The running process used all its quantum and still has remaining burst:

    • Move to end of ready queue.
    • Increase quantum by 2.

    Scenario 2: Process executed during Priority phase and was preempted:

    • Move to end of ready queue.
    • Increase quantum by ceil(remainingQuantum / 2).

    Scenario 3: Process executed during SJF phase and was preempted:

    • Move to end of ready queue.
    • Increase quantum by remaining quantum.

    Scenario 4: Process completed before using all its quantum:

    • Set quantum to 0.

About

CPU scheduler simulator implementing four schedulers algothims. AG ,PS ,SJF and RR algorthims are implemented. Showing the order of execution of the processes as Grant chart .

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages