Multiple Choice
2. 我不懂virtual memory和logical memory之間的差別在哪裡。Virtual memory不是應該和physical memory分開的嗎?
3. 使用vfork()的情況下,創造出來的子行程通常會馬上呼叫execve,會保證child process先運行。
10. Enhanced second-choice algorithm使用reference bit和modify bit來處理page replacement。
(0, 0)的情況下代表最近沒有被reference或者modify,那就是最好的replace目標
(0, 1)代表最近有被修改過,也就是page在被replace之前必須先written out(?)。
11. 使用proportional allocation演算法來分配memory至process,按照每個process的size來分配:
Frame的數量 = process的size / 全部process的size * 全部frame的數量
12. TLB reach即是TLB能夠存取的memory數量,即等於TLB entries數量乘上page size。而hit ratio指的是當要進行virtual address translation時,能夠從TLB中找到而不是page table找到的ratio。
13. 傳統的fork()複製parent process的address space給child process,複製所有屬於parent的pages。但這常常是沒有必要的,因為許多child process會在被建立之後馬上invoke exec() (exec()是什麼?)。
Copy-on-Write可以讓parent及child process一開始共用同樣的address space。如果有任何一個process對這些pages進行更動,才會產生copy of shared page。
16. Working-set? Local page replacement policy?
31.
Slab 記憶體配置器
當 Linux 需要配置的是小量的記憶體 (像是 malloc 所需的記憶體) 時,採用的是一種稱為 Slab Allocator 的配置器,其中被配置的資料稱為物件 (Object)。 Slab中的物件會被儲存在 Buddy 系統所分配的頁框中,假如要分配一個大小為 30 bytes 的物件時,Slab 會先向 Buddy 系統要求取得一個最小的分頁 (大小為4KB),然後分配個 Slab 配置器。然後 Slab 配置器會保留一些位元以記錄配置資訊,然後將剩下的空間均分為大小30 的物件。於是當未來再有類似的配置請求時,就可以直接將這些空的物件配置出去。
32.
lock bits: 當某個frame被lock時,他不能被replace。當使用demand paging時,有時需要某些pages being locked。Pages有可能包含memory buffer,這些buffer可能是給I/O processor使用,他們可能提出I/O request並且在I/O device的queue中等待,但等待的時候包含memory buffer的pages要是被替換就會造成錯誤。
例如說,要在tape上寫入一個tape,就必須先將memory中包含這個block的pages都先lock,等寫入完才unlock。
33.
Copy-On-Write的定義
34.
在global allocation scheme中,frame可以從任何process被allocate,根據page replacement policy,例如LRU。
35.
TLB reach代表TLB能夠存取的memory amount,等同於page size * number of TLB entries。
TLB由associative memory組成,這應該是指content-addressable memory,也就是搜尋速度很快的memory。增加TLB entries的成本很高,因為這種memory很昂貴又耗能。
也可能增加支援的page size,增加page size來增加TLB reach。
36.
virtual address在heap和stack之間存在hole者稱為sparse address space。使用sparse address space能夠提供好處,因為heap和stack segment成長時這些hole可以被填滿,或者想要dynamically link libraries(或shared object)時使用。
37.
Modify bit代表這個frame is not modified(written),在replacement時,這個page不需要被寫回disk。
38.
The degree of multiprocessing不會因為virtual memory降低?
作業詳解:
9.3
什麼叫做process的locality?
如果process的working set太大了存不下free memory,system designer有幾種做法: 忽略之,或者是增加physical memory,或者是更常回收(reclaim) pages因為page fault rate會更高。
9.4
要實現Copy-On-Write的硬體有以下: 在memory-access時,page table需要紀錄某個page是否為protected。如果它的確是protected,那麼需要發生trap來告訴OS。
9.5
Virtual memory space由許多page組成。一個virtual address則是前面由page table displacement,後面由displacement into the page組成。
9.7
只有一個kernel thread服務所有user thread,因此其中一個user thread發生page fault,所有user thread都會被block。
9.9
memory address的最小單位是byte。
From what set of page frames will the LRU page-replacement algorithm choose in resolving a page
fault? - 什麼意思?
9.13
Resident pages?
當page fault發生,則在free-frame pool中的其中一個pages會被evict,讓出空間給resident pages移入free-frame pool。
如果page fault發生而該page存在在free-frame pool中,那麼它會被移到resident pages set中,而resident page set的其中一個page則是被移到free-frame pool。(看起來resident pages就是目前存在在page table中的pages?)
如果resident page數量設為1?
如果將free-frame pool的page數量設為0?因為resident pages的演算法是用FIFO,因此system degenerates into a FIFO page-replacement algorithm。
9.14
paging disk是什麼?
Install more main memory- Likely to improve CPU utilization,因為更多pages可以保持resident。
Install a faster hard disk-CPU可以更快取得資料
Add prepaging to the page fetch algorithm
Increase the page size-如果data is being accessed sequentially, it will result in fewer page fault。
9.15
太困難 先跳過
9.16
這其實就是reference bit algorithm。這方法的缺點是它忽略了locality,例如說某個page可能在process的working set中,但它卻因為沒有被reference而被evict。
2. 我不懂virtual memory和logical memory之間的差別在哪裡。Virtual memory不是應該和physical memory分開的嗎?
3. 使用vfork()的情況下,創造出來的子行程通常會馬上呼叫execve,會保證child process先運行。
10. Enhanced second-choice algorithm使用reference bit和modify bit來處理page replacement。
(0, 0)的情況下代表最近沒有被reference或者modify,那就是最好的replace目標
(0, 1)代表最近有被修改過,也就是page在被replace之前必須先written out(?)。
11. 使用proportional allocation演算法來分配memory至process,按照每個process的size來分配:
Frame的數量 = process的size / 全部process的size * 全部frame的數量
12. TLB reach即是TLB能夠存取的memory數量,即等於TLB entries數量乘上page size。而hit ratio指的是當要進行virtual address translation時,能夠從TLB中找到而不是page table找到的ratio。
13. 傳統的fork()複製parent process的address space給child process,複製所有屬於parent的pages。但這常常是沒有必要的,因為許多child process會在被建立之後馬上invoke exec() (exec()是什麼?)。
Copy-on-Write可以讓parent及child process一開始共用同樣的address space。如果有任何一個process對這些pages進行更動,才會產生copy of shared page。
16. Working-set? Local page replacement policy?
31.
Slab 記憶體配置器
當 Linux 需要配置的是小量的記憶體 (像是 malloc 所需的記憶體) 時,採用的是一種稱為 Slab Allocator 的配置器,其中被配置的資料稱為物件 (Object)。 Slab中的物件會被儲存在 Buddy 系統所分配的頁框中,假如要分配一個大小為 30 bytes 的物件時,Slab 會先向 Buddy 系統要求取得一個最小的分頁 (大小為4KB),然後分配個 Slab 配置器。然後 Slab 配置器會保留一些位元以記錄配置資訊,然後將剩下的空間均分為大小30 的物件。於是當未來再有類似的配置請求時,就可以直接將這些空的物件配置出去。
32.
lock bits: 當某個frame被lock時,他不能被replace。當使用demand paging時,有時需要某些pages being locked。Pages有可能包含memory buffer,這些buffer可能是給I/O processor使用,他們可能提出I/O request並且在I/O device的queue中等待,但等待的時候包含memory buffer的pages要是被替換就會造成錯誤。
例如說,要在tape上寫入一個tape,就必須先將memory中包含這個block的pages都先lock,等寫入完才unlock。
33.
Copy-On-Write的定義
34.
在global allocation scheme中,frame可以從任何process被allocate,根據page replacement policy,例如LRU。
35.
TLB reach代表TLB能夠存取的memory amount,等同於page size * number of TLB entries。
TLB由associative memory組成,這應該是指content-addressable memory,也就是搜尋速度很快的memory。增加TLB entries的成本很高,因為這種memory很昂貴又耗能。
也可能增加支援的page size,增加page size來增加TLB reach。
36.
virtual address在heap和stack之間存在hole者稱為sparse address space。使用sparse address space能夠提供好處,因為heap和stack segment成長時這些hole可以被填滿,或者想要dynamically link libraries(或shared object)時使用。
37.
Modify bit代表這個frame is not modified(written),在replacement時,這個page不需要被寫回disk。
38.
The degree of multiprocessing不會因為virtual memory降低?
作業詳解:
9.3
什麼叫做process的locality?
如果process的working set太大了存不下free memory,system designer有幾種做法: 忽略之,或者是增加physical memory,或者是更常回收(reclaim) pages因為page fault rate會更高。
9.4
要實現Copy-On-Write的硬體有以下: 在memory-access時,page table需要紀錄某個page是否為protected。如果它的確是protected,那麼需要發生trap來告訴OS。
9.5
Virtual memory space由許多page組成。一個virtual address則是前面由page table displacement,後面由displacement into the page組成。
9.7
只有一個kernel thread服務所有user thread,因此其中一個user thread發生page fault,所有user thread都會被block。
9.9
memory address的最小單位是byte。
From what set of page frames will the LRU page-replacement algorithm choose in resolving a page
fault? - 什麼意思?
9.10
看不懂 先跳過
9.12
MFU代表Most Frequently Used algorithm。
9.13
Resident pages?
當page fault發生,則在free-frame pool中的其中一個pages會被evict,讓出空間給resident pages移入free-frame pool。
如果page fault發生而該page存在在free-frame pool中,那麼它會被移到resident pages set中,而resident page set的其中一個page則是被移到free-frame pool。(看起來resident pages就是目前存在在page table中的pages?)
如果resident page數量設為1?
如果將free-frame pool的page數量設為0?因為resident pages的演算法是用FIFO,因此system degenerates into a FIFO page-replacement algorithm。
9.14
paging disk是什麼?
Install more main memory- Likely to improve CPU utilization,因為更多pages可以保持resident。
Install a faster hard disk-CPU可以更快取得資料
Add prepaging to the page fetch algorithm
Increase the page size-如果data is being accessed sequentially, it will result in fewer page fault。
9.15
太困難 先跳過
9.16
這其實就是reference bit algorithm。這方法的缺點是它忽略了locality,例如說某個page可能在process的working set中,但它卻因為沒有被reference而被evict。
留言
張貼留言