2. Objectives:-
•To describe the benefits of a virtual memory system.
•To explain the concept of-
•Demand paging.
•Page replacement.
•Allocation of page frames.
•Thrashing.
www.corecode.in
3. Virtual Memory involves the separation of logical memory
as perceived by users from physical memory. This separation
allows an extremely large virtual memory to be provided for
programmers when only a smaller physical memory is available.
Virtual memory makes the task of programming much easier,
because programmer no longer needs to worry about the amount
of physical memory available, they can concentrate instead on
the problem to be programmed.
In addition to separating physical memory from logical memory,
virtual memory allows files and memory to be shared by two or
more processes through page sharing.
www.corecode.in
4. Demand Paging
•To load a program from disk into memory we can either load the entire
program in physical memory at execution time, or load the part of
program which is needed to perform the task.
•However, when a program is entirely loaded into memory and we may
initially not needed the whole code to be executed then it will be waste
of memory use.
•With demand paging the page is loaded into physical memory only
when they are needed.
•A demand-paging system is similar to a paging system with swapping
where processes resides in secondary memory and when we want to
execute a process, we swap in into memory.
www.corecode.in
5. Page Replacement
Page replacement do following approach to overcome with page fault-
•It no frame is free, find one that is not currently being used and free it.
•Free a frame by writing its contents to swap space and changing the page table
along with other table to indicate that the page is no longer in the memory.
•We can now use the freed frame to hold the page for which the process faulted.
Page replacement
www.corecode.in
6. Allocation of page frames
The number of frames allocated to each process decreases, the page-
fault rate increases, slowing process execution. Better it is to be
remember, when page fault occurs before an executing instruction is
complete, the instruction must be restarted. Consequently, we must have
enough frames to hold all the different pages that any single instruction
can reference.
www.corecode.in
7. Thrashing
Thrashing is computer activity that makes little or no progress, usually
because memory or other resources have become exhausted or too
limited to perform needed operations. When this happens, a pattern
typically develops in which a request is made of the operating system by
a process or program, the operating system tries to find resources by
taking them from some other process, which in turn makes new requests
that can't be satisfied. In a virtual storage system (an operating system
that manages its logical storage or memory in units called pages),
thrashing is a condition in which excessive paging operations are taking
place.
A system that is thrashing can be perceived as either a very slow system
or one that has come to a halt.
www.corecode.in