{"id":16909448,"url":"https://github.com/yjdoc2/os-project","last_synced_at":"2025-04-12T16:50:42.796Z","repository":{"id":100667005,"uuid":"257293593","full_name":"YJDoc2/OS-Project","owner":"YJDoc2","description":"A project done for OS course, extending a kernel from https://github.com/dthain/basekernel, to implement threading capabilities, give an API for threading, and implement various scheduling techniques. ","archived":false,"fork":false,"pushed_at":"2020-04-20T13:43:31.000Z","size":3907,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T11:11:19.799Z","etag":null,"topics":["c","kernel","operating-system","os-dev","scheduling-policies","threading"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/YJDoc2.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":"2020-04-20T13:42:43.000Z","updated_at":"2024-07-06T13:50:23.000Z","dependencies_parsed_at":"2023-05-16T16:00:31.915Z","dependency_job_id":null,"html_url":"https://github.com/YJDoc2/OS-Project","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YJDoc2%2FOS-Project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YJDoc2%2FOS-Project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YJDoc2%2FOS-Project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YJDoc2%2FOS-Project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YJDoc2","download_url":"https://codeload.github.com/YJDoc2/OS-Project/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248601218,"owners_count":21131607,"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","kernel","operating-system","os-dev","scheduling-policies","threading"],"created_at":"2024-10-13T18:55:50.071Z","updated_at":"2025-04-12T16:50:42.790Z","avatar_url":"https://github.com/YJDoc2.png","language":"C","readme":"# OS Project\n\n## Implementation of kernel level threads and scheduling algorithms\n\n### Contributors :\n\nThis was done as SE OS Project by Vatsal Soni,Yashodhan Joshi, Yatharth Vyas.\n\n### We are thankful for repo \u003ca href='https://github.com/dthain/basekernel'\u003eBasekernel\u003c/a\u003e upon which we have built this project.\n\n### About\n\nWe used an open source basic kernel that was available on GitHub : basekernel. It has some basic functions such as Round Robin Scheduling, a basic shell,and some system call such as fork,exec,etc. We then implemented Syscalls in the Kernel to make a new thread and start running given function to it.\nWe based the thread design after linux kernel-level thread structure, where thread is basically a lightweight process, which shares the page-tables and file descriptors with the process that created them.\nWe also created function as wrappers for the syscalls, similar to pthread api.\n\nWe then implemented various Scheduling policies for the process/thread scheduling in kernel. By default the kernel would use a Round- Robin policy, which we changed with :\n\n\u003col\u003e\n\u003cli\u003ePriority Scheduling, No preemption. (P with FCFS) With fixed priorities\u003c/li\u003e\n\u003cli\u003ePriority Scheduling, With Preemption (P with RR) With Fixed priorities\u003c/li\u003e \n\u003cli\u003ePriority Scheduling, With Preemption (P with RR) With Dynamically assigned and changing priorities.\u003c/li\u003e\n\u003c/ol\u003e\n\nFirst two approaches use standard priority scheduling with normal FCFS and RR techniques.\nAfter that we tried to implement an algorithms that can change priority assigned to a process/thread dynamically ( while running) and schedule next process/thread as per the priorities with RR, which can be said to be similar with multi-stage feed back queue type scheduling.\nIn this,instead of ‘priority’ we designed a penalty system, and the process with lowest penalty is the process of highest priority.\n\nFor this we considered two assumption:\n\n\u003col\u003e\n\u003cli\u003eAny process ideally, must complete as soon as possible, and the more time it takes to complete, it will go on having less and less priority as per the multi-stage feed back queue policy.\u003c/li\u003e\n\u003cli\u003eAny process making syscall must be given penalty , as it takes time to switch from user level to kernel level to complete the syscall and then to switch back again to user level. The penalty given will depend on the syscall made, as the syscall to exit or yield process actually stops the process’s execution, and thus should be given less penalty and syscall related to user(or in-general) IO can take long time, and should be given more penalty.\u003c/li\u003e\n\u003c/ol\u003e\n\nThus according to these we give a penalty of some measure, every n\u003csup\u003eth\u003c/sup\u003e time the process is scheduled (as it is rare to complete the work in single allotted time-slice), and for every syscall made, acording to the syscall made, until a saturation level is reached , after which no penalty is applied.\n\nThe process with least penalty is scheduled first, and between processes of same penalty level, RR is applied. In case a process makes a syscall with IO request, it is heavily penalized, making it with lower priority wrto others, but if other keep running for a long time , even without a syscall requirement, they will be given penalty and finally be on same level as the one which made the IO request.\n\nThus this guarantees that within same priority level no starvation will occur, but can occur for lower priority process , i.e. which are making large amount of syscalls , but if not many new processes are incoming, eventually all will be of same priority and thus even that starvation will not occur and eventually all processes will be scheduled with same time slice.\n\n### NOTE : This was done as a learning project for Operating Systems, and may not be (probably is not) the optimal or best or optimized solution.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyjdoc2%2Fos-project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyjdoc2%2Fos-project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyjdoc2%2Fos-project/lists"}