Examples on CPU scheduling process

1. Round Robin Scheduling: This scheduling algorithm assigns a fixed time quantum to each process in a cyclic manner. Each process is allocated CPU time for a predefined time slice, and then it is moved to the end of the queue to let the next process execute.

2. First-Come, First-Served (FCFS) Scheduling: This is a non-preemptive scheduling algorithm where the process that arrives first is executed first. The CPU is allocated to the waiting process based on arrival time.

3. Shortest Job Next (SJN) Scheduling: This scheduling algorithm selects the process with the shortest burst time as the next process to execute. It minimizes the average waiting time and the number of processes in the ready queue.

4. Priority Scheduling: Each process is assigned a priority, and the process with the highest priority is executed first. Multiple processes with the same priority are scheduled using FCFS. Preemptive priority scheduling allows a running process to be interrupted if a higher-priority process enters the system.

5. Multilevel Queue Scheduling: This scheduling algorithm divides the processes into multiple separate queues based on different characteristics like priority, time quantum, etc. Each queue has its own scheduling algorithm, such as round-robin scheduling or priority scheduling. Processes are moved between queues based on their priority or other criteria.

6. Multilevel Feedback Queue Scheduling: Similar to multilevel queue scheduling, but with the ability to move processes between queues based on their behavior. Processes that use the CPU heavily may be moved to a lower-priority queue, while processes that require more CPU time may be moved to a higher-priority queue. This allows the scheduling algorithm to adapt to the behavior of different processes.

Sure! Here are some examples of CPU scheduling processes:

1. First-Come, First-Served (FCFS) Scheduling:
- Process 1 arrives at time 0 and has a burst time of 10 units.
- Process 2 arrives at time 2 and has a burst time of 5 units.
- Process 3 arrives at time 5 and has a burst time of 8 units.
- The CPU executes the processes in the order they arrive: Process 1, Process 2, Process 3.

2. Shortest Job Next (SJN) Scheduling:
- Process 1 arrives at time 0 and has a burst time of 10 units.
- Process 2 arrives at time 2 and has a burst time of 5 units.
- Process 3 arrives at time 5 and has a burst time of 8 units.
- The CPU executes the processes based on their burst time. Process 2 is executed first, followed by Process 3, and then Process 1.

3. Round Robin (RR) Scheduling:
- Process 1 arrives at time 0 and has a burst time of 10 units.
- Process 2 arrives at time 1 and has a burst time of 4 units.
- Process 3 arrives at time 2 and has a burst time of 7 units.
- The CPU executes the processes in a fixed time quantum. Let's say the time quantum is 3 units. The execution order would be: Process 1 (3 units), Process 2 (3 units), Process 3 (3 units), Process 1 (1 unit), and then Process 3 (4 units).

4. Priority Scheduling:
- Process 1 has priority 1 and a burst time of 6 units.
- Process 2 has priority 2 and a burst time of 4 units.
- Process 3 has priority 3 and a burst time of 8 units.
- The CPU executes the processes based on their priority. Process 1 with the highest priority is executed first, followed by Process 2, and then Process 3.