Skip to content

feat: add Round Robin CPU scheduling algorithm#3144

Open
Shubhangam-Singh wants to merge 1 commit into
TheAlgorithms:masterfrom
Shubhangam-Singh:add/round-robin-scheduling
Open

feat: add Round Robin CPU scheduling algorithm#3144
Shubhangam-Singh wants to merge 1 commit into
TheAlgorithms:masterfrom
Shubhangam-Singh:add/round-robin-scheduling

Conversation

@Shubhangam-Singh
Copy link
Copy Markdown

Implements preemptive Round Robin (RR) scheduling in C++17 following the TheAlgorithms/C-Plus-Plus code style.

Key features:

  • Supports processes with different arrival times
  • Uses std::queue<uint32_t> for the circular ready queue
  • Class template RoundRobin<S,T,E> with addProcess() / scheduleForRR() / printResult() methods, wrapped in namespace cpu_scheduling_algorithms::round_robin
  • Doxygen comments on all types, functions, and parameters
  • 5 self-test cases validated with assert(), including:
    • Same-arrival-time scenario (quantum=2, three processes)
    • Single-process trivial case (no waiting, no preemption)
    • Burst == quantum case (no preemption, sequential completion)
    • Duplicate process ID guard
    • Different arrival times cross-validated against a reference impl

Description of Change

Checklist

  • Added description of change
  • Added file name matches File name guidelines
  • Added tests and example, test must pass
  • Added documentation so that the program is self-explanatory and educational - Doxygen guidelines
  • Relevant documentation/comments is changed or added
  • PR title follows semantic commit guidelines
  • Search previous suggestions before making a new one, as yours may be a duplicate.
  • I acknowledge that all my contributions will be made under the project's license.

Notes:

Implements preemptive Round Robin (RR) scheduling in C++17 following
the TheAlgorithms/C-Plus-Plus code style.

Key features:
- Supports processes with different arrival times
- Uses std::queue<uint32_t> for the circular ready queue
- Class template RoundRobin<S,T,E> with addProcess() / scheduleForRR()
  / printResult() methods, wrapped in namespace cpu_scheduling_algorithms::round_robin
- Doxygen comments on all types, functions, and parameters
- 5 self-test cases validated with assert(), including:
    - Same-arrival-time scenario (quantum=2, three processes)
    - Single-process trivial case (no waiting, no preemption)
    - Burst == quantum case (no preemption, sequential completion)
    - Duplicate process ID guard
    - Different arrival times cross-validated against a reference impl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant