Anda di halaman 1dari 2

NAME : - ARSHPREET SINGH

SECTION : - RN1802B33
REG NO. : - 10806942
SUBJECT : - OPERATING SYSTEM (CSE213)

Topic : - PAGE REPLACEMENT ALGORITHMS

INTRODUCTION TO PAGING

In operating systems, paging is one of the memory-management schemes by which a


computer can store and retrieve data from secondary storage for use in main memory. In
the paging memory-management scheme, the operating system retrieves data from
secondary storage in same-size blocks called pages. The main advantage of paging is
that it allows the physical address space of a process to be noncontiguous. Before
paging, systems had to fit whole programs into storage contiguously, which caused
various storage and fragmentation problems.

DEMAND PAGING

When demand paging is used, no preemptive loading takes place. Paging only occurs at
the time of the data request, and not before. In particular, when a demand pager is used,
a program usually begins execution with none of its pages pre-loaded in RAM. Pages are
copied from the executable file into RAM the first time the executing code references
them, usually in response to page faults. As such, much of the executable file might
never be loaded into memory if pages of the program are never executed during that
run.

PAGE REPLACEMENT ALGORITHMS

In a computer operating system that uses paging for virtual memory memory
management, page replacement algorithms decide which memory pages to page out
(swap out, write to disk) when a page of memory needs to be allocated. Paging happens
when a page fault occurs and a free page cannot be used to satisfy the allocation, either
because there are none, or because the number of free pages is lower than some
threshold.

When the page that was selected for replacement and paged out is referenced again it
has to be paged in (read in from disk), and this involves waiting for I/O completion. This
determines the quality of the page replacement algorithm: the less time waiting for
page-ins, the better the algorithm. A page replacement algorithm looks at the limited
information about accesses to the pages provided by hardware, and tries to guess which
pages should be replaced to minimize the total number of page misses, while balancing
this with the costs (primary storage and processor time) of the algorithm itself.

This section gives a very short overview of the page replacement algorithms which can
be simulated with the scripts and their implementation on real hardware.

• Basic Scheme
• Optimal Page replacement
• Least Recently Used (LRU)
• First In First Out (FIFO)
• Counting –Based Page Replacement
• Not Recently Used (NRU)

WORKING SET

The working set of a process is the set of pages expected to be used by that process
during some time interval. While the "working set model" isn't a page replacement
algorithm in the strict sense, several page replacement algorithms attempt to
approximate the working set model, attempting to keep all pages in the working set in
RAM. For example, the Clock algorithm can be modified to ignore pages currently in the
working set, or if the R bit set.

THRASHING

Most programs reach a steady state in their demand for memory locality both in terms of
instructions fetched and data being accessed. This steady state is usually much less than
the total memory required by the program. This steady state is sometimes referred to as
the working set, the set of memory pages that are most frequently accessed. Virtual
memory systems work most efficiently when the ratio of the working set to the total
number of pages that can be stored in RAM is low enough that the time spent
resolving page faults is not a dominant factor in the workload's performance. A program
that works with huge data structures will sometimes require a working set that is too
large to be efficiently managed by the page system resulting in constant page faults that
drastically slow down the system. This condition is referred to as thrashing pages are
swapped out and then accessed causing frequent faults or Page Faults.

Anda mungkin juga menyukai