※ 引述《mqazz1 (無法顯示)》之銘言:
: 題目有點多..有沒有大大對任何一題有想法的
: 可以分享一下嗎?
: 謝謝
: 1. What is the purpose of upcall? [5%] If your OS does not support upcall such
: as Linux, how do you implement the same function of upcall? [5%]
在many-to-many或two-level module 的multithread環境下,
大多會採用一個data structure 把他放置在user thread 和 kernel thread之間,
示意圖大概長這樣:
︴ user thread
︳
︳
LWP
︳
︳
○ kernal thread
而這個LWP叫做lightweught process,沒有錯,和洪兔說的thread的別稱一樣,
為什麼我也不太懂@@?
而它的用途,我自己的解讀,主要像是在當一個虛擬的processor來控制user thread,
當然LWP自己本身是受kernel thread控制的,所以一旦kernel thread被block,
那LWP也會block。
而如果現在有一個event發生,這時候kernel就會對LWP發出Upcall,LWP裡面存在著
Upcall handler,會偵測需要block的user thread將其block,進而暫時放掉整個LWP。
而kernel再重新創造一個LWP繼續讓其他的user thread繼續運作,等到event結束,
kernel再發出Upcall,像上面說的一樣,讓原來被放掉的的LWP重新運作。
這是我自己讀恐龍本裡面讀到的@@,我的表達能力不是很好...所以如果有理解錯誤的,
請大力糾正> <"
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 203.67.167.172