{"id":26397709,"url":"https://github.com/yossef-ashraf/fifo-served-scheduling","last_synced_at":"2025-03-17T12:18:45.933Z","repository":{"id":275227798,"uuid":"906771052","full_name":"yossef-ashraf/FIFO-Served-Scheduling","owner":"yossef-ashraf","description":"This project implements a FIFO (First In, First Out) scheduling algorithm, which is a basic CPU scheduling technique used in operating systems. It schedules tasks (or processes) based on their arrival time, meaning the task that arrives first is executed first.","archived":false,"fork":false,"pushed_at":"2025-02-01T00:46:34.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-01T01:25:02.317Z","etag":null,"topics":["c","data-structures"],"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/yossef-ashraf.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":"2024-12-21T21:19:20.000Z","updated_at":"2025-02-01T00:46:37.000Z","dependencies_parsed_at":"2025-02-01T01:25:05.078Z","dependency_job_id":"f61e28a6-9ad7-475b-a2bf-7b938e622ff9","html_url":"https://github.com/yossef-ashraf/FIFO-Served-Scheduling","commit_stats":null,"previous_names":["yossef-ashraf/fifo-served-scheduling"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yossef-ashraf%2FFIFO-Served-Scheduling","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yossef-ashraf%2FFIFO-Served-Scheduling/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yossef-ashraf%2FFIFO-Served-Scheduling/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yossef-ashraf%2FFIFO-Served-Scheduling/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yossef-ashraf","download_url":"https://codeload.github.com/yossef-ashraf/FIFO-Served-Scheduling/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244031118,"owners_count":20386534,"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","data-structures"],"created_at":"2025-03-17T12:18:45.414Z","updated_at":"2025-03-17T12:18:45.924Z","avatar_url":"https://github.com/yossef-ashraf.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Full Steps to Run the Code:\n\n#### 1. Download the Project:\n- Open the link and download the project from GitHub.\n- Alternatively, use the following command in your terminal:\n  ```bash\n  git clone https://github.com/yossef-ashraf/FIFO-Served-Scheduling.git\n  ```\n\n#### 2. Navigate to the Project Folder:\n- After downloading, go to the project directory:\n  ```bash\n  cd FIFO-Served-Scheduling\n  ```\n\n#### 3. Locate the Main Code File:\n- In this repository, the main file is `FIFO.c`. This is the file that contains the code.\n\n#### 4. Compile the Code:\n- Use the following command to compile the code:\n  ```bash\n  gcc FIFO.c -o FIFO\n  ```\n  - This command compiles the code and creates an executable file named `FIFO`.\n\n#### 5. Run the Program:\n- After compiling, run the program using:\n  ```bash\n  ./FIFO\n  ```\n\n---\n\n### Explanation of the Code in `FIFO.c`:\n\n#### 1. Defining Processes (Tasks):\n- The code starts by defining the number of processes and their data:\n  ```c\n  int num_processes = 5; // Number of processes\n  int arrival_time[] = {0, 2, 4, 6, 8}; // Arrival times\n  int burst_time[] = {3, 5, 2, 4, 1}; // Burst times\n  ```\n  - Here, we have 5 processes with specific arrival and burst times.\n\n#### 2. Calculating Waiting and Turnaround Times:\n- The waiting time (`waiting_time`) and turnaround time (`turnaround_time`) are calculated for each process:\n  ```c\n  int waiting_time[5], turnaround_time[5];\n  waiting_time[0] = 0; // The first process has no waiting time\n  for (int i = 1; i \u003c num_processes; i++) {\n      waiting_time[i] = burst_time[i-1] + waiting_time[i-1];\n  }\n  for (int i = 0; i \u003c num_processes; i++) {\n      turnaround_time[i] = burst_time[i] + waiting_time[i];\n  }\n  ```\n\n#### 3. Displaying the Results:\n- The results, such as waiting time and turnaround time for each process, are printed:\n  ```c\n  printf(\"Process\\tArrival Time\\tBurst Time\\tWaiting Time\\tTurnaround Time\\n\");\n  for (int i = 0; i \u003c num_processes; i++) {\n      printf(\"%d\\t%d\\t\\t%d\\t\\t%d\\t\\t%d\\n\", i+1, arrival_time[i], burst_time[i], waiting_time[i], turnaround_time[i]);\n  }\n  ```\n\n---\n\n### Example of the Output:\nIf you run the code, the output will look like this:\n```\nProcess Arrival Time    Burst Time      Waiting Time    Turnaround Time\n1       0               3               0               3\n2       2               5               3               8\n3       4               2               8               10\n4       6               4               10              14\n5       8               1               14              15\n```\n\n#### Explanation of the Output:\n- **Process**: Process number.\n- **Arrival Time**: Time at which the process arrives.\n- **Burst Time**: Time required to execute the process.\n- **Waiting Time**: Time the process waits before it starts execution.\n- **Turnaround Time**: Total time (waiting + execution).\n\n---\n\n### How the Algorithm Works:\n1. Processes are executed in the order of their arrival (FIFO).\n2. The waiting time for each process is calculated based on the completion time of the previous process.\n3. The turnaround time for each process is calculated by adding the waiting time and burst time.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyossef-ashraf%2Ffifo-served-scheduling","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyossef-ashraf%2Ffifo-served-scheduling","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyossef-ashraf%2Ffifo-served-scheduling/lists"}