Trung BìnhOperating System iconOperating System

Multilevel Feedback Queue (MLFQ) scheduler hoạt động như thế nào? Linux CFS là gì?

MLFQ ưu tiên interactive processes bằng cách tự động hạ priority của CPU-bound tasks; Linux CFS thay thế MLFQ bằng vruntime tracking để đảm bảo công bằng mà vẫn ưu tiên interactive.

MLFQ: nhiều queue với priority khác nhau (Q0 highest priority, Q_n lowest). Rules: process mới vào Q0 (highest); nếu dùng hết time quantum → demote xuống queue thấp hơn (CPU-bound); nếu yield trước hết quantum (I/O-bound) → giữ hoặc promote; priority boost định kỳ (tất cả lên Q0) để tránh starvation. Kết quả: interactive processes (editor, browser) luôn responsive; CPU-bound background tasks chạy khi không có interactive job. Linux CFS (Completely Fair Scheduler): không dùng fixed time quantum — track vruntime (virtual runtime) của mỗi process, chọn process có vruntime nhỏ nhất để chạy tiếp. Process I/O-bound có vruntime nhỏ (ít chạy) → được ưu tiên cao khi wakeup. Nice value (-20 đến +19) tăng/giảm vruntime growth rate. Real-time scheduling: SCHED_FIFO, SCHED_RR cho realtime processes — preempt CFS processes. Practical: nice, renice command điều chỉnh priority; chrt set realtime policy; container CPU limits dùng CFS bandwidth controller (cpu.cfs_quota_us).

Xem toàn bộ Operating System cùng filter theo level & chủ đề con.

Mở danh sách Operating System