Algorithm
1) Choose the time quantum and assign it for each process.
2) Allocate the CPU to the process according to the FCFS scheduling.
3) If (burst time of the process < time quantum).{Allocate the CPU to that process till it terminates.}Else {The process will occupy the CPU till the time quantum and it is added to the tail of the ready queue for the next round of execution.}

What is the code of this Algorithm in c++.

the  following  states  have  been  executed  in  the CPU Scheduler
1. When a process switches from the running state to the waiting state.
2. When a process switches from the running state to the ready state
3. When a process switches from the waiting state to the ready state
4. When a process terminates

If you are giving out assignments be sure to tell if this is something you are looking for coders and what the pay is. Your post is either that or just someone that copy/pasted their homework assignment.

https://www.daniweb.com/search/index?q=CPU+Scheduling+Algorithm finds it's been kicked around before.

Also, this smells of the old pSOS system. https://en.wikipedia.org/wiki/PSOS_(real-time_operating_system)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.