1 / 13

Memory Management - 3

Review. Dynamic partitions algorithm.First-fit allocation.Best-fit allocation.Deallocation.. Disadvantages of previous methods. Fixed partitions: internal fragmentations.Dynamic partitions: external fragmentations.Many jobs have to wait.Solution: programs must be relocated (moved) to gather th

ethelda
Télécharger la présentation

Memory Management - 3

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. Memory Management - 3 OS, 5th lecture

    2. Review Dynamic partitions algorithm. First-fit allocation. Best-fit allocation. Deallocation.

    3. Disadvantages of previous methods Fixed partitions: internal fragmentations. Dynamic partitions: external fragmentations. Many jobs have to wait. Solution: programs must be relocated (moved) to gather the free blocks together to make one block that is large enough to accommodate some or all of the waiting jobs.

    4. Relocatable Dynamic partitions

    5. Relocatable dynamic partitions Collecting the free blocks together is called, Combaction, garbage collection, defragmentation. To make compaction: Every program in RAM must be relocated to make them contiguous. Every address and every reference to an address must be adjusted according to the program’s new location.

    6. Relocatable dynamic partitions - 2 This means: the amount of memory locations by which the program has been displaced must be added to (or subtracted from) all of the original addresses in the program. If, by chance, not all the addresses were adjusted by the same value, the program would branch to the wrong section of the program or to a section of another program.

    7. Relocatable dynamic partitions - 3 After compaction, both the free list and the busy list are updated. Two special registers are used to help with the compaction process. Bounds register: is used to store the highest location in memory accessible by each program. Relocation register: contains the value that must be added to (or subtracted from) each address referenced in the program to access the correct memory addresses after relocation.

    8. Example

    9. Example

    10. Advantages & Disadvantages Advantages: External fragmentation problem is solved. Best use of memory space. Disadvantages: More overhead (due to compaction) is incurred than with the two previous schemes.

    11. How often? When and how often it should be done? When a certain percentage of memory becomes busy. (what is the disadvantage?) The system would incur unnecessary overhead if no jobs were waiting to use the remaining free memory. Only when there are jobs waiting to get in. (what is the disadvantage?) Constant checking of the entry queue will cause an unnecessary overhead and slow down the processing of jobs.

    12. How often? After a predetermined amount of time (T) has elapsed. What if “T” is too small? The system will spend more time on compaction than on processing. What if “T” is too large? Too many jobs will be waiting and the advantages of compaction are lost.

    13. Exercise

More Related