Trung BìnhOperating System iconOperating System

Linux process states: R, S, D, Z, T có nghĩa gì? Khi nào process ở trạng thái D?

Linux process có 5 trạng thái chính: R (running), S (interruptible sleep), D (uninterruptible — không thể kill), Z (zombie), T (stopped) — trạng thái D là dấu hiệu storage issue nghiêm trọng.

Xem process state bằng ps aux hoặc top (cột STATUS/S):
- R (Running/Runnable): đang chạy trên CPU hoặc trong run queue chờ CPU
- S (Sleeping/Interruptible sleep): đang wait (I/O, event, timer) nhưng có thể bị interrupt bởi signal — phổ biến nhất
- D (Disk sleep/Uninterruptible sleep): đang wait I/O không thể interrupt — kernel dùng để bảo vệ critical disk I/O operation. Process ở trạng thái D không respond SIGTERM/SIGKILL — không thể kill! Phổ biến khi NFS mount bị lỗi, disk hang, hoặc storage timeout. Quá nhiều D processes là dấu hiệu storage subsystem có vấn đề
- Z (Zombie): process đã exit nhưng parent chưa wait() để thu dọn. Process zombie không tốn CPU/memory nhưng tốn PID slot. Dấu hiệu parent không handle SIGCHLD
- T (Stopped): bị dừng bởi signal (SIGSTOP, SIGTSTP = Ctrl+Z) hoặc debugger. Resume bằng SIGCONT
- I: Idle kernel thread (không phải running, không phải sleeping)

Debug: ps aux | grep ' D ' tìm D processes; strace -p PID xem syscall nào đang block.

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

Mở danh sách Operating System