memory management memory manager
play

Memory Management Memory Manager Requirements Minimize primary - PowerPoint PPT Presentation

Memory Management Memory Manager Requirements Minimize primary memory access time Maximize primary memory size Primary memory must be cost-effective Todays memory manager: Allocates primary memory to processes Maps


  1. Memory Management

  2. Memory Manager ¥ Requirements Ð Minimize primary memory access time Ð Maximize primary memory size Ð Primary memory must be cost-effective ¥ TodayÕs memory manager: Ð Allocates primary memory to processes Ð Maps process address space to primary memory Ð Minimizes access time using cost-effective memory configuration

  3. Address Space vs Primary Memory Primary Memory Process Address Space Mapped to object other than memory

  4. Building the Address Space Source Library Other code code objects Translation ¥Compose elements

  5. Building the Address Space Source Library Other code code objects Secondary memory Translation ¥Compose elements ¥Adjust addresses Process address space ¥Translation time ¥Load time

  6. Building the Address Space Source Library Other code code objects Secondary memory Executable Translation memory ¥Compose elements ¥Adjust addresses Loader Process ¥Translation time address ¥Load time space ¥Allocate executable memory space

  7. Memory Hierarchies CPU Registers Executable Cache Memory Memory Primary Memory Rotating Magnetic Memory Secondary Memory Optical Memory Sequentially Accessed Memory

  8. Memory Hierarchies CPU Registers Executable Cache Memory Memory Primary Memory Rotating Magnetic Memory Secondary Memory Optical Memory Sequentially Accessed Memory

  9. Managing the Hierarchy ¥ Move across executable-secondary memory boundary (or lower) requires I/O operation ¥ Upward moves are copy operations Ð Require allocation in upper memory Ð Image exists in both memories ¥ Updates are first applied to upper memory ¥ Downward move is (usually) destructive Ð Deallocate upper memory Ð Updates image in secondary memory

  10. Memory Allocation Operating Unused System In Use Process 3 Process 0 Process 2 Process 1

  11. Fixed-Partition Memory Operating System p i needs n i units Region 0 N 0 n i p i Region 1 N 1 N 2 Region 2 Region 3 N 3

  12. Fixed-Partition Memory -- Best-Fit Operating System ¥Loader must Region 0 N 0 adjust every address in the absolute module Region 1 N 1 Internal when placed in Fragmentation memory p i N 2 Region 2 Region 3 N 3

  13. Fixed-Partition Memory -- Worst-Fit Operating System p i Region 0 N 0 Region 1 N 1 N 2 Region 2 Region 3 N 3

  14. Fixed-Partition Memory -- First-Fit Operating System p i Region 0 N 0 Region 1 N 1 N 2 Region 2 Region 3 N 3

  15. Fixed-Partition Memory -- Next-Fit Operating System Region 0 N 0 p i Region 1 N 1 P i+1 N 2 Region 2 Region 3 N 3

  16. Variable Partition Memory Operating System

  17. Variable Partition Memory Operating Operating System System Process 0 ¥Loader must adjust every Process 1 address in every absolute module Process 2 when placed in memory Process 3 Process 4

  18. Variable Partition Memory Operating Operating Operating System System System Process 0 Process 0 Process 6 Process 1 Process 2 Process 2 Process 5 Process 3 Process 4 Process 4 ¥External fragmentation

  19. Variable Partition Memory Operating Operating Operating Operating System System System System Process 0 Process 0 Process 0 Process 6 Process 6 Process 1 Process 2 Process 2 Process 2 Process 5 Process 5 Process 3 Process 4 Process 4 Process 4 ¥ Compaction moves program in memory

  20. Cost of Moving Programs load R1, 0x02010 3F013010 Program loaded at 0x01000

  21. Cost of Moving Programs load R1, 0x02010 3F013010 Program loaded at 0x01000 3F016010 Program loaded at 0x04000 ¥Must run loader over program again!

  22. Dynamic Memory Allocation ¥ Common to use dynamically allocated memory ¥ Process wants to change the size of its address space Ð Smaller ⇒ Creates an external fragment Ð Larger ⇒ Have to move/relocate the program ¥ Allocate ÒholesÓ in memory according to Ð Best- /Worst- / First- /Next-fit

  23. Swapping ¥ Suppose there is high demand for executable memory ¥ Equitable policy might be to time-multiplex processes into the memory (also space-mux) ¥ Means that process can have its address space unloaded when it still needs memory Ð Usually only happens when it is blocked ¥ Have same problems as dynamic memory allocation

  24. Dynamic Address Relocation CPU Relative Address + Relocation Register load R1, 0x02010 MAR 3F012010 ¥Program loaded at 0x01000 ⇒ Relocation Register = 0x01000 ¥Program loaded at 0x04000 ⇒ Relocation Register = 0x04000

  25. Runtime Bound Checking CPU Relative Address + Relocation Register ∧ < Limit Register MAR Interrupt

  26. Strategies ¥ Fixed-Partition used only in batch systems ¥ Variable-Partition used everywhere (except in virtual memory) ¥ Swapping systems Ð Popularized in timesharing Ð Relies on dynamic address relocation Ð Now dated ¥ Virtual Memory Ð Paging -- mainstream in contemporary systems Ð Segmentation -- the future

  27. NT Memory-mapped Files Secondary Ordinary file memory ¥Open the file Executable ¥Create a section object memory (that maps file) ¥Identify point in address space to place Memory mapped the file files Section object

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend