scheduling.cpuschedulingalgorithms¶
Attributes¶
Classes¶
Module Contents¶
- class scheduling.cpuschedulingalgorithms.CPUSchedulerGUI(root: tkinter.Tk)¶
- add_process() None¶
Adds a new process entry to the table.
- animate() None¶
Animates the scheduling visualization.
- delete_process() None¶
Deletes a selected process.
- run_scheduling() None¶
Runs the selected scheduling algorithm.
- setup_ui() None¶
Sets up GUI widgets.
- show_results() None¶
Displays scheduling results.
- root¶
- class scheduling.cpuschedulingalgorithms.SchedulerEngine(processes: list[dict], algorithm: str, quantum: int = 2)¶
- _calculate_stats() None¶
Calculates turnaround, waiting, and response times.
- _simulate_fcfs() collections.abc.Generator[tuple[int, str, list[str]]]¶
Simulates First Come First Serve scheduling.
>>> processes = [{"pid": "P1", "arrival": 0, "burst": 2}] >>> engine = SchedulerEngine(processes, "FCFS") >>> next(engine._simulate_fcfs()) (0, 'P1', [])
- _simulate_priority_np() collections.abc.Generator[tuple[int, str | None, list[str]]]¶
Simulates Priority (Non-Preemptive) scheduling.
- _simulate_priority_p() collections.abc.Generator[tuple[int, str | None, list[str]]]¶
Simulates Priority (Preemptive) scheduling.
- _simulate_rr() collections.abc.Generator[tuple[int, str | None, list[str]]]¶
Simulates Round Robin scheduling.
- _simulate_sjf_np() collections.abc.Generator[tuple[int, str | None, list[str]]]¶
Simulates Shortest Job First (Non-Preemptive).
>>> processes = [{"pid": "P1", "arrival": 0, "burst": 2}] >>> engine = SchedulerEngine(processes, "SJF (Non-Preemptive)") >>> isinstance(engine._simulate_sjf_np(), Generator) True
- _simulate_sjf_p() collections.abc.Generator[tuple[int, str | None, list[str]]]¶
Simulates SJF Preemptive scheduling.
- simulate() collections.abc.Generator[tuple[int, str | None, list[str]]]¶
Runs the selected CPU scheduling algorithm.
>>> processes = [{"pid": "P1", "arrival": 0, "burst": 2}] >>> engine = SchedulerEngine(processes, "FCFS") >>> list(engine.simulate())[:2] [(0, 'P1', []), (1, 'P1', [])]
- algorithm¶
- original¶
- processes¶
- quantum = 2¶
- scheduling.cpuschedulingalgorithms.root¶