{"id":26776912,"url":"https://github.com/chiragobhan/cpu-scheduling","last_synced_at":"2025-03-29T04:37:12.773Z","repository":{"id":216042134,"uuid":"263910722","full_name":"chiragobhan/cpu-scheduling","owner":"chiragobhan","description":"C program for FCFS and SJF that reads input from input.txt and writes the executed output in output.txt.","archived":false,"fork":false,"pushed_at":"2020-05-14T15:20:01.000Z","size":50,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-01-08T06:50:02.750Z","etag":null,"topics":["c","cpu-scheduling","fcfs","first-come-first-serve","gcc","input-output","shortest-job-first","sjf"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chiragobhan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-05-14T12:36:49.000Z","updated_at":"2024-01-08T06:50:10.809Z","dependencies_parsed_at":"2024-01-08T07:00:18.098Z","dependency_job_id":null,"html_url":"https://github.com/chiragobhan/cpu-scheduling","commit_stats":null,"previous_names":["chiragobhan/cpu-scheduling"],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiragobhan%2Fcpu-scheduling","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiragobhan%2Fcpu-scheduling/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiragobhan%2Fcpu-scheduling/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiragobhan%2Fcpu-scheduling/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chiragobhan","download_url":"https://codeload.github.com/chiragobhan/cpu-scheduling/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246140574,"owners_count":20729797,"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":["c","cpu-scheduling","fcfs","first-come-first-serve","gcc","input-output","shortest-job-first","sjf"],"created_at":"2025-03-29T04:37:12.128Z","updated_at":"2025-03-29T04:37:12.758Z","avatar_url":"https://github.com/chiragobhan.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"## CPU Scheduling using FCFS and SJF\nC program for FCFS and SJF that reads input from input.txt and writes the executed output in output.txt. The file is compiled using GCC-TDM and hence can be directly executed using program.exe. Our goal is to determine the average waiting time and average turnaround time for each method using the same input values. This will help us understand the concept of CPU Scheduling in a better way.\n\n## Input\nThe input for the program should be supplied in \"input.txt\" as the following format:  \n\u003cprocess_id\u003e,\u003carrival_time\u003e,\u003cburst_time\u003e  \nWe will be using the following values for this example.  \n  \n![input](https://user-images.githubusercontent.com/32812640/81935233-f0fbda80-960d-11ea-9a8a-09e3dd632da4.PNG)\n\n## Execution\nOnce the values are entered, simply run program.exe to execute the algorithms.\n  \n## FCFS\nFirst Come First Serve simply queues processes in the order they arrive in the ready queue. Here, the process that comes first will be executed first and next process will start only after the previous gets fully executed.  \n  \n1. Completion Time: Time at which process completes its execution.  \n2. Turn Around Time: Time Difference between completion time and arrival time. (Turn Around Time = Completion Time – Arrival Time)  \n3. Waiting Time: Time Difference between turn around time and burst time. (Waiting Time = Turn Around Time – Burst Time)  \n  \nSo, after executing program.exe, following will be the output for FCFS:  \n  \n![fcfs](https://user-images.githubusercontent.com/32812640/81937417-3968c780-9611-11ea-866b-415d2ab2f43a.PNG)\n\n## SJF\nShortest job first (SJF) or shortest job next, is a scheduling policy that selects the waiting process with the smallest execution time to execute next. SJN is a non-preemptive algorithm.  \n  \n1. Completion Time: Time at which process completes its execution.\n2. Turn Around Time: Time Difference between completion time and arrival time. (Turn Around Time = Completion Time – Arrival Time)\n3. Waiting Time: Time Difference between turn around time and burst time. (Waiting Time = Turn Around Time – Burst Time)  \n  \nFollowing is the output for SJF:  \n  \n![sjf](https://user-images.githubusercontent.com/32812640/81938292-594cbb00-9612-11ea-9d30-060445c3164f.PNG)\n\n## Output\nBy now your output should be written in \"output.txt\". (If this file does not exist, the program will create a new file. Otherwise it will override the existing file).  \n  \n![output](https://user-images.githubusercontent.com/32812640/81936073-42f13000-960f-11ea-8ede-fd235159bc6a.PNG)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchiragobhan%2Fcpu-scheduling","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchiragobhan%2Fcpu-scheduling","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchiragobhan%2Fcpu-scheduling/lists"}