Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 2 - Memory Management, Early Systems Ivy Tech State College Northwest Region 01 CIS106 Microcomputer Operating Systems Gina Rue CIS Faculty.

Similar presentations


Presentation on theme: "Chapter 2 - Memory Management, Early Systems Ivy Tech State College Northwest Region 01 CIS106 Microcomputer Operating Systems Gina Rue CIS Faculty."— Presentation transcript:

1 Chapter 2 - Memory Management, Early Systems Ivy Tech State College Northwest Region 01 CIS106 Microcomputer Operating Systems Gina Rue CIS Faculty

2 2 Memory Manager Four types of memory allocation schemes single-user systemssingle-user systems fixed partitionsfixed partitions dynamic partitionsdynamic partitions re-locatable dynamic partitionsre-locatable dynamic partitions

3 3 Memory Manager Memory performance is dependent on two things:Memory performance is dependent on two things: –how much memory is available –how it is optimized while jobs are being processed

4 See Single User Algorithm p.184 Single-user Contiguous Scheme First memory allocation scheme early computers had limited memoryearly computers had limited memory allocated as much contiguous spaceallocated as much contiguous space –if the job was too large, it couldn’t execute jobs processed sequentiallyjobs processed sequentially –OS algorithm used to allocate memory did not support multiprogrammingdid not support multiprogramming

5 See Table & Fig. 2.1 p.205 Fixed-Partitions First attempt to allow for multiprogrammingFirst attempt to allow for multiprogramming created within main memory - one partition for each jobcreated within main memory - one partition for each job to protect job’s memory space criticalto protect job’s memory space critical –algorithm used to store jobs in memory, size of job must match size of partition –major drawback: internal fragmentation is unused space within the fixed partition

6 See Fig. 2.2 p.226 Dynamic Partitions available memory kept in contiguous blocksavailable memory kept in contiguous blocks jobs are given only as much memory as they request when loaded for processingjobs are given only as much memory as they request when loaded for processing first-come first-served priority basisfirst-come first-served priority basis –subsequent allocation of memory creates fragments –called external fragmentation, free memory blocks between allocated memory

7 7 Best-Fit vs First-Fit Allocation New jobs come into the system, the free partitions must be allocated first-fitfirst-fit first partition fitting the requirement, low to high order memory list best-fitbest-fit closest fit, smallest partition fitting the requirements, smallest to largest memory list For both schemes, memory manager keeps lists of free & used partitions (free/busy) by size or location See Table 2.2 & 2.3 p.24

8 8 Best-Fit vs First-Fit Allocation Which is best? For many years, no answerFor many years, no answer best-fit resulted in a better “fit”, it also resulted in smaller “free” space (sliver)best-fit resulted in a better “fit”, it also resulted in smaller “free” space (sliver) In recent years, access times have improved so that the scheme that saves more resources & memory space is the best choiceIn recent years, access times have improved so that the scheme that saves more resources & memory space is the best choice Research continues to find the optimum allocation schemeResearch continues to find the optimum allocation scheme

9 9 Deallocation Deallocation Memory space must be released fixed partitions - when a job is complete, the memory manager resets status of memory block where the job was stored to “free”fixed partitions - when a job is complete, the memory manager resets status of memory block where the job was stored to “free” dynamic partitions - more complex algorithm tries to combine free areas of memory wherever possibledynamic partitions - more complex algorithm tries to combine free areas of memory wherever possible 3 alternative situations systems must prepare for deallocation –block is adjacent to another free block –block is between two free blocks –block is isolated from other free blocks

10 10 Relocatable Dynamic Partitions Both fixed & dynamic leave “slivers” of memory left over Solution - Memory Manager relocates programs to gather together all empty blocks & compact them into one large enough to accommodate jobs waiting compaction - every program in memory must be relocated so they are contiguous

11 11 Relocatable Dynamic Partitions What goes on behind the scenes when relocation and compaction take place? What keeps track of how far each job has moved from its original location? Special-purpose registers are used to help with relocationSpecial-purpose registers are used to help with relocation bound register-stores highest or lowest location in memory accessible by each programbound register-stores highest or lowest location in memory accessible by each program relocation register-contains the value that must be added to each address referenced in the programrelocation register-contains the value that must be added to each address referenced in the program

12 12 Relocatable Dynamic Partitions What lists have to be updated? After relocation & compaction, both free lists and busy lists are updatedAfter relocation & compaction, both free lists and busy lists are updated Each job will have a new address except for those that already reside in the lowest memory locationsEach job will have a new address except for those that already reside in the lowest memory locations

13 13 Relocatable Dynamic Partitions In effect, by compacting & relocating, by compacting & relocating, the Memory Manager optimizes the use of memory thus improves throughput -- one of the measures of the system performance. The crucial factor is the timing of the compaction….

14 14 Relocatable Dynamic Partitions Compaction - when & how often should it be done? –When a certain % of memory becomes busy, 75 percent –Only when there are jobs waiting to get in – After a prescribed amount of time The best choice depends on the job mix to optimize both processing time & memory use while keeping overhead low

15 15 Summary 4 memory management techniques4 memory management techniques – single-user, fixed partitions, dynamic partitions, relocatable partitions –all 4 require that the entire program loaded into memoryloaded into memory be stored contiguouslybe stored contiguously remain in memory until the job is completedremain in memory until the job is completed

16 16 Summary 4 memory management techniques (schemes)4 memory management techniques (schemes) – sufficient for first 3 generations of computers which processed jobs in batch mode –turnaround time was delayed to hours or even days between job submission and completion


Download ppt "Chapter 2 - Memory Management, Early Systems Ivy Tech State College Northwest Region 01 CIS106 Microcomputer Operating Systems Gina Rue CIS Faculty."

Similar presentations


Ads by Google