Kumar-laxmi / Algorithms

A Repository for algorithms in C, C++, Python and Java
Apache License 2.0
321 stars 367 forks source link

First Come First Serve [CPU Scheduling] in C, C++, Python and Java #1444

Closed Kumar-laxmi closed 1 year ago

Kumar-laxmi commented 1 year ago

Is your feature request related to a problem? Please describe. FCFS considered to be the simplest of all operating system scheduling algorithms. First come first serve scheduling algorithm states that the process that requests the CPU first is allocated the CPU first and is implemented by using FIFO queue.

Describe the solution you'd like

- Initialize the ready queue to store the incoming processes.
- Sort the processes based on their arrival time, if necessary.
- Set the current time to 0.
- While the ready queue is not empty:
   - Dequeue the first process from the ready queue.
   - Set the process's start time to the current time.
   - Execute the process until it completes.
   - Set the process's end time to the current time.
   - Calculate the process's turnaround time (end time - arrival time).
   - Calculate the process's waiting time (turnaround time - burst time).
   - Update the current time to reflect the completion of the process.
   - Repeat from step 4a for the next process in the ready queue.

Additional context image

brahmamyv commented 1 year ago

Please assign me this @Kumar-laxmi . I can code in all 4 languages.

divyansh956 commented 1 year ago

Please assign me @Kumar-laxmi

ranjanmangla1 commented 1 year ago

please assign me, i have code ready, this will be my first open source contribution @Kumar-laxmi

pra9patil commented 1 year ago

@Kumar-laxmi sir please assign me this issue, this is my first contribution to this repo under SSOC'23,I will do it in today itself

Inferno2211 commented 1 year ago

Could you assign this to me under SSOC'23? This will be my first contribution in this repo

ranjanmangla1 commented 1 year ago

I have added Pull Request for this issue, please review it

HadiaSamreen commented 1 year ago

Could you please assign this issue to me. I am very good at CPU scheduling concepts @Kumar-laxmi and beginner to contribution here.

Kumar-laxmi commented 1 year ago

Assigned! @brahmamyv : C, C++, Python and Java