125 lines
5.4 KiB
HTML
125 lines
5.4 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
|
|
<META NAME="Generator" CONTENT="Microsoft Word 97">
|
|
<META NAME="Template" CONTENT="C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\html.dot">
|
|
<META NAME="GENERATOR" CONTENT="Mozilla/4.01b6C [en] (X11; I; Linux 2.1.47 i486) [Netscape]">
|
|
<TITLE>Processes and Process Context</TITLE>
|
|
</HEAD>
|
|
<BODY BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#800080">
|
|
|
|
<DIV ALIGN=right> </DIV>
|
|
<FONT COLOR="#3366FF"><FONT SIZE=+3><B>Virtual Memory</B></FONT></FONT><FONT COLOR="#3366FF"><FONT SIZE=+3></FONT></FONT>
|
|
|
|
<P><FONT SIZE=+1> Virtual memory provides a way of running more processes
|
|
than can physically fit within a computer's physical address space.</FONT>
|
|
|
|
<P><FONT SIZE=+1> Each process that is a candidate for running on
|
|
a processor is allocated it's own virtual memory area which defines the
|
|
logical set of addresses that a process can access to carry out it's required
|
|
task. As this total virtual memory area is very large (typically
|
|
constrained by the number of address bits the processor has and the maximum
|
|
number of processes it supports), each process can be allocated a large
|
|
logical address space (typically 3Gb) in which to operate.</FONT>
|
|
|
|
<P><FONT SIZE=+1> It is the job of a virtual memory manager to ensure
|
|
that active processes and the areas they wish to access are remapped to
|
|
physical memory as required. This is achieved by a method of swapping or
|
|
paging the required sections (pages) into and out of physical memory as
|
|
required. Swapping involves replacing a complete process with
|
|
another in memory whereas paging involves removal of a 'page' (typically
|
|
2-4kbytes) of the process's mapped memory and replacing it with a page
|
|
from another process. As this may be a computer intensive and time
|
|
consuming task, care is taken to minimise the overhead that it has. This
|
|
is done by usage of a number of algorithms designed to take advantage of
|
|
the common locality of related sections of code and also only carrying
|
|
out some operations such as memory duplication or reading when absolutely
|
|
required ( techniques known as <I>copy on write, lazy paging</I> and <I>demand
|
|
paging</I>).</FONT>
|
|
|
|
<P><FONT SIZE=+1>The virtual memory owned by a process may contain code
|
|
and data from many sources. Executable code may be shared between processes
|
|
in the form of shared libraries, as these areas are read-only there is
|
|
little chance of them becoming corrupted. Processes can allocate and link
|
|
virtual memory to use during their processing,</FONT>
|
|
|
|
<P><FONT SIZE=+1> Some of the memory management techniques used by
|
|
many operating systems, including Linux and Windows NT include :</FONT>
|
|
<CENTER><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=7 WIDTH="453" >
|
|
<TR>
|
|
<TD VALIGN=TOP WIDTH="27%"><FONT SIZE=+1>Page based protection mechanism</FONT></TD>
|
|
|
|
<TD VALIGN=TOP WIDTH="73%"><FONT SIZE=+1>Each virtual page has a set of
|
|
flags which determine the types of access allowed in user mode or kernel
|
|
mode.</FONT></TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD VALIGN=TOP WIDTH="27%"><FONT SIZE=+1>Demand paging / lazy reading</FONT></TD>
|
|
|
|
<TD VALIGN=TOP WIDTH="73%"><FONT SIZE=+1>the virtual memory of a process
|
|
is brought into physical memory only when a process attempts to use it.</FONT></TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD VALIGN=TOP WIDTH="27%"><FONT SIZE=+1>Kernel and User modes of operation</FONT></TD>
|
|
|
|
<TD VALIGN=TOP WIDTH="73%"><FONT SIZE=+1>Unrestricted access to process's
|
|
memory in kernel mode but access only to it's own memory for a process
|
|
in user mode.</FONT></TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD VALIGN=TOP WIDTH="27%"><FONT SIZE=+1>Mapped files</FONT></TD>
|
|
|
|
<TD VALIGN=TOP WIDTH="73%"><FONT SIZE=+1>Memory is extended by allowing
|
|
disk files to be used as a staging area for pages swapped out of physical
|
|
memory.</FONT></TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD VALIGN=TOP WIDTH="27%"><FONT SIZE=+1>Copy on write memory</FONT></TD>
|
|
|
|
<TD VALIGN=TOP WIDTH="73%"><FONT SIZE=+1>When two processes require access
|
|
to a common area of code the virtual memory manager does not copy the section
|
|
immediately as if only read access is required the section may be used
|
|
safely by both processes. Only when a write is requested does the copy
|
|
take place.</FONT></TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD VALIGN=TOP WIDTH="27%"><FONT SIZE=+1>Shared memory</FONT></TD>
|
|
|
|
<TD VALIGN=TOP WIDTH="73%"><FONT SIZE=+1>An area of memory may be mapped
|
|
into the address space of more than one process by the calling of privileged
|
|
operations.</FONT></TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD VALIGN=TOP WIDTH="27%"><FONT SIZE=+1>Memory Locking</FONT></TD>
|
|
|
|
<TD VALIGN=TOP WIDTH="73%"><FONT SIZE=+1>To ensure a critical page can
|
|
never be swapped out of memory it may be locked in, the vritual memory
|
|
manager will not then remove it.</FONT></TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD VALIGN=TOP WIDTH="27%"><FONT SIZE=+1>For Windows NT : Object based
|
|
Memory Protection</FONT></TD>
|
|
|
|
<TD VALIGN=TOP WIDTH="73%"><FONT SIZE=+1>The NT security reference checks
|
|
access permissions for any process attempting to open a handle to that
|
|
memory section or map a view of it.</FONT>
|
|
<BR> </TD>
|
|
</TR>
|
|
</TABLE></CENTER>
|
|
|
|
<CENTER></CENTER>
|
|
|
|
<CENTER> </CENTER>
|
|
|
|
<DIV ALIGN=right><FONT SIZE=+1> </FONT><A HREF="intro.html"><IMG SRC="../gx/flower/cyan_lef.gif" BORDER=0 HEIGHT=31 WIDTH=31></A><A HREF="page1.html"><IMG SRC="../gx/flower/cyan_up.gif" BORDER=0 HEIGHT=31 WIDTH=31></A><A HREF="psimage.html"><IMG SRC="../gx/flower/cyan_rig.gif" BORDER=0 HEIGHT=31 WIDTH=31></A></DIV>
|
|
|
|
</BODY>
|
|
</HTML>
|