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.
Linux processes have 5 main states: R (running), S (interruptible sleep), D (uninterruptible — cannot be killed), Z (zombie), T (stopped) — state D is a serious indicator of storage issues.
View process states with ps aux or top (STATUS/S column):
- R (Running/Runnable): currently executing on a CPU or in the run queue waiting for one
- S (Sleeping/Interruptible sleep): waiting for I/O, an event, or a timer, but can be interrupted by a signal — the most common state
- D (Disk sleep/Uninterruptible sleep): waiting for I/O and cannot be interrupted — the kernel uses this to protect critical disk I/O operations. A process in state D does not respond to SIGTERM/SIGKILL — it cannot be killed! Common causes: failed NFS mounts, disk hangs, or storage timeouts. Many D-state processes indicate a problem with the storage subsystem
- Z (Zombie): the process has exited but its parent has not yet called wait() to clean it up. Zombie processes consume no CPU or memory but do occupy a PID slot. Indicates the parent is not handling SIGCHLD
- T (Stopped): halted by a signal (SIGSTOP, SIGTSTP = Ctrl+Z) or a debugger. Resume with SIGCONT
- I: Idle kernel thread (neither running nor sleeping)
Debug: ps aux | grep ' D ' to find D-state processes; strace -p PID to see which syscall is blocking.