The document discusses various concepts related to memory management in operating systems including logical vs physical addresses, memory allocation techniques like paging, segmentation, and virtual memory. It provides details on key concepts like logical address space, memory management unit (MMU), page table, frame, segmentation using segment table with base and limit. It also covers memory allocation methods like fixed partition, variable partition and page replacement algorithms like FIFO, LRU, OPT.
2. Logical Address is generated by CPU while a program is
running.
The logical address is virtual address as it does not exist
physically, therefore, it is also known as Virtual Address.
This address is used as a reference to access the physical
memory location by CPU.
The term Logical Address Space is used for the set of all
logical addresses generated by a program’s perspective.
The hardware device called Memory-Management Unit is
used for mapping logical address to its corresponding
physical address.
5. It identifies a physical location of required data in a
memory.
The user never directly deals with the physical
address but can access by its corresponding logical
address.
The program needs physical memory for its
execution, therefore, the logical address must be
mapped to the physical address by MMU before they
are used.
6.
7.
8. Parameter LOGICAL ADDRESS PHYSICAL ADDRESS
Basic generated by CPU
location in a memory
unit
Visibility
User can view the logical
address of a program.
User can never view
physical address of
program.
Generation generated by the CPU Computed by MMU
Access
The user can use the logical
address to access the physical
address.
The user can indirectly
access physical
address but not
directly.
Editable Logical address can be change.
Physical address will
not change.
Also called virtual address. real address.
9. Swapping is a memory management scheme in
which any process can be temporarily
swapped from main memory to secondary
memory so that the main memory can be made
available for other processes.
It is used to improve main memory utilization.
In secondary memory, the place where the
swapped-out process is stored is called swap
space.
10. It is the type of memory allocation
method. When a process requests the memory,
a single contiguous section of memory blocks
is allotted depending on its requirements.
11. Fixed-size Partition Scheme
In this type of contiguous memory allocation
technique, each process is allotted a fixed size
continuous block in the main memory.
This technique is also called static partitioning.
12.
13. Variable-size Partition
In this type of contiguous memory allocation
technique, no fixed blocks or partitions are made in
the memory.
14.
15. In Operating Systems, Paging is a storage
mechanism used to retrieve processes from the
secondary storage into the main memory in the form
of pages.
The main idea behind the paging is to divide each
process in the form of pages. The main memory will
also be divided in the form of frames.
One page of the process is to be stored in one of the
frames of the memory.
16. The partitions of secondary memory are called
as pages.
The partitions of main memory are called
as frames.
17.
18.
19. Address generated by CPU is divided into:
◦ Page number (p) - used as an index into a page table
which contains base address of each page in physical
memory.
◦ Page offset (d) - combined with base address to define
the physical memory address that is sent to the memory
unit. It refers to the number of bits necessary to
represent a certain word on a page, For ex: 10 bits
20.
21. Segmentation method works almost similarly
to paging, only difference between the two is
that segments are of variable-length whereas,
in the paging method, pages are always of
fixed size.
22. Segment table contains mainly two information
about segment:
Base: It is the base address of the segment
Limit: It is the length of the segment.
23. Example of Segmentation in OS
Consider that a user program has been divided into
five segments and they are numbered from segment 0
to segment 4, as you can see them in the logical
address space.
You also have a segment table which has entries for
these segment with their base address in physical
memory and their limit.
24.
25. Virtual memory is a memory management
technique where secondary memory can be
used as if it were a part of the main memory.
26.
27. Demand paging is a memory management
scheme employed by modern operating
systems to manage physical memory
resources.
28. Demand paging is a process in which data is moved
from secondary memory to RAM on a demand basis,
which means all data is not stored in the main
memory because the space is limited in RAM.
29. Demand Paging is a method in which a page is
only brought into main memory when the CPU
requests it.
30.
31.
32. In an operating system that uses paging for memory
management, a page replacement algorithm is
needed to decide which page needs to be replaced
when a new page comes in.
FIFO
LRU
OPTIMAL
33. Page Replacement Algorithms:
Page fault/ Miss: If the searching page is not in
memory
Page Hit: If the searching page that was available in
memory.
34. This is the simplest page replacement
algorithm.
Replaced the pages that has been in memory
for the longest time
35. Example 1: Consider page reference string
1, 3, 0, 3, 5, 6, 3 with 3 page frames. Find the
number of page faults.
36. Advantages
This algorithm is simple and easy to use.
FIFO does not cause more overhead.
Disadvantages
This algorithm does not make the use of the frequency
of last used time rather it just replaces the Oldest
Page.
There is an increase in page faults as page frames
increases.
The performance of this algorithm is the worst.
37. In this algorithm, pages are replaced which would not be
used for the longest duration of time in the future
Advantages of OPR
This algorithm is easy to use.
This algorithm provides excellent efficiency and is less
complex.
For the best result, the implementation of data structures is
very easy
Disadvantages of OPR
Practical Implementation is not possible because the
operating system is unable to track the future request
38. Example-2: Consider the page references 7, 0, 1, 2, 0, 3, 0, 4,
2, 3, 0, 3, 2, 3 with 4 page frame. Find number of page fault.
39. In this algorithm, page will be replaced which is least
recently(Long back) used.
The page that has not been used for the longest time
in the main memory will be selected for replacement.
This algorithm is easy to implement.
40. Example-3: Consider the page reference
string 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 3
with 4 page frames. Find number of page
faults.
41. Advantages of LRU
It is an efficient technique.
With this algorithm, it becomes easy to identify the
faulty pages that are not needed for a long time.
It helps in Full analysis.
Disadvantages of LRU
It is expensive and has more complexity.
There is a need for an additional data structure.
42. In this algorithm, page will be replaced which has
been used recently.
This is the Last in First Out algorithm and works
on LIFO principles.
In this algorithm, the newest page is replaced by the
requested page.
43. Example: Let’s see how the LIFO performs for
our example string of 3, 1, 2, 1, 6, 5, 1, 3 with
3-page frames:
44. Advantages
Simple implementation:
Low overhead:
Disadvantages
Poor performance:
May result in page thrashing: LIFO page
replacement algorithm can result in a situation known
as page thrashing, where the pages are frequently
swapped in and out of memory, leading to high page
fault rates and poor system performance.