Lab4: Questions
Q1. Consider the following POSIX signal example code. Can you elaborate how to design the kernel to support it?
In question 1you should explain the signal mechanism in 3 parts, signal registration
, signal generation, and signal delivery
1 |
|
signal registration: 註冊特定 signal 的 signal handler, i.e. signal(SIGINT, handler)
signal generation: 對特定 process 發起 SIGINT signal,OS 會紀錄在 task_struct 但還沒執行,稱為 pending signal
signal delivery: 等到該 process 執行,且 signal 沒有被 blocked ,執行該 signal 對應handler
Q2. Can you prevent all possible context switch by disabling interrupt?
不可,kernel task 可以藉由呼叫 schedule 主動 context switch