DOC PREVIEW
U of I CS 241 - System Programming

This preview shows page 1-2-16-17-18-33-34 out of 34 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Partitions and PagingCS241 AdministrativeKey conceptsMemory Management with Bit MapsMemory Management with Linked ListsAllocation schemesStorage Placement StrategiesSlide 8Slide 9Solve Fragmentation w. CompactionOr… use Multiple Base RegistersStorage Management ProblemsSlide 13How Bad Is Fragmentation?DiscussionPagingBenefits of Virtual MemoryPaging RequestSlide 19Slide 20Slide 21Slide 22Slide 23Page Mapping HardwareSlide 25Paging IssuesSlide 27Slide 28Slide 29Paging - Caching the Page TablePaging Implementation IssuesSlide 32Slide 33Slide 34CS 241 Spring 2007System Programming 01/14/19 CS241 © 2007 LA, RHC and YZ, All Rights Reserved1Partitions and PagingCS 241 Lecture 29Stallings: Ch 7[317-322],Ch 8[333-352] Lawrence Angrave2CS241 AdministrativeRead Stallings Chapter 7 about Memory Management Regular Quiz 9 this week on Memory ManagementDiscussion Sessions this week (on Memory Management – needed for LMP2)LMP2 is on (Deadline April 16, but Part I has deadline April 9) – start early3Key conceptsFragmentation Issues of Fixed PartitioningDynamic PartitioningMemory Management Data StructuresStorage Placement StrategiesCompactionFragmentation IssuesPaging ConceptPage/FramesPage Table4Memory Management with Bit MapsPart of memory with 5 processes, 3 holestick marks show allocation unitsshaded regions are freeCorresponding bit mapLink list5Memory Management with Linked ListsFour neighbor combinations for the terminating process X6Allocation schemesBitmap and link listWhich one occupies more space?Depending on the individual memory allocation scenario. In most cases, bitmap usually occupies more space.Which one is faster reclaim freed space?On average, bitmap is faster because it just needs to set the corresponding bitsWhich one is faster to find a free hole?On average, a link list is faster because we can link all free holes together7Storage Placement StrategiesAt a memory allocation request, which free hole to use?Best fit. Worst Fit.First Fit.8Storage Placement StrategiesBest fitUse the hole whose size is equal to the need, or if none is equal, the whole that is larger but closest in size. Rational?First fitUse the first available hole whose size is sufficient to meet the needRational?Worst fitUse the largest available holeRational?9Storage Placement StrategiesEvery placement strategy has its own problemBest fitCreates small holes that cant be used Worst FitGets rid of large holes making it difficult to run large programs First FitCreates average size holes10Solve Fragmentation w. CompactionMonitor Job3FreeJob5 Job6Job7 Job85Monitor Job3FreeJob5 Job6Job7 Job86Monitor Job3FreeJob5 Job6Job7 Job87Monitor Job3FreeJob5 Job6Job7 Job88Monitor Job3FreeJob5 Job6Job7 Job8911Or… use Multiple Base RegistersBreak programs into smaller units because they will fit betterUse multiple base registers, one for each unitExamples Code/DataConstants/variables12Storage Management ProblemsFixed partitions suffer frominternal fragmentationVariable partitions suffer fromexternal fragmentationCompaction suffers from overhead13Storage Management ProblemsPartitions must be less in size than real memoryOverlays are painful to program efficientlySwapping requires writing to disk sectors14How Bad Is Fragmentation?Statistical arguments - Random sizesFirst-fitGiven N allocated blocks0.5N blocks will be lost because of fragmentationKnown as 50% RULE15DiscussionWhat schemes could be used to overcome fragmentation?What does the use of secondary storage for swap space imply about memory organization?16PagingProvide user with virtual memory that is as big as user needsStore virtual memory on diskCache parts of virtual memory being used in real memoryLoad and store cached virtual memory without user program intervention17Benefits of Virtual MemoryUse secondary storage($)Extend DRAM($$$) with reasonable performanceProtectionPrograms do not step over each otherConvenienceFlat address spacePrograms have the same view of the worldLoad and store cached virtual memory without user program intervention Reduce fragmentation: make cacheable units all the same size (page)Remove memory deadlock possibilities:permit pre-emption of real memory18Paging Request3 1234DiskCacheVirtualMemoryStoredonDisk1 2 3 4 5 6 7 81 2 3 41234PageTableVM FrameRealMemoryRequestAddresswithinVirtualMemoryPage319Paging3 11 234DiskCacheVirtualMemoryStoredonDisk1 2 3 4 5 6 781 2 3 41234PageTableVM FrameRealMemoryRequestAddresswithinVirtualMemoryPage120Paging3 116234DiskCacheVirtualMemoryStoredonDisk1 2 3 4 5 6 7 81 2 3 41234PageTableVM FrameRealMemoryRequestAddresswithinVirtualMemoryPage621Paging3 116234DiskCacheVirtualMemoryStoredonDisk1 2 3 4 5 6 7 81 2 3 41234PageTableVM FrameRealMemoryRequestAddresswithinVirtualMemoryPage2222Paging3 116234DiskCacheVirtualMemoryStoredonDisk1 2 3 4 5 6 7 81 2 3 41234PageTableVM FrameRealMemoryStoreVirtualMemoryPage1todisk2RequestAddresswithinVirtualMemory823Paging3 16234DiskCacheVirtualMemoryStoredonDisk1 2 3 4 5 6 7 81 2 3 41234PageTableVMFrameRealMemory2LoadVirtualMemoryPage8tocache8824Page Mapping HardwareContents(P,D)Contents(F,D)P DF DP->F0101101PageTableVirtualMemoryPhysicalMemoryVirtualAddress(P,D)PhysicalAddress(F,D)PFDDP25Page Mapping HardwareContents(4006)Contents(5006)004 006005 0064->50101101PageTableVirtualMemoryPhysicalMemoryVirtualAddress(004006)PhysicalAddress(F,D)0040050060064Pagesize1000NumberofPossibleVirtualPages1000NumberofPageFrames826Paging Issuessize of page is 2n , usually 512, 1k, 2k, 4k, or 8kE.g. 32 bit VM address may have 220 (1 meg) pages with 4k (212 ) bytes per pageRational?27Paging Issues220 (1 meg) 32 bit page entries take 222 bytes (4 meg)page frames must map into real memory28Paging IssuesQuestionPhysical memory size: 32 MB (2^25 ) Page size 4K bytesHow many pages? 2^13Page Table base register must be changed for context switchWhy?Different page tableNO external fragmentationInternal fragmentation on last page ONLY29DiscussionHow


View Full Document

U of I CS 241 - System Programming

Documents in this Course
Process

Process

28 pages

Files

Files

37 pages

File I/O

File I/O

52 pages

C Basics

C Basics

69 pages

Memory

Memory

23 pages

Threads

Threads

14 pages

Lecture

Lecture

55 pages

C Basics

C Basics

24 pages

Signals

Signals

27 pages

Memory

Memory

45 pages

Threads

Threads

47 pages

Threads

Threads

28 pages

LECTURE

LECTURE

45 pages

Threads

Threads

30 pages

Threads

Threads

55 pages

Files

Files

37 pages

SIGNALS

SIGNALS

22 pages

Files

Files

37 pages

Threads

Threads

14 pages

Threads

Threads

13 pages

Load more
Download System Programming
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view System Programming 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 System Programming 2 2 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?