0% found this document useful (0 votes)
1 views

Lecture9_opsys

The document discusses various memory management techniques including bit maps, linked lists, paging, and segmentation. It highlights the importance of logical and physical addresses, as well as the role of hardware support in virtual memory systems. Key points include dynamic address translation and the ability for processes to occupy non-contiguous memory locations during execution.

Uploaded by

sudegun16
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Lecture9_opsys

The document discusses various memory management techniques including bit maps, linked lists, paging, and segmentation. It highlights the importance of logical and physical addresses, as well as the role of hardware support in virtual memory systems. Key points include dynamic address translation and the ability for processes to occupy non-contiguous memory locations during execution.

Uploaded by

sudegun16
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 33

Memory Management with Bit Maps

• Part of memory with 5 processes, 3 holes


• tick marks show allocation units
• shaded regions are free
• Corresponding bit map
• Same information as a list
2
Memory Management with Linked Lists

Four neighbor combinations for the terminating process X

3
Relocation
• When program loaded into memory the actual (absolute) memory
locations are determined
• A process may occupy different partitions which means different
absolute memory locations during execution
• Swapping
• Compaction
Addresses
• Logical
• Reference to a memory location independent of the
current assignment of data to memory.
• Relative
• Address expressed as a location relative to some known
point.
• Physical or Absolute
• The absolute address or actual location in main memory.
Relocation

Hardware support for Relocation


Registers Used during Execution
• Base register
• Starting address for the process
• Bounds register
• Ending location of the process
• These values are set when the process is loaded or when the process
is swapped in
Paging
• Partition memory into small equal fixed-size chunks and divide each
process into the same size chunks
• The chunks of a process are called pages
• The chunks of memory are called frames
Paging
• Operating system maintains a page table for each process
• Contains the frame location for each page in the process
• Memory address consist of a page number and offset within the page
Processes and Frames
A.0
A.1
A.2
A.3
D.0
B.0
D.1
B.1
D.2
B.2
C.0
C.1
C.2
C.3
D.3
D.4
Segmentation
• A program can be subdivided into segments
• Segments may vary in length
• There is a maximum segment length
• Addressing consist of two parts
• a segment number and
• an offset
• Segmentation is very similar to dynamic partitioning
Segmentation (1)

• One-dimensional address space with growing tables


• One table may bump into another
12
Segmentation (2)

Allows each table to grow or shrink, independently


13
Logical Addresses
Paging
Segmentation
Comparison of paging and segmentation

17
Virtual Memory
Key points in
Memory Management
1) Memory references are logical addresses dynamically translated into
physical addresses at run time
• A process may be swapped in and out of main memory occupying different
regions at different times during execution
2) A process may be broken up into pieces that do not need to located
contiguously in main memory
• Two characteristics of paging and segmentation are the keys to this
breakthrough in memory management:

• 1. All memory references within a process are logical addresses that are
dynamically translated into physical addresses at run time. A process may
be swapped in and out of main memory occupying different regions of
main memory at different times during the course of execution.
• 2. A process may be broken up into a number of pieces (pages or segments)
and these pieces need not be contiguously located in main memory during
execution. The combination of dynamic run-time address translation and
the use of a page or segment table permits this.
Breakthrough in
Memory Management
• If both of those two characteristics are present,
• then it is not necessary that all of the pages or all of the segments of a
process be in main memory during execution.
• If the next instruction, and the next data location are in memory then
execution can proceed
• at least for a time
A Short History
• Before virtual memory was developed, computers had RAM and
secondary memory.

• Early computers used magnetic core memory for main memory and
magnetic drums for their secondary memory. Computer memory was
expensive and usually in short supply back in the 1940s and 1950s.

• As computer programs grew in size and complexity, developers had to


worry that their programs would use up all of a computer's
main memory and run out of memory.
Terminology
Support Needed for
Virtual Memory
1. Hardware must support paging and segmentation
2. Operating system must be able to manage the movement of pages
and/or segments between secondary memory and main memory
1. Hardware support

The position and function of the MMU


26
Paging
• Each process has its own page table
• Each page table entry contains the frame number of the
corresponding page in main memory
• Two extra bits are needed to indicate:
• whether the page is in main memory or not
• Whether the contents of the page has been altered since it was last loaded
Address Translation
29
Page Tables

Typical page table entry

30
Page Tables
• Page tables are also stored in virtual memory
• When a process is running, part of its page table is in main memory
Two-level page Tables
Second-level page tables

Top-level
page table

• 32 bit address with 2 page table fields

32
Address Translation in a Two-Level
paging System
Hierarchical Page Table

You might also like