scheduling.cpuschedulingalgorithms ================================== .. py:module:: scheduling.cpuschedulingalgorithms Attributes ---------- .. autoapisummary:: scheduling.cpuschedulingalgorithms.root Classes ------- .. autoapisummary:: scheduling.cpuschedulingalgorithms.CPUSchedulerGUI scheduling.cpuschedulingalgorithms.SchedulerEngine Module Contents --------------- .. py:class:: CPUSchedulerGUI(root: tkinter.Tk) .. py:method:: add_process() -> None Adds a new process entry to the table. .. py:method:: animate() -> None Animates the scheduling visualization. .. py:method:: delete_process() -> None Deletes a selected process. .. py:method:: run_scheduling() -> None Runs the selected scheduling algorithm. .. py:method:: setup_ui() -> None Sets up GUI widgets. .. py:method:: show_results() -> None Displays scheduling results. .. py:attribute:: processes :type: list[dict] :value: [] .. py:attribute:: root .. py:class:: SchedulerEngine(processes: list[dict], algorithm: str, quantum: int = 2) .. py:method:: _calculate_stats() -> None Calculates turnaround, waiting, and response times. .. py:method:: _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', []) .. py:method:: _simulate_priority_np() -> collections.abc.Generator[tuple[int, str | None, list[str]]] Simulates Priority (Non-Preemptive) scheduling. .. py:method:: _simulate_priority_p() -> collections.abc.Generator[tuple[int, str | None, list[str]]] Simulates Priority (Preemptive) scheduling. .. py:method:: _simulate_rr() -> collections.abc.Generator[tuple[int, str | None, list[str]]] Simulates Round Robin scheduling. .. py:method:: _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 .. py:method:: _simulate_sjf_p() -> collections.abc.Generator[tuple[int, str | None, list[str]]] Simulates SJF Preemptive scheduling. .. py:method:: 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', [])] .. py:attribute:: algorithm .. py:attribute:: original .. py:attribute:: processes .. py:attribute:: quantum :value: 2 .. py:attribute:: stats :type: list[tuple] :value: [] .. py:attribute:: timeline :type: list[tuple[int, str]] :value: [] .. py:data:: root