{"id":25853096,"url":"https://github.com/ah-ibrahim/cpu-process-scheduling","last_synced_at":"2025-06-30T11:05:15.932Z","repository":{"id":279921033,"uuid":"933038557","full_name":"Ah-Ibrahim/Cpu-Process-Scheduling","owner":"Ah-Ibrahim","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-28T07:29:58.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-28T14:29:26.400Z","etag":null,"topics":["cpp","cpu-scheduling","operating-systems"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ah-Ibrahim.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-15T02:11:08.000Z","updated_at":"2025-02-28T07:30:02.000Z","dependencies_parsed_at":"2025-05-10T02:45:55.150Z","dependency_job_id":null,"html_url":"https://github.com/Ah-Ibrahim/Cpu-Process-Scheduling","commit_stats":null,"previous_names":["ah-ibrahim/cpu-process-scheduling"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Ah-Ibrahim/Cpu-Process-Scheduling","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ah-Ibrahim%2FCpu-Process-Scheduling","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ah-Ibrahim%2FCpu-Process-Scheduling/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ah-Ibrahim%2FCpu-Process-Scheduling/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ah-Ibrahim%2FCpu-Process-Scheduling/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ah-Ibrahim","download_url":"https://codeload.github.com/Ah-Ibrahim/Cpu-Process-Scheduling/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ah-Ibrahim%2FCpu-Process-Scheduling/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262762458,"owners_count":23360329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","cpu-scheduling","operating-systems"],"created_at":"2025-03-01T14:32:14.139Z","updated_at":"2025-06-30T11:05:15.915Z","avatar_url":"https://github.com/Ah-Ibrahim.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Process Scheduler (C++ Implementation)\n\n## Overview\n\nThis project implements a **process scheduling simulator** in C++ that supports multiple scheduling algorithms. The program reads scheduling parameters from standard input, simulates process execution, and prints either a trace of execution or statistics based on user input.\n\n## Features\n\n- **Supports Multiple Scheduling Algorithms:**\n  - First Come First Serve (FCFS)\n  - Round Robin (RR)\n  - Shortest Process Next (SPN)\n  - Shortest Remaining Time (SRT)\n  - Highest Response Ratio Next (HRRN)\n  - Feedback Queues (FB-1, FB-2i)\n  - Aging\n- **Trace Mode:** Displays a step-by-step execution of processes.\n- **Statistics Mode:** Computes process completion times, turnaround times, and normalized turnaround times.\n\n## Compilation \u0026 Execution\n\n### Compile the Program:\n\n```sh\nmake # using Makefile or\ng++ -g scheduler.cpp -o scheduler\n```\n\n### Run the Program:\n\n```sh\n./scheduler \u003c input.txt\n```\n\nThe input is read from standard input (`stdin`). You can redirect a file containing scheduling parameters.\n\n## Scheduling Algorithms\n\n### 1) First Come First Serve (FCFS)\n\n- Processes are scheduled in the order of their arrival.\n\n### 2) Round Robin (RR-x)\n\n- Each process is given a fixed time slice (quantum `x`).\n- If unfinished, the process is moved to the end of the queue.\n\n### 3) Shortest Process Next (SPN)\n\n- Selects the process with the shortest service time.\n\n### 4) Shortest Remaining Time (SRT)\n\n- Preemptive version of SPN, choosing the process with the least remaining time.\n\n### 5) Highest Response Ratio Next (HRRN)\n\n- Prioritizes processes with a high response ratio.\n\n### 6) Feedback Queues (FB-1, FB-2i)\n\n- Uses multiple queues with different priority levels.\n\n### 7) Aging\n\n- Prevents starvation by increasing priority over time.\n\n## Code Structure\n\n- **`scheduler.h`**: Header file defining process structures and scheduling logic.\n- **`scheduler.cpp`**: Implements parsing, scheduling algorithms, and result output.\n\n## Input Format\n\n1. **Trace or Statistics Mode:** (`trace` or `stats`)\n2. **Algorithms:** Comma-separated list of algorithm numbers (e.g., `1,2-3,4` indicates FCFC, RR-3 and SRT).\n3. **Last Instant:** Integer defining the maximum simulation time.\n4. **Number of Processes:** Integer representing the total number of processes.\n5. **Process List:**\n   - Each process is defined in a new line as `name,arrival_time,service_time`\n\n## Output Format\n\n### 1) trace mode\n\nA time figure is shown for all processes.\n(\\*) -\u003e indicates the process is active (running on cpu).\n(.) -\u003e indicates the process is blocked (waiting for cpu).\n\n### 2) stats mode\n\nShows different stats (arrival time, service time (burst time), etc.) about processes.\n\n## Sample Input and Output\n\nInput (trace mode for first scheduling algorithm):\n\n```\ntrace\n1\n20\n5\nA,0,3\nB,2,6\nC,4,4\nD,6,5\nE,8,2\n```\n\nOutput:\n\n```\nFCFS  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0\n------------------------------------------------\nA     |*|*|*| | | | | | | | | | | | | | | | | |\nB     | | |.|*|*|*|*|*|*| | | | | | | | | | | |\nC     | | | | |.|.|.|.|.|*|*|*|*| | | | | | | |\nD     | | | | | | |.|.|.|.|.|.|.|*|*|*|*|*| | |\nE     | | | | | | | | |.|.|.|.|.|.|.|.|.|.|*|*|\n------------------------------------------------\n\n\n```\n\nInput (stats mode for first scheduling algorithm):\n\n```\nstats\n1\n20\n5\nA,0,3\nB,2,6\nC,4,4\nD,6,5\nE,8,2\n```\n\nOutput:\n\n```\nFCFS\nProcess    |  A  |  B  |  C  |  D  |  E  |\nArrival    |  0  |  2  |  4  |  6  |  8  |\nService    |  3  |  6  |  4  |  5  |  2  | Mean|\nFinish     |  3  |  9  | 13  | 18  | 20  |-----|\nTurnaround |  3  |  7  |  9  | 12  | 12  | 8.60|\nNormTurn   | 1.00| 1.17| 2.25| 2.40| 6.00| 2.56|\n```\n\n## Author\n\nDeveloped by Ahmed Ibrahim. Contributions and feedback are welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fah-ibrahim%2Fcpu-process-scheduling","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fah-ibrahim%2Fcpu-process-scheduling","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fah-ibrahim%2Fcpu-process-scheduling/lists"}