心得分享

Card image cap

郭同學 報告/作業 分享經驗 05/19 05/13 OS作業

05/19 05/13 OS作業
名稱 05/13 OS作業
日期 05/19
課程名稱 作業系統
指導教師 劉艾華

1.
(1) Method of page table : The page number is used as an index into a page table. The page table contains the base address of each page in physical memory. This base address is combined with the page offset to define the physical memory address that is sent to the memory unit.
Method of TLB : When presented with an item, it is capered with all keys in TLB simultaneously . If the page number is found in the TLB, its frame number is immediately available and used to access memory. If the page number is not found in the TLB, a memory reference to the page table must be made.
(2) In the scheme of page table, every data/instruction access requires two memory accesses. One for the page table and one for the data/instruction. It may require more time. But under TLB , this scheme is associative, high-speed memory. So the search is faster.
2.
Modern computer support large address space and the page table becomes large. To prevent wasted page table from occupying memory, we can page the page table.
3.
32 bits address space with 2K (2^11) page size, then a page table may consist of up to 2 million entries (2^32/2^11=2^21).
Assuming that each entry consists of 4 bytes, requires 8 megabytes page table for each process.
4.
Contiguous memory allocation scheme suffers from external fragmentation as address spaces are allocated contiguously and holes develop as old processes die and new processes are initiated. It also does not allow processes to share code, since a process's virtual memory segment is not broken into non-contiguous fine-grained segments.
Pure segmentation also suffers from external fragmentation as a segment of a process is laid out contiguously in physical memory and fragmentation would occur as segments of dead processes are replaced by segments of new processes. Segmentation, however, enables processes to share code; for instance, two different processes could share a code segment but have distinct date segments.
Pure paging does not suffer from external fragmentation, but instead suffers from internal fragmentations. Processes are allocated in page granularity and if a page is not completely utilized, it results in internal fragmentation and a corresponding wastage of space. Paging also enables processes to share code at the granularity of pages.

更新日期:2016/5/19 上午 11:44:47