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

Operating System Unit 3 Part 1

1. Memory management is the operating system functionality that manages primary memory and moves processes between main memory and disk. It keeps track of memory allocation and decides which process gets memory. 2. The goal of memory management is to maximize space utilization while minimizing fragmentation. It allows larger programs to run in smaller memory areas using techniques like virtual memory. 3. Protection schemes like separation of user and kernel memory and dynamic relocation registers define each process's separate logical address space.

Uploaded by

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

Operating System Unit 3 Part 1

1. Memory management is the operating system functionality that manages primary memory and moves processes between main memory and disk. It keeps track of memory allocation and decides which process gets memory. 2. The goal of memory management is to maximize space utilization while minimizing fragmentation. It allows larger programs to run in smaller memory areas using techniques like virtual memory. 3. Protection schemes like separation of user and kernel memory and dynamic relocation registers define each process's separate logical address space.

Uploaded by

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

OPERATING SYSTEM

UNIT 3 PART 1
Memory Management
• It is the functionality of an OS which manages
primary memory and moves process back b/w
main memory and disk.
• Function of Memory Management
• keep track of every memory location
• Tracks of whether memory is allocated or not
• Track how much memory is allocated
• Takes decision which process will get memory and
when.
Goal of Memory Management
• Space utilization
Fragmentation-memory loss can occur
Try to keep Fragmentation as low as possible
• Run larger program in small memory area
achieves by virtual memory
Base and Limit Registers
A pair of base and limit registers
define the logical address space Fence address

Base and limit register used so that


each Process has a separate
memory register
Logical vs. Physical Address Space
• The concept of a logical address space that is bound to a
separate physical address space is central to proper
memory management
– Logical address – generated by the CPU ,also referred
to as virtual address
– Physical address – address seen by the memory unit
• Logical and physical addresses are the same in compile-
time and load-time address-binding schemes, logical
(virtual) and physical addresses differ in execution-time
Memory-Management Unit (MMU)
• Used to do runtime mapping from logical to physical
address space.
• Hardware device that maps virtual to physical
address
• In MMU scheme, the value in the relocation register
is added to every address generated by a user
process at the time it is sent to memory
• The user program deals with logical addresses, it
never sees the real physical addresses
Simple Schemes for Memory Management
1. Separation of user and kernel

Fence register Memory


Low
Kernel
Y
CPU >
User
CPU generated N Memory
High
Address
Address Trap
Dynamic Loading
• Routine is not loaded until it is called
• Better memory-space utilization , unused routine is
never loaded
• Useful when large amounts of code are needed to
handle infrequently occurring cases
• No special support from the operating system is
required implemented through program design
Dynamic Linking
• Linking postponed until execution time
• Small piece of code, stub, used to locate the
appropriate memory-resident library routine
• Stub replaces itself with the address of the routine,
and executes the routine
• Operating system needed to check if routine is in
processes’ memory address
• Dynamic linking is particularly useful for libraries
• System also known as shared libraries
Dynamic Loading vs. Dynamic Linking
• Complete program is • Initially only program P1
loaded into memory. get loaded and CPU
but sometimes a certain linking the dependent
part of program only program P2 to main
when it is called by executing program P1
program. when it is needed.
Simple Schemes for Memory Management
2. Dynamic Relocation
Memory
Low
Kernel

Base Limit P1

.
Y
.
CPU
CPU
+ < .
Address N Memory .
Address
P2
Trap

Pn
High
Swapping
• A process can be swapped temporarily out of memory to a
backing store, and then brought back into memory for
continued execution
• Backing store – fast disk large enough to accommodate copies
of all memory images for all users must provide direct access
to these memory images
• Roll out, roll in – swapping variant used for priority-based
scheduling algorithms, lower-priority process is swapped out
so higher-priority process can be loaded and executed
• Major part of swap time is transfer time, total transfer time is
directly proportional to the amount of memory swapped
• System maintains a ready queue of ready-to-run processes
which have memory images on disk
Schematic View of Swapping
Contiguous Allocation!

• Main memory usually into two partitions:"


• Resident operating system, usually held in low memory with
interrupt vectoc
• "User processes then held in high memory"
• Each (Single-partition) allocation"
• Relocation-register scheme used to protect user processes
from each other, and from changing operating-system code
and data"
• Relocation register contains value of smallest physical
address; limit register contains range of logical addresses –
each logical address must be less than the limit register "
Contiguous Allocation vs. Noncontiguous
Allocation
• Centralized • Decentralized
• Program /process as a • Program part are
unit is completely distributed in memory
stored • Paging
• Partitioning • Segmentation
• Virtual memory
Memory mgt partitioning
• Memory is divided into two part
• Resident OS
• User processes
• Fixed (multiprogramming )with fixed
task(MFT)
• MFT(multiprogramming with fixed task): no of
partitioning are fixed and different size
• 1Partition= 1 Process
Protection
Memory

Kernel Low

Lower bound Upper bound P1

Y .
Y
CPU > < .
.
CPU
Memory .
Address N N
Address

Trap P2
Trap

Pn
High

You might also like