Chapter 3
Chapter 3
1 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.
2 Relative addresses
At the time of compilation, a compiler converts symbolic addresses into relative addresses.
3 Physical addresses
The loader generates these addresses at the time when a program is loaded into main
memory.
Base and Limit Registers
• A pair of base and limit registers define the logical
address space
• CPU must check every memory access generated in
user mode to be sure it is between base and limit
for that user
Hardware Address Protection
Swapping
• Swapping is 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. At some later time, the system swaps back the
process from the secondary storage to main memory.
• Though performance is usually affected by swapping process
but it helps in running multiple and big processes in parallel
and that's the reason Swapping is also known as a technique
for memory compaction.
Schematic View of Swapping
Memory management Techniques:
Contiguous Memory Allocation Types
1. Single-partition allocation
2.Multiple-partition allocation
Single-partition allocation
Low Memory
High Memory
Operating system
Process 1
Free space
Multiple Partition Allocation
• Fixed partition
• Variable partition
Operating System
Process 1
Process 2
Free space
Fixed Partition
Operating Operating
System System
Partition 1: Partition 1:
1KB 1KB
Partition2: 3KB Partition2: 1KB
Partition 1: 1KB
Partition2: 4KB
Partition3: 2KB
Partition4: 3KB
Partition:5 5KB
Algorithms for memory allocation
• First fit
• Best fit
• Worst fit
First fit
• Best fit
• Worst fit
4
1
3 2
4
What are the physical addresses for the following logical addresses?
Paging
• A computer can address more memory than the amount
physically installed on the system.
• This extra memory is actually called virtual memory and it is a
section of a hard that's set up to emulate the computer's
RAM.
• Paging technique plays an important role in implementing
virtual memory.
• Paging is a memory management technique in which process
address space is broken into blocks of the same size called
pages (size is power of 2, between 512 bytes and 8192
bytes). 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.
Page map table
Address Translation
Paging model of logical and physical
memory.
• If the size of the logical address space is 2^m, and a page size
is 2^n bytes, then the high-order m− n bits of a logical address
designate the page number, and the n low-order bits
designate the page offset. Thus, the logical address is as
follows: