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
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.