{"id":22743936,"url":"https://github.com/j-hoplin/implement_cpu_scheduler","last_synced_at":"2025-03-30T04:42:59.635Z","repository":{"id":45838541,"uuid":"495189655","full_name":"J-Hoplin/Implement_CPU_Scheduler","owner":"J-Hoplin","description":"3rd Grade 1st Semester : Operating System / Programming Assignment : Implement CPU Scheduler","archived":false,"fork":false,"pushed_at":"2022-10-05T02:44:30.000Z","size":2446,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-05T15:48:21.629Z","etag":null,"topics":["cpu-scheduler","cpu-scheduling","java","simulator"],"latest_commit_sha":null,"homepage":"","language":"Java","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/J-Hoplin.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}},"created_at":"2022-05-22T22:15:28.000Z","updated_at":"2023-05-03T07:30:41.000Z","dependencies_parsed_at":"2023-01-19T06:15:19.861Z","dependency_job_id":null,"html_url":"https://github.com/J-Hoplin/Implement_CPU_Scheduler","commit_stats":null,"previous_names":["j-hoplin/implement_cpu_scheduler"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/J-Hoplin%2FImplement_CPU_Scheduler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/J-Hoplin%2FImplement_CPU_Scheduler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/J-Hoplin%2FImplement_CPU_Scheduler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/J-Hoplin%2FImplement_CPU_Scheduler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/J-Hoplin","download_url":"https://codeload.github.com/J-Hoplin/Implement_CPU_Scheduler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246277350,"owners_count":20751548,"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":["cpu-scheduler","cpu-scheduling","java","simulator"],"created_at":"2024-12-11T01:36:52.326Z","updated_at":"2025-03-30T04:42:59.616Z","avatar_url":"https://github.com/J-Hoplin.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Implement CPU Scheduling Algorithm\n***\nSource Code / Readme Written By : 윤준호(a.k.a Hoplin)\n\nSubject : Operating System\n\nDescription : Implement CPU Scheduling. Use programming language except Script Language(Python, JavaScript...etc)\u003cbr\u003e\n\nLanguage : Java(jdk 1.8(Zulu Open JDK 11.04), Java 11)\n\nTool : [JetBrain IntelliJ IDEA Ultimate](https://www.jetbrains.com/ko-kr/idea/download/#section=mac)\n\n[운영체제 프로세스 스케줄링 관련 정리 PDF](https://github.com/J-hoplin1/OS_Implement_CPU_Scheduler/blob/main/Cpu%20Scheduler.pdf) : [Download](https://github.com/J-hoplin1/OS_Implement_CPU_Scheduler/raw/main/Cpu%20Scheduler.pdf)\n***\n### Contents Shortcut\n\n[1. How to use?](https://github.com/J-hoplin1/OS_Implement_CPU_Scheduler#how-to-use)\u003cbr\u003e\n[2. Class Diagram](https://github.com/J-hoplin1/OS_Implement_CPU_Scheduler#class-diagram)\u003cbr\u003e\n[3. Version State](https://github.com/J-hoplin1/OS_Implement_CPU_Scheduler#version-state)\u003cbr\u003e\n[4. Assignment Description](https://github.com/J-hoplin1/OS_Implement_CPU_Scheduler#assignment-description)\n\n\n***\n### How to use\n\nRequired Spec\n\n- Java : Java 8 or Upper\n- JDK\n\n```\n$ git clone https://github.com/J-hoplin1/OS_Implement_CPU_Scheduler.git\n$ cd OS_Implement_CPU_Scheduler/OperatingSystemAssignment/src\n$ javac CPUScheduler/SchedulerMain.java -encoding UTF-8\n$ java CPUScheduler/SchedulerMain --help\n```\n***\n### Class Diagram\n\u003cimg width=\"1055\" alt=\"image\" src=\"https://user-images.githubusercontent.com/45956041/175089261-d11217a7-0401-4b6e-885a-5e370d79b711.png\"\u003e\n\n***\n### TODO\n- [ ] Template Method Pattern 적용하기  \n***\n### Version State(Latest)\n\n#### [v 2.1.0](https://github.com/J-hoplin1/OS_Implement_CPU_Scheduler/tree/v-2.1.0) : 2022/06/23\n\n- Log파일 저장경로 지정\n    - 로그파일들에 대한 저장경로를 고정합니다. 로그파일 저장경로는 src/CPUScheduler/logfiles에 저장되게 됩니다.\n\n- 예외 클래스 추가\n    - 이번 버전에서는 아래 예외가 추가되었습니다.\n\n        - [DirectoryGenerateFailedException](https://github.com/J-hoplin1/OS_Implement_CPU_Scheduler/blob/main/OperatingSystemAssignment/src/CPUScheduler/Exceptions/DirectoryGenerateFailedException.java) : 디렉토리 생성 과정에서 예외에대한 예외클래스입니다.\n***\n### Assignment Description\n이 과제에서는 CPU scheduling 알고리즘에 따라 여러 가지 성능수치가 어떻게 달라지는가를 관찰하기 위한 시뮬레이션을 수행한다. 시뮬레이션 프로그램이 수행해야 할 가장 기본적인 작업은 computation과 I/O 요청을 번갈아 수행하는 process들에 대해 CPU scheduling을 수행하는 것이다. 이를 위해 다음과 같이 간단한 가정을 한다. \n\n- 각 process에 대해 그 process가 도착한 시각을 A 라고 하고, 그 process가 종료될 때까지  필요로 하는 총 CPU time을 C 라고 하자. \n- CPU burst time은 0과 어떤 수 B 사이에서 uniformly distributed random integer이다. 또한 IO burst time은 0과 어떤 수 IO 사이의 uniformly distributed random integer이다.\n프로세스는 이 4개의 파라미터 (A, C, B, IO) 에 의해 정의된다. 이 숫자들의 단위는 단순히 time unit 이다.\n\n프로그램은 n개의 프로세스들을 기술한 (즉 4개의 숫자가 한 그룹이  되는 그룹들이 n개가 있어야 할 것임) 파일을 읽어 들인 후 그 n개의 process가 모두 끝날 때까지 그 process들을 시뮬레이션 해야 한다. 이를 위한 기본적인 방법은 각 프로세스의 상태를 추적해서 필요할 때마다 상태전이(state transition)를 수행하고 시간을 전진시키는 것이다. \n\n이렇게 해서 모든 process의 수행이 끝나면 사용된 CPU scheduling 알고리즘, 사용된 파라미터(예: Round Robin방식에서 사용되는 quantum), simulate된 process의 수 등을 출력하고, 그 다음 각 process에 대해 다음과 같은 내용을 출력한다.\n\n#### About Each Process\n\n- (A,C,B,IO)\n- Finishing Time(Process End Time)\n- Turnaround Time(Finishing Time - @param A)\n- CPU Time(Total time of Process' running state)\n- I/O Time(Totla time of Process' blocked state)\n\n#### Summary of Scheduler Simulation\n\n- Finishing Time(모든 프로세스가 다 끝난 시각)\n- CPU Utilization(Percentage of time some job is running)\n- I/O Utilization(Percentage of time some job is blocked)\n- Throughput in processes completed per hundred time unit\n- Average turnaround time\n- Average waiting time\n\n#### Need to implement these types of scheduling algorithm\n\n- FCFS(First Come First Served)\n    - Non-Preemptive\n- SJF(Shortest Job First)\n    - Non-Preemptive\n- RR(Round Robin)\n    - Preemptive\n    - With Time Quantum 1\n    - With Time Quantum 10\n    - With Time Quantum 100\n\n#### Test Cases\n\n1. \u003e\u003e 1 (0 5 1 0)\n2. \u003e\u003e 1 (0 5 1 1)\n3. \u003e\u003e 3 (0 5 1 1)(0 5 1 1)(3 5 1 1)\n4. \u003e\u003e 5 (0 200 3 3)(0 500 9 3)(0 500 20 3)(100 100 1 0)(100 500 100 3)\n5. \u003e\u003e 5 (0 200 3 3)(0 500 9 3)(0 500 20 30)(100 100 1 0)(100 500 100 3)\n\n#### Results\n\n위 테스트 케이스에서 1,2,3번 케이스는 정답이 고정되어있습니다.(FCFS,SJF,RR모두 동일한 값이 나와야함) 4,5번은 I/O 랜덤값으로 인해 값이 달라질 수 있습니다.\n\n- Case 1\n```\n============= [ Summary of Scheduler ] =============\nScheduler Finishing Time : 5\nAverage turnaround time : 5.00\nAverage waiting time : 0.00\nCPU Utilization : 100.00 %\nI/O Utilization : 0.00 %\nThroughput in processes completed per hundred time units : 20.00 %\n```\n- Case 2\n```\n============= [ Summary of Scheduler ] =============\nScheduler Finishing Time : 9\nAverage turnaround time : 9.00\nAverage waiting time : 0.00\nCPU Utilization : 55.56 %\nI/O Utilization : 44.44 %\nThroughput in processes completed per hundred time units : 11.11 %\n```\n- Case 3\n\n```\n============= [ Summary of Scheduler ] =============\nScheduler Finishing Time : 15\nAverage turnaround time : 12.67\nAverage waiting time : 3.67\nCPU Utilization : 100.00 %\nI/O Utilization : 80.00 %\nThroughput in processes completed per hundred time units : 20.00 %\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj-hoplin%2Fimplement_cpu_scheduler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fj-hoplin%2Fimplement_cpu_scheduler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj-hoplin%2Fimplement_cpu_scheduler/lists"}