0% found this document useful (0 votes)
18 views20 pages

03 OS - Memory Management

The document discusses memory management in operating systems, detailing how it handles primary memory and manages processes. It covers key concepts such as address types (symbolic, relative, physical), memory allocation methods, fragmentation, paging, and segmentation. The document also highlights the roles of compilers, operating systems, and hardware in memory management.

Uploaded by

Angelo Vita
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views20 pages

03 OS - Memory Management

The document discusses memory management in operating systems, detailing how it handles primary memory and manages processes. It covers key concepts such as address types (symbolic, relative, physical), memory allocation methods, fragmentation, paging, and segmentation. The document also highlights the roles of compilers, operating systems, and hardware in memory management.

Uploaded by

Angelo Vita
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

MEMORY

MANAGEMENT
VICTORIA KIRSTEN SISON
DARLY V. BUEN
ANDREA NICOLE B. QUERUBIN
MIRIVA INDIA V. SISON
Introduction
• T
› he functionality of an operating system which handles
or manages primary memory and moves processes back
and forth between main memory and disk during
execution.

• M
› emory management keeps track of each and every
memory location, regardless of either it is allocated to some
process or it is free. It checks how much memory is to be
allocated to processes. It decides which process will get
memory at what time. It tracks whenever some memory
gets freed or unallocated and correspondingly it updates
the status.
Key Players in Memory Management

• Compiler
⚬ structures the address space of an application
• OS
⚬ maps the compiler’s structures onto the hardware
• Hardware
⚬ performs the actual accesses to memory locations
Process Address Space

• the set of logical addresses that a process references


in its code.
Three types of addresses used in a
program before and after memory is
allocated
• Symbolic addresses
⚬ The addresses used in a source code. The
variable names, constants, and instruction labels
are the basic elements of the symbolic address
space.
• ›Relative addresses
⚬ ›At the time of compilation, a compiler converts
symbolic addresses into relative addresses.
Three types of addresses used in a
program before and after memory is
allocated
3. Physical addresses
⚬ The loader generates these addresses at the
time when a program is loaded into main
memory.
Logical vs Physical Address

• Logical Address Space


⚬ the set of all logical addresses generated by a
program.
• Physical address space
⚬ the set of all physical addresses corresponding
to these logical addresses.
Static vs Dynamic Loading

• Static loading
⚬ the absolute program (and data) is loaded into
memory in order for execution to start.
• Dynamic loading
⚬ dynamic routines of the library are stored on a
disk in relocatable form and are loaded into
memory only when they are needed by the
program.
Swapping

• a mechanism in which a process can be swapped


temporarily out of main memory (or move) to
secondary storage (disk) and make that memory
available to other processes.

• Also known as a technique for memory compaction.


Schematic View of Swapping
Hierarchy of Storage Devices
Storage access cache
time decreases
Program and
data maybe
referenced by
the CPU directly
storage access
speed increases main memory

Programs and data


must be moved to
Storage capacity secondary storage memory before they
decreases can be referenced by
the CPU
Memory Allocation

• Main memory usually has two partitions:

⚬ Low Memory
■ Operating system resides in this memory.

⚬ High Memory
■ User processes are held in high memory.
Memory Allocation Mechanism

• Single-partition allocation
⚬ relocation-register scheme is used to protect user
processes from each other, and from changing
operating-system code and data.
• Multiple-partition allocation
⚬ main memory is divided into a number of fixed-
sized partitions where each partition should contain
only one process.
Fragmentation

• As processes are loaded and removed from memory,


the free memory space is broken into little pieces. It
happens after sometimes that processes cannot be
allocated to memory blocks considering their small
size and memory blocks remains unused.
Two type of Fragmentation

• External fragmentation
⚬ Total memory space is enough to satisfy a
request or to reside a process in it, but it is not
contiguous, so it cannot be used.
• Internal fragmentation
⚬ Memory block assigned to process is bigger. Some
portion of memory is left unused, as it cannot be
used by another process.
Paging

• Paging is a memory management technique in


which process address space is broken into blocks of
the same size called pages. The size of the process is
measured in the number of pages.
• Similarly, main memory is divided into small fixed-sized
blocks of (physical) memory called frames and the size
of a frame is kept the same as that of a page to have
optimum utilization of the main memory and to avoid
external fragmentation.
Address Translation
• Page address
⚬ is called logical address and represented by page
number and the offset.
■ ›Logical Address = Page number + page offset
• Frame address
⚬ is called physical address and represented by a
frame number and the offset.
■ ›Physical Address = Frame number + page
offset
• A
› data structure called page map table is used to keep track of the
relation between a page of a process to a frame in physical memory.
Advantage and Disadvantage of
Paging

• ›Paging is simple to implement and assumed as an


efficient memory management technique.
• ›
Due to equal size of the pages and frames, swapping
becomes very easy.
• ›
Page table requires extra memory space, so may not
be good for a system having small RAM.
Segmentation

• a memory management technique in which each job


is divided into several segments of different sizes,
one for each module that contains pieces that
perform related functions. Each segment is actually
a different logical address space of the program.
THANK
YOU

You might also like