📄 node26.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--Converted with LaTeX2HTML 98.1 release (February 19th, 1998)
originally by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds
* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>Symmetrical Multi-Processing</TITLE>
<META NAME="description" CONTENT="Symmetrical Multi-Processing">
<META NAME="keywords" CONTENT="mpg">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<LINK REL="STYLESHEET" HREF="mpg.css">
<LINK REL="next" HREF="node27.html">
<LINK REL="previous" HREF="node24.html">
<LINK REL="up" HREF="mpg.html">
<LINK REL="next" HREF="node27.html">
</HEAD>
<BODY >
<!--Navigation Panel-->
<A NAME="tex2html694"
HREF="node27.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="next_motif.gif"></A>
<A NAME="tex2html690"
HREF="mpg.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="up_motif.gif"></A>
<A NAME="tex2html684"
HREF="node25.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="previous_motif.gif"></A>
<A NAME="tex2html692"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="contents_motif.gif"></A>
<A NAME="tex2html693"
HREF="node34.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
SRC="index_motif.gif"></A>
<BR>
<B> Next:</B> <A NAME="tex2html695"
HREF="node27.html">Common Pitfalls</A>
<B> Up:</B> <A NAME="tex2html691"
HREF="mpg.html">Linux Kernel Module Programming</A>
<B> Previous:</B> <A NAME="tex2html685"
HREF="node25.html">Keyboards on the Intel</A>
<BR>
<BR>
<!--End of Navigation Panel-->
<H1><A NAME="SECTION001400000000000000000"> </A><A NAME="smp"> </A><A NAME="717"> </A>
<A NAME="718"> </A>
<A NAME="719"> </A>
<A NAME="720"> </A>
<BR>
Symmetrical Multi-Processing
</H1>
One of the easiest (read, cheapest) ways to improve hardware performance is
to put more than one CPU on the board. This can be done either making the
different CPUs take on different jobs (asymmetrical multi-processing) or by
making them all run in parallel, doing the same job (symmetrical
multi-processing, a.k.a. SMP). Doing asymmetrical multi-processing
effectively
requires specialized knowledge about the tasks the computer should do, which
is unavailable in a general purpose operating system such as Linux. On the
other hand, symmetrical multi-processing is relatively easy to implement.
<A NAME="721"> </A>
By relatively easy, I mean exactly that -- not that it's <EM>really</EM>
easy. In a symmetrical multi-processing environment, the CPUs share the
same memory, and as a result code running in one CPU can affect the memory
used by another. You can no longer be certain that a variable you've set to
a certain value in the previous line still has that value -- the other
CPU might have played with it while you weren't looking. Obviously, it's
impossible to program like this.
<P>
In the case of process programming this normally isn't an issue, because
a process will normally only run on one CPU at a time<A NAME="tex2html265"
HREF="footnode.html#foot723"><SUP>12.1</SUP></A>. The kernel,
on the other hand, could be called by different processes running on different
CPUs.
<P>
In version 2.0.x, this isn't a problem because the entire kernel is in one
big spinlock. This means that if one CPU is in the kernel and another CPU
wants to get in, for example because of a system call, it has to wait until
the first CPU is done. This makes Linux SMP safe<A NAME="tex2html266"
HREF="footnode.html#foot724"><SUP>12.2</SUP></A>, but terriably inefficient.
<P>
In version 2.2.x, several CPUs can be in the kernel at the same time. This
is something module writers need to be aware of. I got somebody to give me
access to an SMP box, so hopefully the next version of this book will
include more information.
<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html694"
HREF="node27.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="next_motif.gif"></A>
<A NAME="tex2html690"
HREF="mpg.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="up_motif.gif"></A>
<A NAME="tex2html684"
HREF="node25.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="previous_motif.gif"></A>
<A NAME="tex2html692"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="contents_motif.gif"></A>
<A NAME="tex2html693"
HREF="node34.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
SRC="index_motif.gif"></A>
<BR>
<B> Next:</B> <A NAME="tex2html695"
HREF="node27.html">Common Pitfalls</A>
<B> Up:</B> <A NAME="tex2html691"
HREF="mpg.html">Linux Kernel Module Programming</A>
<B> Previous:</B> <A NAME="tex2html685"
HREF="node25.html">Keyboards on the Intel</A>
<!--End of Navigation Panel-->
<ADDRESS>
<I></I>
<BR><I>1999-05-19</I>
</ADDRESS>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -