Operating System 3
Operating System 3
UNIT - 3
A physical address is the actual address in the main memory where data is
stored. It is a location in physical memory, as opposed to a virtual address.
Physical addresses are used by the Memory Management Unit (MMU) to
translate logical addresses into physical addresses. The user must use the
corresponding logical address to go to the physical address rather than
directly accessing the physical address. For a computer program to function,
physical memory space is required. Therefore, the logical address and
physical address need to be mapped before the program is run.
The term “physical address” describes the precise position of necessary data
in a memory. Before they are used, the MMU must map the logical address to
3
the physical address. This is because the user program creates the logical
address and believes that the program is operating in this logical address.
However, the program requires physical memory to execute. All physical
addresses that match the logical addresses in a logical address space are
collectively referred to as the “physical address space”
The physical hardware of a computer that manages its virtual memory and
caching functions is called the memory management unit (MMU). The MMU is
sometimes housed in a separate Integrated Chip (IC), but it is typically found
inside the central processing unit (CPU) of the computer. The MMU receives
all inputs for data requests and decides whether to retrieve the data from
ROM or RAM storage.
6
A process is divided into Segments. The chunks that a program is divided into
which are not necessarily all of the exact sizes are called segments.
Segmentation gives the user’s view of the process which paging does not
provide. Here the user’s view is mapped to physical memory.
This segmentation may or may not take place at the run time of the
program.
● Simple Segmentation: Each process is divided into a number of
segments, all of which are loaded into memory at run time, though
not necessarily contiguously.
●
9
A process is divided into Segments. The chunks that a program is divided into
which are not necessarily all of the exact sizes are called segments.
Segmentation gives the user’s view of the process which paging does not
This segmentation may or may not take place at the run time of the
program.
segments, all of which are loaded into memory at run time, though
Address.
segment.
paging.
CPU utilization.
processes’ codes.
security operations.
memory allocation.
14
from memory, the free memory space is broken into little pieces,
activity.
● Due to the need for two memory accesses, one for the segment
table and the other for main memory, access time to retrieve the
instruction increases.
when a new page comes in. Page replacement becomes necessary when a
However, another page fault would arise if the replaced page is referenced
What is Paging?
into fixed-size pages that are mapped to physical memory frames, reducing
more efficient use of memory, which is crucial for modern operating systems
A page fault happens when a running program accesses a memory page that
is mapped into the virtual address space but not loaded in physical memory.
Since actual physical memory is much smaller than virtual memory, page
faults happen. In case of a page fault, the Operating System might have to
replace one of the existing pages with the newly needed page. Different
replace. The target for all algorithms is to reduce the number of page faults.
uses both physical memory (RAM) and disk storage to provide a larger
where operating systems are a key focus area. To deepen your knowledge
and enhance your exam preparation, consider enrolling in the GATE CS Self-
manage memory efficiently when the virtual memory is full. When a new
page needs to be loaded into physical memory , and there is no free space,
the page whose reference caused the page fault. It is performed as follows:
one of the pages currently in memory for replacement, accesses the page
table entry of the selected page to mark it as “not present” in memory, and
initiates a page-out operation for it if the modified bit of its page table entry
operating system keeps track of all pages in the memory in a queue, the
oldest page is in the front of the queue. When a page needs to be replaced
Initially, all slots are empty, so when 1, 3, 0 came they are allocated to the
empty slots —> 3 Page Faults.
when 3 comes, it is already in memory so —> 0 Page Faults. Then 5 comes,
it is not available in memory so it replaces the oldest page slot i.e 1. —> 1
Page Fault. 6 comes, it is also not available in memory so it replaces the
oldest page slot i.e 3 —> 1 Page Fault. Finally, when 3 come it is not
available so it replaces 0 1 page fault.
when increasing the number of page frames while using the First in First Out
In this algorithm, pages are replaced which would not be used for the
Initially, all slots are empty, so when 7 0 1 2 are allocated to the empty slots
—> 4 Page faults
0 is already there so —> 0 Page fault. when 3 came it will take the place of
7 because it is not used for the longest duration of time in the future.—> 1
Page fault. 0 is already there so —> 0 Page fault. 4 will takes place of 1 —>
1 Page Fault.
21
Now for the further page reference string —> 0 Page fault because they are
operating system cannot know future requests. The use of Optimal Page
Initially, all slots are empty, so when 7 0 1 2 are allocated to the empty slots
—> 4 Page faults
0 is already their so —> 0 Page fault. when 3 came it will take the place of 7
because it is least recently used —> 1 Page fault
0 is already in memory so —> 0 Page fault .
4 will takes place of 1 —> 1 Page Fault
Now for the further page reference string —> 0 Page fault because they are
already available in the memory.
In this algorithm, page will be replaced which has been used recently.
Initially, all slots are empty, so when 7 0 1 2 are allocated to the empty slots
—> 4 Page faults
when 3 comes it will take place of 0 because it is most recently used —> 1
Page fault