Operating System: Three Easy Pieces --- Page Replacement (Note)

Thus far, the way we have described how replacements occur assumes that the OS waits until

memory is entirely full, and only then replaces or evicts a page to make room for some other pages.

As you can imagine, this is a little bit unrealistic, and there are many reasons for the OS to keep a

small portion of memory free more proactively. To keep a small amount of memory free, most OSs

thus have some kind of high watermark (HW) and low watermark (LW) to help decide when to start

evicting pages from memory. How this works is as follows: When the OS notices that there are fewer

than LW pages available, a background thread that is responsible for freeing memory runs. The thread

evicts pages until there are HW pages available. The background thread, sometimes called the Swap

daemon or page daemon, then goes to sleep, happy that it has freed some memory for running

processes and the OS to use. By performing a number of replacements at once, new performance

optimizations become possible. For example, many systems will cluster or group a number of pages

and write them out at once to the swap partition, thus increasing the efficiency of the disk; as we will

see later when we discuss disks in more detail, such clustering reduces seek and rotational overhead

of a disk and thus increases performance noticeably.

时间: 2024-08-02 15:03:17

Operating System: Three Easy Pieces --- Page Replacement (Note)的相关文章

Operating System: Three Easy Pieces --- Page Fault (Note)

Recall that with TLB misses, we have two types of systems: Hardware managed TLBs (where the hardware looks in the page table to find the desired translation) and software managed TLBs ( where the OS does). In either type of systems, if a page is not

Operating System: Three Easy Pieces --- Thread API (Note)

This chapter briefly covers the main properties of the thread API. Each part will be explained further in the subsequent chapters, as we know how to use the API. More details can be found in various books and online sources. We should note that the s

Operating System: Three Easy Pieces --- Paging: TLB (Note)

Using paging as the core mechanism to support virtual memeory can lead to high performance overheads. By chopping the address space into small, fixed-sized units (pages), paging requires a large amount of mapping information. Because that mapping inf

Operating System: Three Easy Pieces --- Pthread Locks (Note)

The name that the POSIX library uses for a lock is a mutex, as it is used to provide mutual exclusion between threads, i.e., if one thread is in the critical section, it excludes the others from entering until it has completed the section. Thus, when

Operating System: Three Easy Pieces --- Mechanism: Limited Direct Execution (Note)

In order to virtualize the CPU, the operating system needs to somehow share the physical CPU among many jobs  running seemingly at the same time. The basic idea is simple: run one process for a little while, then run another, and so forth. By time sh

Operating System: Three Easy Pieces --- Process (Note)

1. How can the operating system provide the illusion of a nearly-endless supply of said CPUs? The OS creates this illusion by virtualizing the CPU. The basic technique, known as the time- sharing the CPU, allows users to run as many concurrent proces

Operating System: Three Easy Pieces --- Locks: Pthread Locks (Note)

The name that the POSIX library uses for a lock is mutex, as it is used to provide mutual exclusion between threads, i.e., if one thread is in the critical sections, it excludes the others from entering until it has completed the section. Thus, when

Operating System: Three Easy Pieces --- Limited Directed Execution (Note)

In order to virtualize the CPU, the operating system needs to somehow share the physical CPU among many jobs running seemingly at the same time. The basic idea is simple: run one process for a little while, then run another one, and so forth. By time

Operating System: Three Easy Pieces --- Beyond Physical Memory: Mechanisms (Note)

Thus far, we have assumed that an address space is unrealistically small and fits into the physical memory. In fact, we have been assuming that every address space of ervery running process fits into memory. We will now relax these big assumptions, a