1 / 18

Two-Level Paging System

CS 345. Discussion

Jims
Download Presentation

Two-Level Paging System

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


    1. CS 345 Discussion #24 - Project 5 1 Two-Level Paging System

    2. CS 345 Discussion #24 - Project 5 2 Virtual Memory

    3. CS 345 Discussion #24 - Project 5 3 Page Table Entry

    4. CS 345 Discussion #24 - Project 5 4 Virtual to Physical Address

    5. CS 345 Discussion #24 - Project 5 5 unsigned short int *getMemAdr(int va, int rwFlg) { if (va < 0x3000) return &memory[va]; // turn off virtual addressing for system RAM rpta = p.rpt + RPTI(va); rpte1 = MEMWORD(rpta); rpte2 = MEMWORD(rpta+1); if (DEFINED(rpte1)) { // rpte defined } else // rpte undefined 1. get a UPT frame from memory (may have to free up frame) { // 2. if paged out (DEFINED) load swapped page into UPT frame // else initialize UPT frame = getFrame(-1); rpte1 = SET_DEFINED(frame); if (PAGED(rpte2)) // UPT frame paged out - read from SWAPPAGE(rpte2) into frame { accessPage(SWAPPAGE(rpte2), frame, PAGE_READ); } else // define new upt frame and reference from rpt { rpte1 = SET_DIRTY(rpte1); rpte2 = 0; // undefine all upte's } } MEMWORD(rpta) = rpte1 = SET_REF(rpte1); // set rpt frame access bit MEMWORD(rpta+1) = rpte2; upta = (FRAME(rpte1)<<6) + UPTI(va); upte1 = MEMWORD(upta); upte2 = MEMWORD(upta+1); if (DEFINED(upte1)) { // upte defined } else // upte undefined 1. get a physical frame (may have to free up frame) (x3000 - limit) (192 - 1023) { // 2. if paged out (DEFINED) load swapped page into physical frame // else new frame } return &memory[(FRAME(upte1)<<6) + FRAMEOFFSET(va)]; // return physical address} }

    6. CS 345 Discussion #24 - Project 5 6 Frame Bit Table

    7. CS 345 Discussion #24 - Project 5 7 setFrameTableBits

    8. CS 345 Discussion #24 - Project 5 8 getAvailableFrame

    9. CS 345 Discussion #24 - Project 5 9 accessPage

    10. CS 345 Discussion #24 - Project 5 10 vma

    11. CS 345 Discussion #24 - Project 5 11 Global Clock

    12. Discussion #23 – Virtual Memory Project 12 Implementation

    13. Discussion #23 – Virtual Memory Project 13 Implementation

    14. Discussion #23 – Virtual Memory Project 14 Implementation

    15. CS 345 Discussion #24 - Project 5 15 Implementation Demo

    16. CS 345 Discussion #24 - Project 5 16 So… 1. Read and comprehend Stallings, Section 8.1. 2. Comprehend the lab specs. Discuss questions with classmates, the TA’s and/or the professor. Make sure you understand what the requirements are! It's a tragedy to code for 20 hours and then realize you're doing everything wrong. 3. Enable Project 5 by changing #define PROJECT to 5 and verify a clean assembly. 4. Validate that the demo LC-3 simulator works for a single task with pass-through addressing (virtual equals physical) for the LC-3 “run crawler.hex” and “run memTest.hex” programs. 5. Design your MMU. Break the problem down into manageable parts. (See step 8 below.) 6. Create structures for PTEs, frame allocation, and Swap Page allocation. Decide how you want to extract the values for the various fields in PTEs and VM addresses. 7. Either use the paging routines provided or code your own to handle the swap space.

    17. CS 345 Discussion #24 - Project 5 17 So… 8. Incrementally add support for the actual translation of virtual addresses to physical addresses with page fault detection as follows: a. Implement page fault frame replacement using available memory frames only. This should allow you to execute a test program in a full address space. b. Implement clock page replacement algorithm to unload data frames to swap pages and reload with a new frame or an existing frame from swap space. This should allow you to execute all the test programs in a 32k word address space (20k of paging frames). c. Implement clock page replacement of User Page Tables when there are no physical data frame references in the UPT. This will be necessary when running in a small physical space (1k words) with multiple tasks. 9. Design and implement virtual/physical/table memory display functions into your CLI as soon as possible. A highly suggested CLI routine would access a single virtual memory location and then display any non-zero RPT and UPT entries. Implement various levels of debug trace to watch what is going on in your MMU. You may use the provided display functions where feasible.

    18. CS 345 Discussion #24 - Project 5 18 Finally… Design and implement virtual/physical/table memory display functions into your CLI as soon as possible. A highly suggested CLI routine would access a single virtual memory location and then display any non-zero RPT and UPT entries. Implement various levels of debug trace to watch what is going on in your MMU. You may use the provided display functions where feasible. ENJOY!!!

More Related