Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fall 2000M.B. Ibáñez Lecture 17 Paging Hardware Support.

Similar presentations


Presentation on theme: "Fall 2000M.B. Ibáñez Lecture 17 Paging Hardware Support."— Presentation transcript:

1 Fall 2000M.B. Ibáñez Lecture 17 Paging Hardware Support

2 Fall 2000M.B. Ibáñez Characteristics of Paging and Segmentation Memory references are dynamically translated into physical addresses at run time –a process may be swapped in and out of main memory such that it occupies different regions A process may be broken up into pieces that do not need to located contiguously in main memory –All pieces of a process do not need to be loaded in main memory during execution From Operating Systems. Internals and Design Principles. W. Stalling. Prentice Hall.

3 Fall 2000M.B. Ibáñez Execution of a Program Operating system brings into main memory a few pieces of the program Resident set - portion of process that is in main memory An interrupt is generated when an address is needed that is not in main memory Operating system places the process in a blocking state From Operating Systems. Internals and Design Principles. W. Stalling. Prentice Hall.

4 Fall 2000M.B. Ibáñez Execution of a Program Piece of process that contains the logical address is brought into main memory –operating system issues a disk I/O Read request –another process is dispatched to run while the disk I/O takes place –an interrupt is issued when disk I/O complete which causes the operating system to place the affected process in the Ready state From Operating Systems. Internals and Design Principles. W. Stalling. Prentice Hall.

5 Fall 2000M.B. Ibáñez Advantages of Breaking up Process More processes may be maintained in main memory –only load in some of the pieces of each process With so many processes in main memory, it is very likely a process will be in the Ready state at any particular time It is possible for a process to be larger than all the main memory From Operating Systems. Internals and Design Principles. W. Stalling. Prentice Hall.

6 Fall 2000M.B. Ibáñez Advantages of Breaking up Processes Programmer is dealing with memory the size of the hard disk It would be wasteful to load in many pieces of the process when only a few pieces will be used Time can be saved because unused pieces are not swapped in and out of memory From Operating Systems. Internals and Design Principles. W. Stalling. Prentice Hall.

7 Fall 2000M.B. Ibáñez Types of Memory Real memory –main memory Virtual memory –memory on disk From Operating Systems. Internals and Design Principles. W. Stalling. Prentice Hall.

8 Fall 2000M.B. Ibáñez Principle of Locality Program and data references within a process tend to cluster Only a few pieces of a process will be needed over a short period of time Possible to make intelligent guesses about which pieces will be needed in the future This suggests that virtual memory may work efficiently From Operating Systems. Internals and Design Principles. W. Stalling. Prentice Hall.

9 Fall 2000M.B. Ibáñez Support Needed for Virtual Memory Hardware must support paging and segmentation Operating system must be able to management the movement of pages and/or segments between secondary memory and main memory From Operating Systems. Internals and Design Principles. W. Stalling. Prentice Hall.

10 Fall 2000M.B. Ibáñez Paging Each process has its own page table Each page table entry contains the frame number of the corresponding page in main memory A bit is needed to indicate whether the page is in main memory or not From Operating Systems. Internals and Design Principles. W. Stalling. Prentice Hall.

11 Fall 2000M.B. Ibáñez Paging Virtual Address Page Table Entry Page Number Offset PM Frame Number Other Control Bits From Operating Systems. Internals and Design Principles. W. Stalling. Prentice Hall.

12 Fall 2000M.B. Ibáñez Address Translation in a Paging System ProgramPagingMain Memory Virtual Address Register Page Table Page Frame Offset P# Frame # Page Table Ptr Page #OffsetFrame #Offset + From Operating Systems. Internals and Design Principles. W. Stalling. Prentice Hall.

13 Fall 2000M.B. Ibáñez Page Table Implemented as a set of dedicated Registers These registers should be built with very high-speed logic to make the paging address translation efficient. DEC PDP-11 is an example of such architecture. The address consists of 16 bits, and the page size is 8K. The page table consists of eight entries.

14 Fall 2000M.B. Ibáñez Page Table Kept in Main Memory Two items: –Page table in main memory –page-table base register (PTBR) points to the page table Problem: access(location i): –index into the page table using PTBR, we get the frame number –actual address = frame-number + page-offset Thus, memory access is slowed by factor of 2

15 Fall 2000M.B. Ibáñez Page Tables The entire page table may take up too much main memory Page tables are also stored in virtual memory When a process is running, part of its page table is in main memory From Operating Systems. Internals and Design Principles. W. Stalling. Prentice Hall.

16 Fall 2000M.B. Ibáñez Translation Look-aside Buffer (Associative Registers) Each virtual memory reference can cause two physical memory accesses –one to fetch the page table –one to fetch the data To overcome this problem a special cache is set up for page table entries –called the TLB - Translation Look-aside Buffer From Operating Systems. Internals and Design Principles. W. Stalling. Prentice Hall.

17 Fall 2000M.B. Ibáñez Translation Look-aside Buffer Contains page table entries that have been most recently used Works similar to main memory cache From Operating Systems. Internals and Design Principles. W. Stalling. Prentice Hall.

18 Fall 2000M.B. Ibáñez Translation Look-aside Buffer Given a virtual address, processor examines the TLB If page table entry is present (a hit), the frame number is retrieved and the real address is formed If page table entry is not found in the TLB (a miss), the page number is used to index the process page table From Operating Systems. Internals and Design Principles. W. Stalling. Prentice Hall.

19 Fall 2000M.B. Ibáñez Translation Look-aside Buffer First checks if page is already in main memory –if not in main memory a page fault is issued The TLB is updated to include the new page entry From Operating Systems. Internals and Design Principles. W. Stalling. Prentice Hall.

20 Fall 2000M.B. Ibáñez Translation Look-aside Buffer Each register consists of two parts: –A key –A value When the associative registers are presented with an item, –it is compared with all the keys simultaneously –If the item is found, the corresponding value field is output

21 Fall 2000M.B. Ibáñez Use of a Translation Look-aside Buffer Virtual Address Translation Lookaside Buffer Page Table TLB miss Page fault Real Address TLB hit Offset Main Memory Secondary Memory Load page Page #Offset Frame #Offset From Operating Systems. Internals and Design Principles. W. Stalling. Prentice Hall.

22 Fall 2000M.B. Ibáñez START CPU checks the TLB Page table entry in TLB? Access page table Page in main memory? Update TLB CPU generates Physical Address Yes No Yes Page fault handling routing No Operation of TLB


Download ppt "Fall 2000M.B. Ibáñez Lecture 17 Paging Hardware Support."

Similar presentations


Ads by Google