Operating systems
This presentation is the property of its rightful owner.
Sponsored Links
1 / 33

Operating Systems PowerPoint PPT Presentation


  • 80 Views
  • Uploaded on
  • Presentation posted in: General

Operating Systems. Operating Systems. Session 6: Real Memory organization management. Introduction. Memory divided into tiers Main memory Relatively expensive Relatively small capacity High-performance Secondary storage Cheap Large capacity Slow

Download Presentation

Operating Systems

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Operating systems

Operating Systems

Operating Systems

Session 6:

Real Memory

organization

management


Introduction

Introduction

  • Memory divided into tiers

    • Main memory

      • Relatively expensive

      • Relatively small capacity

      • High-performance

    • Secondary storage

      • Cheap

      • Large capacity

      • Slow

    • Main memory requires careful management

COP 5614 - Operating Systems


Memory organization

Memory Organization

  • Memory can be organized in different ways

    • One process uses entire memory space

    • Each process gets its own partition in memory

      • Dynamically or statically allocated

  • Trend: Application memory requirements tend to increase over time to fill main memory capacities

COP 5614 - Operating Systems


Memory management

Memory Management

  • Strategies for obtaining optimal memory performance

    • Performed by memory manager

      • Which process will stay in memory?

      • How much memory will each process have access to?

      • Where in memory will each process go?

COP 5614 - Operating Systems


Memory hierarchy

Memory Hierarchy

  • Main memory

    • Should store currently needed program instructions and data only

  • Secondary storage

    • Stores data and programs that are not actively needed

  • Cache memory

    • Extremely high speed

    • Usually located on processor itself

    • Most-commonly-used data copied to cache for faster access

    • Small amount of cache still effective for boosting performance

      • Due to temporal locality

COP 5614 - Operating Systems


Memory hierarchy1

Memory Hierarchy

COP 5614 - Operating Systems


Memory management strategies

Memory Management Strategies

  • Allocation

    • Single or multiple processes

    • Fixed or variable

  • Fetch

    • Demand or anticipatory

    • Decides which piece of data to load next

  • Placement

    • Decides where in main memory to place incoming data

  • Replacement

    • Decides which data to remove from main memory to make more space

COP 5614 - Operating Systems


Contiguous vs noncontiguous memory allocation

Contiguous vs. Noncontiguous Memory Allocation

  • Ways of organizing programs in memory

    • Contiguous allocation

      • Program must exist as a single block of contiguous addresses

      • Sometimes it is impossible to find a large enough block

      • Low overhead

    • Noncontiguous allocation

      • Program divided into chunks called segments

      • Each segment can be placed in different part of memory

      • Easier to find “holes” in which a segment will fit

      • Increased number of processes that can exist simultaneously in memory offsets the overhead incurred by this technique

COP 5614 - Operating Systems


Single process contiguous memory allocation

Single Process: Contiguous Memory Allocation

COP 5614 - Operating Systems


Single process overlays

Single Process : Overlays

COP 5614 - Operating Systems


Protection in a single process environment

Protection in a Single Process Environment

  • Operating system must not be damaged by programs

    • System cannot function if operating system overwritten

    • Boundary register

      • Contains address where program’s memory space begins

      • Any memory accesses outside boundary are denied

      • Can only be set by privileged commands

      • Applications can access OS memory to execute OS procedures using system calls, which places the system in executive mode

COP 5614 - Operating Systems


Single process memory protection

Single Process: Memory Protection

COP 5614 - Operating Systems


Multi process fixed partition allocation

Multi Process: Fixed-Partition Allocation

  • Fixed-partition multiprogramming

    • Each active process receives a fixed-size block of memory

    • Processor rapidly switches between each process

    • Security becomes important

COP 5614 - Operating Systems


Multi process fixed partition allocation1

Multi Process: Fixed-Partition Allocation

COP 5614 - Operating Systems


Multi process fixed partition allocation2

Multi Process: Fixed-Partition Allocation

with address translation

COP 5614 - Operating Systems


Internal fragmentation

Internal Fragmentation

Internal fragmentation in a fixed-partition multiprogramming system.

COP 5614 - Operating Systems


Multi process fixed partition protection

Multi Process: Fixed-Partition Protection

COP 5614 - Operating Systems


Multi process fixed partition drawbacks

Multi Process: Fixed-Partition Drawbacks

  • Internal fragmentation

    • Process does not take up entire partition,

      wasting memory

  • Process can be too big to fit anywhere

  • Variable partitions designed as replacement

COP 5614 - Operating Systems


Multi process variable partition allocation

Multi Process: Variable-Partition Allocation

COP 5614 - Operating Systems


Variable partition characteristics

Variable-Partition Characteristics

  • processes placed where they fit

    • No space wasted initially

    • Internal fragmentation impossible

      • Partitions are exactly the size they need to be

    • External fragmentation occurs when process ends

      • Leaves holes too small for new processes

      • Eventually no holes large enough for new processes

COP 5614 - Operating Systems


Variable partition memory holes

Variable-Partition: memory holes

COP 5614 - Operating Systems


Reduce external fragmentation

Reduce external fragmentation

  • Coalescing

    • Combine adjacent free blocks into one large block

  • Compaction

    • Rearranges memory into

      • one contiguous block of free space

      • one contiguous block of occupied space

    • Significant overhead

COP 5614 - Operating Systems


Memory coalescing

Memory coalescing

COP 5614 - Operating Systems


Memory compaction

Memory compaction

COP 5614 - Operating Systems


Memory placement strategies

Memory Placement Strategies

  • Where to put incoming processes

    • First-fit strategy

      • Process placed in first hole of sufficient size found

      • Simple, low execution-time overhead

    • Best-fit strategy

      • Process placed in hole that leaves least unused space

      • More execution-time overhead

    • Worst-fit strategy

      • Process placed in hole that leaves most unused space

      • remaining large hole may be used by another process

COP 5614 - Operating Systems


Memory placement first fit

Memory Placement: first fit

COP 5614 - Operating Systems


Memory placement best fit

Memory Placement: best fit

COP 5614 - Operating Systems


Memory placement worst fit

Memory Placement: worst fit

COP 5614 - Operating Systems


Multi process with memory swapping

Multi process with Memory Swapping

  • remove inactive processes from memory

  • only running process is in main memory

    • others temporarily moved to secondary storage

    • maximizes available memory

    • significant overhead when switching processes

COP 5614 - Operating Systems


Multi process with memory swapping1

Multi process with Memory Swapping

COP 5614 - Operating Systems


Multi process with memory swapping2

Multi process with Memory Swapping

  • Idea: keep several processes in memory

    • Less available memory per process

    • Much faster response times

    • Similar to paging

COP 5614 - Operating Systems


Evolution of memory organization

Evolution of memory organization

COP 5614 - Operating Systems


Agenda for next week

Agenda for next week:

  • Chapter 10 Virtual Memory Organization

COP 5614 - Operating Systems


  • Login