linux學習筆記之進程管理

來源:互聯網
上載者:User

標籤:linux

ps    process state

unix    system V
    BSD

ps -e    顯示所有進程(tty相關的是前台進程 ?tty無關)
    -u    使用者相關
    -f    full    format    listing
    -F    print extra    information
    -o command  選擇顯示欄位

ps aux
ps -ef
ps -eF

bsd風格    
    a
    x
    
    state:
    S    sleep
    s    session loader
    <    high priority
    N    low    priority
    l    multithread
    +    前台進程組中的進程    如與bash相關的前台進程組

    D    uninterruptible    sleeping
    R    runnable    or    running
    T    stop
    Z    zombie
    
    加[]表示核心級線程
    
    ps aux    | wc -l

    pgreb    過濾顯示某些進程

    pidof    process
    

處理序間通訊    IPC
    訊號
    共用記憶體
    proc目錄
    
    訊號    短小資訊,由一個進程發往另一個進程
        man 7 signal        kill -l
    SIGHUP    1    運行時重啟配置
    SIGINT    2    終止訊號    ctrl+c
    SIGKILL    9    立即結束
    
    kill    -signal    pid    signal    預設15
    killall    -signal    pid    進程樹
    kill -HUP     httpd
    重新讀取設定檔
    
j進程優先順序
    

   

進程:
    Task_struct  c語言實現    鏈表實現
    進程描述符  中繼資料
    雙向鏈表
    struct含有龐大的描述符資料結構。
    進程由核心切換  存在使用者態與核心態之間的切換。
    核心模式不應佔用太多時間  切換過多

    cpu密集型  批處理    時間片長  優先順序低
    io互動式        時間片短  優先順序高
    即時進程 real-time

    linux優先順序  proority
    即時優先順序  1-99 數字越小 優先順序越低
    靜態優先順序  100-139  數字越小 優先順序越高
    即時優先順序高於靜態優先順序
    
    核心進程常為即時優先順序   rt即時優先順序
    
    nice 調整靜態優先順序    Nice -20  ~   19   對應  100-139  預設nice 0 優先順序120

    進程隊列  兩個 活動隊列  到期隊列
    活動時調換兩個隊列  活動  到期  調換    o(1)演算法

    CFQ complete fair queue
    SCHED_Other  更適用於案頭系統

    cow Copy On Write 寫時複製 先與父進程共用資源 子進程要修改則複製

    RT
    SCHED_FIFO
    SCHED_RR

    100-139
    SCHED_Other
    
    SCHED_BATCH
    SCHED_IDLE

    memory controller
    get address
    read/write

    三級緩衝是共用的  存在競爭
    
    numa  no union memory access

    核心重新平衡記憶體訪問
    
    
    
    
    



   

    
    
   

linux學習筆記之進程管理

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.