-
Notifications
You must be signed in to change notification settings - Fork 2
/
other.tex
48 lines (44 loc) · 2.39 KB
/
other.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
\begin{slide}
\sltitle{Virtual memory implementation}
\begin{itemize}
\item processes in UNIX use virtual addresses to access physical memory.
The virtual - physical conversion is performed by hardware with the help
of kernel.
\item in case of memory shortage unused parts of memory are stored to
(\emsl{swap}) space on disk.
\item before SVR2 the \texttt{swapper} process (nowadays
\texttt{sched}) swapped out whole processes.
\item from SVR2 on (\emsl{demand paging}) is used with \emsl{copy-on-write}.
Pages are allocated only after first use and private pages are copied only
after modification. Freeing and swapping of individual pages is performed
by the \texttt{pageout} process, swapping of whole processes is done only
when critically low on memory.
\end{itemize}
\end{slide}
\begin{description}
\item[address translation:] access to invalid address or attempt to write into
read-only memory will result in the \texttt{SIGSEGV} signal to be delivered.
\item[swap:] swap area is created on separate disk partition, since
SVR4 it can be also in a file.
\item[swapper:] the \texttt{swapper} process tries to save a process
to disk and use the free space for a process that was swapped out earlier.
\item[demand paging:] when a process requests a memory only the page is
modified. The first instruction addressing the page contents will result in an
exception. The kernel will handle it by allocating a page.
\item[copy-on-write:] multiple processes can share writable physical page that
is however logically private to each process (such situation happens e.g. when a
process is created by the \texttt{fork} system call). Until the processes only
read from the memory, they access the shared page. First attempt to write will
cause an exception. The kernel will copy the page and assign a copy of the
page to the process that is already a private and the process can change it.
The other process keep using the original page.
\item The pages to be swapped out are searched for by the \emph{NRU} (not
recently used) algorithm: each page has the \texttt{referenced} and
\texttt{modified} flags, both zero initially. First access will set
\texttt{referenced}, a change will set \texttt{modified}.
Both flags are periodically nullified. The pages that are neither modified or
used are freed first. The program code pages and pages of mapped files are not
stored into swap area, they are fetched from given file.
\end{description}
%%%%%
\endinput