old-www/LDP/LG/issue23/flower/psimage.html

74 lines
3.5 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>&nbsp;</DIV>
<FONT COLOR="#3366FF"><FONT SIZE=+3><B>Process Image</B></FONT></FONT><FONT COLOR="#3366FF"><FONT SIZE=+3></FONT></FONT>
<P><FONT SIZE=+1>&nbsp;Executable files are stored in a defined format
on the disk, different operating systems may have different definitions
for the actual format but there are generally common elements in the way
they are stored. A format commonly used on Unix systems such as Linux is
called Extensible Linked Format (ELF). An ELF programme consists of an
ELF header, a program header table, a number of sections and an optional
section header table. The header contains all the information the kernel
needs to create a process image (i.e. load the programme into memory and
allocate resources to prepare it for execution).</FONT>
<P><FONT SIZE=+1>Programme code on a multitasking operating system must
be re-entrant. This means it can be shared by multiple processes. To be
re-entrant the code must not modify itself at any time and the data must
be stored separately from the instruction text (such that each independent
process can maintain its own data space).</FONT>
<P><FONT SIZE=+1>&nbsp;When a programme is loaded as a process it is allocated
a section of virtual memory which forms its useable address space. Within
this process image there are typically at least four elements :</FONT>
<BR>&nbsp;
<CENTER><TABLE BORDER CELLPADDING=7 WIDTH="453" BORDERCOLOR="#000000" >
<TR>
<TD VALIGN=TOP WIDTH="27%"><FONT SIZE=+1>Program code (or text)</FONT></TD>
<TD VALIGN=TOP WIDTH="73%"><FONT SIZE=+1>The program instructions to be
executed. Note that it is not necessary for the processor to read the totality
of a process into physical memory when a program is run, instead by a procedure
known as ?dynamic paging? the next block of instructions is loaded as required
and may be shared between processes.</FONT></TD>
</TR>
<TR>
<TD VALIGN=TOP WIDTH="27%"><FONT SIZE=+1>Program data</FONT></TD>
<TD VALIGN=TOP WIDTH="73%"><FONT SIZE=+1>May be distinguished as initialised
variables including external global and static variables, uninitialised
variables (known as a bss area on Unix derivative systems). Data blocks
are not shared between processes by default.</FONT></TD>
</TR>
<TR>
<TD VALIGN=TOP WIDTH="27%"><FONT SIZE=+1>Stack</FONT></TD>
<TD VALIGN=TOP WIDTH="73%"><FONT SIZE=+1>A process will commonly have at
least two last-in, first-out (LIFO) stacks, including a user stack for
user mode and a kernel stack for kernel mode<FONT FACE="Courier New">.</FONT></FONT></TD>
</TR>
<TR>
<TD VALIGN=TOP WIDTH="27%"><FONT SIZE=+1>Process Control Block</FONT></TD>
<TD VALIGN=TOP WIDTH="73%"><FONT SIZE=+1>Information needed by the operating
system to control the process.</FONT></TD>
</TR>
</TABLE></CENTER>
&nbsp;
<DIV ALIGN=right>&nbsp;<A HREF="vmem.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="groups.html"><IMG SRC="../gx/flower/cyan_rig.gif" BORDER=0 HEIGHT=31 WIDTH=31></A></DIV>
&nbsp;
</BODY>
</HTML>