close

exec()可重新載入可執行檔

把可執行檔的machine code 搬進 process 的 memory

然後呼叫可執行檔之中的main 函式

(如果被執行就像失憶一樣,但PID不會變)

fork()建立一個child process

完整的複製一份Process

正本的fork函式會回傳副本的PID

複本的fork回傳值是0

 

Signal handling

signals 是UNIX系統中通知特別事件發生

被特殊事件產生

被傳遞給process

如果被傳遞,就要被處理(default signal handler user-defined signal handler)

選項:

傳給有允許的(signal applies)

傳給每一個

傳給確定的

指定一個thread 來接收所有 signals

 

Thread Cancellation : task of terminating (在完成之前的)

target thread 被取消

1.非同步取消 (asynchronous cancellation)

立即結束執行緒

2.延遲取消 (deferred cancellation)

執行緒週期性的檢查是否取消

 

cancellation modes

Mode State Type
Off Disable  
Deferred Enable Deferred
Asynchrous Enable Asynchrous

 

 

 

 

pthread 可以設定要啥 (cancellation points)

預設是 deferred cancellation

asynchronous cancellation 不推薦

 

Thread local storage (TLS)

讓指定多個執行緒中的每個執行緒來配置位置

以儲存執行緒特定資料 (using a thread pool)

Scheduler activations

LWP lightweight process process

介於user thread 和 kernel thread之間的資料結構

提供一個虛擬處理器讓application 執行排班

 

How many? (決定)

CPU-bound application

I/O-intensive application

如何執行?(Scheduler activations)

upcalls(向上呼叫)到kernel to the thread library

 

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 cc08310112tw 的頭像
    cc08310112tw

    墨墨喵喵喵

    cc08310112tw 發表在 痞客邦 留言(3) 人氣()