New version page

UT CS 372 - Memory Management Basics

Documents in this Course
MapReduce

MapReduce

17 pages

Processes

Processes

19 pages

MapReduce

MapReduce

17 pages

Load more

This preview shows page 1 out of 4 pages.

View Full Document
View Full Document

End of preview. Want to read all 4 pages?

Upload your study docs or become a GradeBuddy member to access this document.

View Full Document
Unformatted text preview:

18MemoryManagementBasicsAreWeDone?Segmentation allows sharing… but allocation/deallocation of arbitrary size segments iscomplex Yields external fragmentationHow can we improve memory management?Solution: Paged segmentation! Partition segments into fixed-size pages Allocate and deallocate pages Contiguous pages in VAS need not be contiguous in PAS No external fragmentation, but internal fragmentation possible19ImplementingPagedSegmentationIndividual segments can be implemented as a paged, virtualaddress space A segment address address is a pair (s, va) or a triple (s, (p, o))s — segment numberp — page number (pmax pages)o — page offset (omax bytes/pages)0snVirtual address = (s ×pmax +p) × omax + op o20ImplementingPagedSegmentationCombiningsegmentationandpagingAdd one additional level of indirection to the page tableSegment S’sPage Table019 915s o011 9f oPhysicalAddressesVirtualAddressesCPUCPUProcess P’sSegment Tablepage tablepfsSTBRSTBRp++++MemoryMemory21SharinginPaged-SegmentedSystemsSharingsegmentsIf segments are paged then page tables are automaticallyshared Processes need only agree on a number for the shared segmentShared SegmentPage Tablejmp (p,o)57(p,o)f = 0f = 2f = 1A’s Segment Tablesshared segheap segcode segB’s Segment Tablesshared segheap segcode segPhysical Memory1Virtual Memory andAddress Translation2Virtual MemoryConceptKey problem: How can one support programs thatrequire more memory than is physically available?Hide all physical aspects of memory from users Memory is a logically unbounded virtual address spaceof 2n bytes Only portions of VAS are in physical memory at anyone timeIssues Placement strategies Where to place programs in physical memory Replacement strategies What to do when there exist more processes than canfit in memory Load control strategies Determining how many processes can be in memory atone time02n-1ProgramP’sVAS3Realizing Virtual MemoryPagingPhysical memory partitioned into equalsized page frames(0,0)(fMAX-1,oMAX-1)PA:f o(f,o)foPhysicalMemory1log2 omaxlog2 (fmax × omax)A memory address is a pair (f, o)f — frame number (fmax frames)o — frame offset (omax bytes/frames)Physical address = omax×f + o40Physical Address SpecificationsFrame/Offset pair v. An absolute indexExample: A 16-bit address space with (omax=) 512 byte page frames Addressing location (3, 6) = 1,54219PA:16(0,0)(3,6)foPhysicalMemory111 0 100000000003 61,542101,54205Realizing Virtual MemoryPagingA process’s virtual address space ispartitioned into equal sized pagespage = page frame(0,0)2n-1 =(pMAX-1,oMAX-1)p o(p,o)pVA:oVirtualAddressSpace1log2 oMAXlog2 (pmax×omax)A virtual address is a pair (p, o)p— page number (pmax pages)o— page offset (omax bytes/pages)Virtual address = omax×p + o6PagingMapping virtual addresses to physical addressesPages map to framesPages are contiguous in a VAS... But pages are arbitrarily locatedin physical memory, and Not all pages mapped at all timesVirtualAddressSpace(p1,o1)(p2,o2)PhysicalMemory(f1,o1)(f2,o2)7Page TablePagingVirtual address translationA page table maps virtualpages to physical framesCPUCPU(p,o)pP’sVirtualAddressSpacePhysicalMemory120 910p o(f,o)116 910f oPhysicalAddressesProgramPProgramPVirtualAddressesf8Virtual Address Translation DetailsPage table structureContents: Flags — dirty bit, resident bit,clock/reference bit Frame number1 0Page Tablep120 910p o116 910f oPhysicalAddressesVirtualAddressesf0PTBRPTBRCPUCPU+1 table per processPart of process’s state91 0 0 0 1 0 0Virtual Address Translation DetailsExampleA system with 16-bit addresses 32 KB of physical memory 1024 byte pagesCPUCPUPage TablePhysicalMemory15 1011p o(4,1023)15 1011f oPhysicalAddressesVirtualAddresses1 0 0 0 0 0 0P’sVirtualAddressSpace(3,1023)(4,0)(0,0)000010Virtual Address TranslationPerformance IssuesProblem — VM reference requires 2 memory references! One access to get the page table entry One access to get the dataPage table can be very large; a part of the page table can beon disk!! For a machine with 64-bit addresses and 1024 byte pages, whatis the size of a page table?What to do? Most computing problems are solved by some form of… Caching


View Full Document
Loading Unlocking...
Login

Join to view Memory Management Basics and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Memory Management Basics and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?