進程的睡眠模式類型

進程的睡眠模式類型

我在排查為什麼每次 oracle 進程被終止時我們的伺服器都會宕機時遇到了這個問題。我列出了在伺服器上運行的 oracle 進程ps aux | grep oracle,以下是輸出:

oracle   21739  0.0  0.0 165068 17488 ?        Ssl  Oct14   0:18 /apps/11203/grid/bin/mdnsd.bin
oracle   21759  0.1  0.0 176556 25672 ?        Ssl  Oct14   1:14 /apps/11203/grid/bin/gpnpd.bin
oracle   21772  0.9  0.0 249528 31320 ?        Sl   Oct14   8:04 /apps/11203/grid/bin/gipcd.bin
oracle   21830  1.1  0.0 265760 115908 ?       SLl  Oct14   9:54 /apps/11203/grid/bin/ocssd.bin
oracle   21969  0.2  0.0 268648 29148 ?        Ssl  Oct14   2:10 /apps/11203/grid/bin/evmd.bin
oracle   22246  0.0  0.0  92420 13024 ?        S    Oct14    0:00 /apps/11203/grid/bin/evmlogger.bin -o /apps/11203/grid/evm/log/evmlogger.info -l /apps/11203/grid/evm/log/evmlogger.log

是的,所有這些進程都在睡眠,從它們的狀態代碼來看,有不同類型的睡眠 - Ssl, Sl, SLl。我在谷歌上搜尋了不同類型的進程睡眠,但只找到了有關磁碟睡眠、可中斷和不可中斷睡眠的資訊。我沒有看到任何關於各種睡眠的子狀態的資訊Ssl, Sl, SLl。這裡有人知道 SsL、Sl 和 SLl 有什麼不同嗎?

根據用戶“chaos”的評論,我將這些狀態確定為:

Ssl - sleeping, is a session loader and multi-threaded. 
SL - sleeping, has pages locked into memory
Sl - sleeping, and the process is multi-threaded

那麼這些是什麼意思呢?進程是否處於“SL - 睡眠狀態,已將頁面鎖定到記憶體”,正在使用記憶體?如果有很多「SL」進程,它們是否會佔用其他進程的記憶體?

(所有這些進程的父進程都是init,如果這有什麼區別的話)。

答案1

這是來自ps線上幫助頁:

進程狀態代碼:以下是 s、stat 和狀態輸出說明符(標題「STAT」或「S」)將顯示的不同值,用於描述進程的狀態:

   D    uninterruptible sleep (usually IO)
   R    running or runnable (on run queue)
   S    interruptible sleep (waiting for an event to complete)
   T    stopped, either by a job control signal or because it is being traced.
   W    paging (not valid since the 2.6.xx kernel)
   X    dead (should never be seen)
   Z    defunct ("zombie") process, terminated but not reaped by its parent.

   For BSD formats and when the stat keyword is used, additional characters may be
   displayed:
   <    high-priority (not nice to other users)
   N    low-priority (nice to other users)
   L    has pages locked into memory (for real-time and custom IO)
   s    is a session leader
   l    is multi-threaded (using CLONE_THREAD, like NPTL pthreads do)
   +    is in the foreground process group.

相關內容