Introduction (เคชเคฐเคฟเคเคฏ)
CPU Scheduling เคฎเฅเค เคธเคฟเคฐเฅเคซ process select เคเคฐเคจเคพ เคนเฅ เคเคพเคซเฅ เคจเคนเฅเค เคนเฅเคคเคพเฅค
เคฏเคน เคญเฅ เคเคฐเฅเคฐเฅ เคนเฅ เคเคฟ selection เคเคฟเคธ rule เคเฅ เคเคงเคพเคฐ เคชเคฐ เคนเฅเฅค
เคเคธเฅ rule เคเฅ Scheduling Algorithm เคเคนเคพ เคเคพเคคเคพ เคนเฅเฅค
Scheduling Algorithm เคเฅเคฏเคพ เคนเฅเคคเคพ เคนเฅ
Scheduling Algorithm เคตเคน method เคนเฅ เคเคฟเคธเคเฅ เคเคงเคพเคฐ เคชเคฐ Operating System decide เคเคฐเคคเคพ เคนเฅ เคเคฟ เคเฅเคจ เคธเคพ process CPU เคชเคนเคฒเฅ เคชเฅเคฐเคพเคชเฅเคค เคเคฐเฅเคเคพเฅค
Main Scheduling Algorithms
เค เคฌ เคนเคฎ เคเค-เคเค เคเคฐเคเฅ เคธเคญเฅ important algorithms เคธเคฎเคเคคเฅ เคนเฅเค:
1. FCFS (First Come First Serve)
Concept
เคเฅ process เคชเคนเคฒเฅ เคเคคเคพ เคนเฅ, เคตเคนเฅ เคชเคนเคฒเฅ execute เคนเฅเคคเคพ เคนเฅเฅค
Working
- Processes arrival order เคฎเฅเค execute เคนเฅเคคเฅ เคนเฅเค
- Queue เคเคพ concept use เคนเฅเคคเคพ เคนเฅ
Example
Processes:
P1, P2, P3
Arrival order:
P1 โ P2 โ P3
Execution order เคญเฅ เคตเคนเฅ เคนเฅเคเคพ:
P1 โ P2 โ P3

Advantage
- Simple เคเคฐ easy
Disadvantage
- Waiting time เคเฅเคฏเคพเคฆเคพ เคนเฅ เคธเคเคคเคพ เคนเฅ
2. SJF (Shortest Job First)
Concept
เคเคฟเคธ process เคเคพ burst time เคธเคฌเคธเฅ เคเคฎ เคนเฅเคคเคพ เคนเฅ, เคเคธเฅ เคชเคนเคฒเฅ execute เคเคฟเคฏเคพ เคเคพเคคเคพ เคนเฅเฅค
Example
Processes:
P1 (5 sec), P2 (2 sec), P3 (3 sec)
Execution order:
P2 โ P3 โ P1

Advantage
- Minimum waiting time
Disadvantage
- Long processes เคเฅ wait เคเคฐเคจเคพ เคชเคกเคผ เคธเคเคคเคพ เคนเฅ (starvation)
3. Priority Scheduling
Concept
เคนเคฐ process เคเฅ เคเค priority เคฆเฅ เคเคพเคคเฅ เคนเฅ
เคเคฟเคธเคเฅ priority เคเฅเคฏเคพเคฆเคพ เคนเฅเคคเฅ เคนเฅ, เคตเคน เคชเคนเคฒเฅ execute เคนเฅเคคเคพ เคนเฅ
Example
Processes:
P1 (priority 3), P2 (priority 1), P3 (priority 2)
Execution order:
P2 โ P3 โ P1

Advantage
- Important tasks เคเคฒเฅเคฆเฅ complete เคนเฅเคคเฅ เคนเฅเค
Disadvantage
- Low priority process starvation
4. Round Robin (RR)
Concept
เคนเคฐ process เคเฅ equal time (time quantum) เคฆเคฟเคฏเคพ เคเคพเคคเคพ เคนเฅ
Working
- Process เคเฅ fixed time เคฎเคฟเคฒเคคเคพ เคนเฅ
- Time เคเคคเฅเคฎ โ next process
Example
Processes:
P1, P2, P3
Time quantum = 2 sec
Execution:
P1 โ P2 โ P3 โ เคซเคฟเคฐ เคตเคพเคชเคธ P1

Advantage
- Fair scheduling
- No starvation
Disadvantage
- เคเฅเคฏเคพเคฆเคพ context switching
Simple Comparison
| Algorithm | Concept | Advantage | Problem |
|---|---|---|---|
| FCFS | First come first | Simple | High waiting |
| SJF | Shortest job first | Fast | Starvation |
| Priority | High priority first | Important work fast | Starvation |
| Round Robin | Time sharing | Fair | Overhead |
Important Exam Point
- Gantt Chart เคฌเคจเคพเคจเคพ เคเคจเคพ เคเคพเคนเคฟเค
- Waiting Time เคเคฐ Turnaround Time เคจเคฟเคเคพเคฒเคจเคพ เคเคคเคพ เคนเฅเคจเคพ เคเคพเคนเคฟเค
- Numerical questions เค เคเฅเคธเคฐ SJF เคเคฐ Round Robin เคธเฅ เคเคคเฅ เคนเฅเค
Conclusion
Scheduling Algorithms CPU utilization เคเฅ improve เคเคฐเคคเฅ เคนเฅเค เคเคฐ processes เคเฅ efficient เคคเคฐเฅเคเฅ เคธเฅ execute เคเคฐเคคเฅ เคนเฅเคเฅค
เคนเคฐ algorithm เคเคพ เค เคชเคจเคพ use-case เคนเฅเคคเคพ เคนเฅ, เคเคธเคฒเคฟเค situation เคเฅ เค เคจเฅเคธเคพเคฐ เคธเคนเฅ algorithm choose เคเคฟเคฏเคพ เคเคพเคคเคพ เคนเฅเฅค