Initial import, synchronized with English 1.9

Obtained from: The FreeBSD Russian Documentation Project
Submitted by: Vitaly Bogdanov <gad@FreeBSD.org.ua>
This commit is contained in:
Andrey Zakhvatov 2005-06-06 07:51:13 +00:00
parent aaae9d90df
commit 8aa08b2834
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=24748

View file

@ -0,0 +1,346 @@
<!--
The FreeBSD Russian Documentation Project
The FreeBSD SMP Next Generation Project
$FreeBSD$
$FreeBSDru: frdp/doc/ru_RU.KOI8-R/books/arch-handbook/locking/chapter.sgml,v 1.4 2005/06/04 10:17:39 gad Exp $
Original revision: 1.9
-->
<chapter id="locking">
<title>úÁÍÅÞÁÎÉÑ ÐÏ ÂÌÏËÉÒÏ×ËÅ</title>
<indexterm><primary>SMP Next Generation Project</primary></indexterm>
<para><emphasis>üÔÁ ÇÌÁ×Á ÐÏÄÄÅÒÖÉ×ÁÅÔÓÑ ÐÒÏÅËÔÏÍ FreeBSD SMP Next
Generation Project. ëÏÍÍÅÎÔÁÒÉÉ É ÐÏÖÅÌÁÎÉÑ ÎÁÐÒÁ×ÌÑÊÔÅ
× &a.smp;.</emphasis></para>
<indexterm><primary>ÂÌÏËÉÒÏ×ËÁ</primary></indexterm>
<indexterm><primary>multi-processing</primary></indexterm>
<indexterm><primary>ÍØÀÔÅËÓÙ</primary></indexterm>
<indexterm><primary>lockmgr</primary></indexterm>
<indexterm><primary>ÁÔÏÍÁÒÎÙÅ ÏÐÅÒÁÃÉÉ</primary></indexterm>
<para>üÔÏÔ ÄÏËÕÍÅÎÔ ÏÐÉÓÙ×ÁÅÔ ÍÅÈÁÎÉÚÍ ÂÌÏËÉÒÏ×ËÉ, ÉÓÐÏÌØÚÕÅÍÙÊ × ÑÄÒÅ
FreeBSD ÄÌÑ ÏÂÅÓÐÅÞÅÎÉÑ ÜÆÆÅËÔÉ×ÎÏÊ ÐÏÄÄÅÒÖËÉ ÎÅÓËÏÌØËÉÈ ÐÒÏÃÅÓÓÏÒÏ× ×
ÑÄÒÅ. âÌÏËÉÒÏ×ËÕ ÍÏÖÎÏ ÒÁÓÓÍÁÔÒÉ×ÁÔØ Ó ÎÅÓËÏÌØËÉÈ ÔÏÞÅË ÚÒÅÎÉÑ.
óÔÒÕËÔÕÒÙ ÄÁÎÎÙÈ ÍÏÇÕÔ ÂÙÔØ ÚÁÝÉÝÅÎÙ Ó ÐÏÍÏÝØÀ ÂÌÏËÉÒÏ×ÏË mutex ÉÌÉ
&man.lockmgr.9;. îÅÓËÏÌØËÏ ÐÅÒÅÍÅÎÎÙÈ ÚÁÝÉÝÅÎÙ ÐÒÏÓÔÏ × ÓÉÌÕ ÁÔÏÍÁÒÎÏÓÔÉ
ÉÓÐÏÌØÚÕÅÍÙÈ ÄÌÑ ÄÏÓÔÕÐÁ Ë ÎÉÍ ÏÐÅÒÁÃÉÊ.</para>
<sect1 id="locking-mutexes">
<title>íØÀÔÅËÓÙ</title>
<para>íØÀÔÅËÓ (mutex) - ÜÔÏ ÐÒÏÓÔÏ ÂÌÏËÉÒÏ×ËÁ, ÉÓÐÏÌØÚÕÅÍÁÑ ÄÌÑ
ÒÅÁÌÉÚÁÃÉÉ ÇÁÒÁÎÔÉÒÏ×ÁÎÎÏÊ ÉÓËÌÀÞÉÔÅÌØÎÏÓÔÉ. ÷ ÞÁÓÔÎÏÓÔÉ, × ËÁÖÄÙÊ
ÍÏÍÅÎÔ ×ÒÅÍÅÎÉ ÍØÀÔÅËÓÏÍ ÍÏÖÅÔ ×ÌÁÄÅÔØ ÔÏÌØËÏ ÏÄÉÎ ÏÂßÅËÔ. åÓÌÉ
ËÁËÏÊ-ÔÏ ÏÂßÅËÔ ÈÏÞÅÔ ÐÏÌÕÞÉÔØ ÍØÀÔÅËÓ, ËÏÔÏÒÙÊ ÕÖÅ ËÔÏ-ÔÏ ÚÁÎÑÌ, ÏÎ
ÄÏÌÖÅÎ ÄÏÖÄÁÔØÓÑ ÍÏÍÅÎÔÁ ÅÇÏ ÏÓ×ÏÂÏÖÄÅÎÉÑ. ÷ ÑÄÒÅ FreeBSD ×ÌÁÄÅÌØÃÁÍÉ
ÍØÀÔÅËÓÏ× Ñ×ÌÑÀÔÓÑ ÐÒÏÃÅÓÓÙ.</para>
<para>íØÀÔÅËÓÙ ÍÏÇÕÔ ÂÙÔØ ÚÁÔÒÅÂÏ×ÁÎÙ ÒÅËÕÒÓÉ×ÎÏ, ÎÏ ÐÒÅÄÐÏÌÁÇÁÅÔÓÑ, ÞÔÏ
ÏÎÉ ÚÁÎÉÍÁÀÔÓÑ ÎÁ ËÏÒÏÔËÏÅ ×ÒÅÍÑ. ÷ ÞÁÓÔÎÏÓÔÉ, ×ÌÁÄÅÌØÃÕ ÍØÀÔÅËÓÁ
ÎÅÌØÚÑ ×ÙÄÅÒÖÉ×ÁÔØ ÐÁÕÚÕ. åÓÌÉ ×ÁÍ ÎÕÖÎÏ ×ÙÐÏÌÎÉÔØ ÂÌÏËÉÒÏ×ËÕ ÎÁ ×ÒÅÍÑ
ÐÁÕÚÙ, ÉÓÐÏÌØÚÕÊÔÅ ÂÌÏËÉÒÏ×ËÕ ÞÅÒÅÚ &man.lockmgr.9;.</para>
<para>ëÁÖÄÙÊ ÍØÀÔÅËÓ ÉÍÅÅÔ ÎÅÓËÏÌØËÏ ÐÒÅÄÓÔÁ×ÌÑÀÝÉÈ ÉÎÔÅÒÅÓ
ÈÁÒÁËÔÅÒÉÓÔÉË:</para>
<variablelist>
<varlistentry>
<term>éÍÑ ÐÅÒÅÍÅÎÎÏÊ</term>
<listitem>
<para>éÍÑ ÐÅÒÅÍÅÎÎÏÊ <type>struct mtx</type> × ÉÓÈÏÄÎÙÈ ÔÅËÓÔÁÈ
ÑÄÒÁ.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>ìÏÇÉÞÅÓËÏÅ ÉÍÑ</term>
<listitem>
<para>éÍÑ ÍØÀÔÅËÓÁ, ÎÁÚÎÁÞÅÎÎÏÅ ÅÍÕ ÞÅÒÅÚ
<function>mtx_init</function>. üÔÏ ÉÍÑ ×Ù×ÏÄÉÔÓÑ × ÓÏÏÂÝÅÎÉÑÈ
ÔÒÁÓÓÉÒÏ×ËÉ KTR É ÄÉÁÇÎÏÓÔÉÞÅÓËÉÈ ÐÒÅÄÕÐÒÅÖÄÁÀÝÉÈ É ÏÛÉÂÏÞÎÙÈ
ÓÏÏÂÝÅÎÉÑÈ É ÉÓÐÏÌØÚÕÅÔÓÑ ÄÌÑ ÉÄÅÎÔÉÆÉËÁÃÉÉ ÍØÀÔÅËÓÏ× ×
ÏÔÌÁÄÏÞÎÏÍ ËÏÄÅ.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>ôÉÐ</term>
<listitem>
<para>ôÉÐ ÍØÀÔÅËÓÁ × ÔÅÒÍÉÎÁÈ ÆÌÁÇÏ× <constant>MTX_*</constant>.
úÎÁÞÅÎÉÅ ËÁÖÄÏÇÏ ÆÌÁÇÁ Ó×ÑÚÁÎÏ Ó ÅÇÏ ÓÍÙÓÌÏÍ ÔÁË, ËÁË ÜÔÏ ÏÐÉÓÁÎÏ
× &man.mutex.9;.</para>
<variablelist>
<varlistentry>
<term><constant>MTX_DEF</constant></term>
<listitem>
<para>Sleep-ÍØÀÔÅËÓ</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>MTX_SPIN</constant></term>
<listitem>
<para>Spin-ÍØÀÔÅËÓ</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>MTX_RECURSE</constant></term>
<listitem>
<para>üÔÏÍÕ ÍØÀÔÅËÓÕ ÒÁÚÒÅÛÁÅÔÓÑ ÂÌÏËÉÒÏ×ÁÔØ
ÒÅËÕÒÓÉ×ÎÏ.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
<varlistentry>
<term>úÁÝÉÔÙ</term>
<listitem>
<para>óÐÉÓÏË ÓÔÒÕËÔÕÒ ÄÁÎÎÙÈ ÉÌÉ ÞÌÅÎÏ× ÓÔÒÕËÔÕÒ ÄÁÎÎÙÈ, ËÏÔÏÒÙÅ
ÚÁÝÉÝÁÅÔ ÜÔÏÔ ÍØÀÔÅËÓ. äÌÑ ÞÌÅÎÏ× ÓÔÒÕËÔÕÒ ÄÁÎÎÙÈ ÉÍÑ ÂÕÄÅÔ ×
ÆÏÒÍÅ
<structname/ÉÍÑ ÓÔÒÕËÔÕÒÙ/.<structfield/ÉÍÑ ÞÌÅÎÁ
ÓÔÒÕËÔÕÒÙ/.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>úÁ×ÉÓÉÍÙÅ ÆÕÎËÃÉÉ</term>
<listitem>
<para>æÕÎËÃÉÉ, ËÏÔÏÒÙÅ ÍÏÖÎÏ ×ÙÚ×ÁÔØ, ÅÓÌÉ ÜÔÏÔ ÍØÀÔÅËÓ
ÚÁÎÑÔ.</para>
</listitem>
</varlistentry>
</variablelist>
<table frame="all" colsep="1" rowsep="1" pgwide="1">
<title>óÐÉÓÏË ÍØÀÔÅËÓÏ×</title>
<indexterm><primary>ÂÌÏËÉÒÏ×ËÉ</primary>
<secondary>sched_lock</secondary></indexterm>
<indexterm><primary>ÂÌÏËÉÒÏ×ËÉ</primary>
<secondary>vm86pcb_lock</secondary></indexterm>
<indexterm><primary>ÂÌÏËÉÒÏ×ËÉ</primary>
<secondary>Giant</secondary></indexterm>
<indexterm><primary>ÂÌÏËÉÒÏ×ËÉ</primary>
<secondary>callout_lock</secondary></indexterm>
<tgroup cols="5">
<thead>
<row>
<entry>éÍÑ ÐÅÒÅÍÅÎÎÏÊ</entry>
<entry>ìÏÇÉÞÅÓËÏÅ ÉÍÑ</entry>
<entry>ôÉÐ</entry>
<entry>úÁÝÉÔÙ</entry>
<entry>úÁ×ÉÓÉÍÙÅ ÆÕÎËÃÉÉ</entry>
</row>
</thead>
<!-- âÌÏËÉÒÏ×ËÁ ÐÌÁÎÉÒÏ×ÝÉËÁ ÚÁÄÁÞ -->
<tbody>
<row>
<entry>sched_lock</entry>
<entry><quote>sched lock</quote></entry>
<entry>
<constant>MTX_SPIN</constant> |
<constant>MTX_RECURSE</constant>
</entry>
<entry>
<varname>_gmonparam</varname>,
<varname>cnt.v_swtch</varname>,
<varname>cp_time</varname>,
<varname>curpriority</varname>,
<structname/mtx/.<structfield/mtx_blocked/,
<structname/mtx/.<structfield/mtx_contested/,
<structname/proc/.<structfield/p_procq/,
<structname/proc/.<structfield/p_slpq/,
<structname/proc/.<structfield/p_sflag/,
<structname/proc/.<structfield/p_stat/,
<structname/proc/.<structfield/p_estcpu/,
<structname/proc/.<structfield/p_cpticks/
<structname/proc/.<structfield/p_pctcpu/,
<structname/proc/.<structfield/p_wchan/,
<structname/proc/.<structfield/p_wmesg/,
<structname/proc/.<structfield/p_swtime/,
<structname/proc/.<structfield/p_slptime/,
<structname/proc/.<structfield/p_runtime/,
<structname/proc/.<structfield/p_uu/,
<structname/proc/.<structfield/p_su/,
<structname/proc/.<structfield/p_iu/,
<structname/proc/.<structfield/p_uticks/,
<structname/proc/.<structfield/p_sticks/,
<structname/proc/.<structfield/p_iticks/,
<structname/proc/.<structfield/p_oncpu/,
<structname/proc/.<structfield/p_lastcpu/,
<structname/proc/.<structfield/p_rqindex/,
<structname/proc/.<structfield/p_heldmtx/,
<structname/proc/.<structfield/p_blocked/,
<structname/proc/.<structfield/p_mtxname/,
<structname/proc/.<structfield/p_contested/,
<structname/proc/.<structfield/p_priority/,
<structname/proc/.<structfield/p_usrpri/,
<structname/proc/.<structfield/p_nativepri/,
<structname/proc/.<structfield/p_nice/,
<structname/proc/.<structfield/p_rtprio/,
<varname>pscnt</varname>,
<varname>slpque</varname>,
<varname>itqueuebits</varname>,
<varname>itqueues</varname>,
<varname>rtqueuebits</varname>,
<varname>rtqueues</varname>,
<varname>queuebits</varname>,
<varname>queues</varname>,
<varname>idqueuebits</varname>,
<varname>idqueues</varname>,
<varname>switchticks</varname>,
</entry>
<entry>
<function>setrunqueue</function>,
<function>remrunqueue</function>,
<function>mi_switch</function>,
<function>chooseproc</function>,
<function>schedclock</function>,
<function>resetpriority</function>,
<function>updatepri</function>,
<function>maybe_resched</function>,
<function>cpu_switch</function>,
<function>cpu_throw</function>,
<function>need_resched</function>,
<function>resched_wanted</function>,
<function>clear_resched</function>,
<function>aston</function>,
<function>astoff</function>,
<function>astpending</function>,
<function>calcru</function>,
<function>proc_compare</function>
</entry>
</row>
<!-- The vm86 pcb lock -->
<row>
<entry>vm86pcb_lock</entry>
<entry><quote>vm86pcb lock</quote></entry>
<entry>
<constant>MTX_DEF</constant>
</entry>
<entry>
<varname>vm86pcb</varname>
</entry>
<entry>
<function>vm86_bioscall</function>
</entry>
</row>
<!-- Giant -->
<row>
<entry>Giant</entry>
<entry><quote>Giant</quote></entry>
<entry>
<constant>MTX_DEF</constant> |
<constant>MTX_RECURSE</constant>
</entry>
<entry>nearly everything</entry>
<entry>lots</entry>
</row>
<!-- The callout lock -->
<row>
<entry>callout_lock</entry>
<entry><quote>callout lock</quote></entry>
<entry>
<constant>MTX_SPIN</constant> |
<constant>MTX_RECURSE</constant>
</entry>
<entry>
<varname>callfree</varname>,
<varname>callwheel</varname>,
<varname>nextsoftcheck</varname>,
<structname/proc/.<structfield/p_itcallout/,
<structname/proc/.<structfield/p_slpcallout/,
<varname>softticks</varname>,
<varname>ticks</varname>
</entry>
<entry>
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="locking-sx">
<title>òÁÚÄÅÌÑÅÍÙÅ ÜËÓËÌÀÚÉ×ÎÙÅ ÂÌÏËÉÒÏ×ËÉ</title>
<para>üÔÉ ÂÌÏËÉÒÏ×ËÉ ÏÂÅÓÐÅÞÉ×ÁÀÔ ÂÁÚÏ×ÙÊ ÔÉÐ
ÆÕÎËÃÉÏÎÁÌØÎÏÓÔÉ - ÎÁ ÞÔÅÎÉÅ/ÚÁÐÉÓØ É ÍÏÇÕÔ
ÐÏÄÄÅÒÖÉ×ÁÔØÓÑ ÐÒÏÃÅÓÓÁÍÉ, ÎÁÈÏÄÑÝÉÍÓÑ × ÓÏÓÔÏÑÎÉÉ
ÏÖÉÄÁÎÉÑ. îÁ ÔÅËÕÝÉÊ ÍÏÍÅÎÔ ÏÎÉ ÒÅÁÌÉÚÏ×ÁÎÙ × &man.lockmgr.9;.</para>
<table>
<title>óÐÉÓÏË ÒÁÚÄÅÌÑÅÍÙÈ ÜËÓËÌÀÚÉ×ÎÙÈ ÂÌÏËÉÒÏ×ÏË</title>
<indexterm><primary>ÂÌÏËÉÒÏ×ËÉ</primary>
<secondary>allproc_lock</secondary></indexterm>
<indexterm><primary>ÂÌÏËÉÒÏ×ËÉ</primary>
<secondary>proctree_lock</secondary></indexterm>
<tgroup cols="2">
<thead>
<row>
<entry>éÍÑ ÐÅÒÅÍÅÎÎÏÊ</entry>
<entry>úÁÝÉÔÙ</entry>
</row>
</thead>
<tbody>
<row>
<entry><varname>allproc_lock</varname></entry>
<entry>
<varname>allproc</varname>
<varname>zombproc</varname>
<varname>pidhashtbl</varname>
<structname/proc/.<structfield/p_list/
<structname/proc/.<structfield/p_hash/
<varname>nextpid</varname>
</entry>
</row>
<row>
<entry><varname>proctree_lock</varname></entry>
<entry>
<structname/proc/.<structfield/p_children/
<structname/proc/.<structfield/p_sibling/
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="locking-atomic">
<title>áÔÏÍÁÒÎÏ ÚÁÝÉÝÅÎÎÙÅ ÐÅÒÅÍÅÎÎÙÅ</title>
<indexterm><primary>ÁÔÏÍÁÒÎÏ ÚÁÝÉÝ£ÎÎÙÅ ÐÅÒÅÍÅÎÎÙÅ</primary></indexterm>
<para>ðÅÒÅÍÅÎÎÏÊ, ÚÁÝÉÝÅÎÎÏÊ ÁÔÏÍÁÒÎÏ, Ñ×ÌÑÅÔÓÑ ÏÓÏÂÁÑ ÐÅÒÅÍÅÎÎÁÑ,
ËÏÔÏÒÁÑ ÎÅ ÚÁÝÉÝÁÅÔÓÑ Ñ×ÎÏÊ ÂÌÏËÉÒÏ×ËÏÊ. ÷ÍÅÓÔÏ ÜÔÏÇÏ ÄÌÑ ÄÏÓÔÕÐÁ Ë
ÄÁÎÎÙÍ ÐÅÒÅÍÅÎÎÙÈ ÉÓÐÏÌØÚÕÀÔÓÑ ÓÐÅÃÉÁÌØÎÙÅ ÁÔÏÍÁÒÎÙÅ ÏÐÅÒÁÃÉÉ, ËÁË
ÏÐÉÓÁÎÏ × &man.atomic.9;. ìÉÛØ ÎÅÓËÏÌØËÏ ÐÅÒÅÍÅÎÎÙÈ ÉÓÐÏÌØÚÕÀÔÓÑ ÔÁËÉÍ
ÏÂÒÁÚÏÍ, ÈÏÔÑ ÄÒÕÇÉÅ ÐÒÉÍÉÔÉ×Ù ÓÉÎÈÒÏÎÉÚÁÃÉÉ, ÔÁËÉÅ ËÁË ÍØÀÔÅËÓÙ,
ÒÅÁÌÉÚÏ×ÁÎÙ Ó ÁÔÏÍÁÒÎÏ ÚÁÝÉÝÅÎÎÙÍÉ ÐÅÒÅÍÅÎÎÙÍÉ.</para>
<itemizedlist>
<listitem>
<para><structname/mtx/.<structfield/mtx_lock/</para>
</listitem>
</itemizedlist>
</sect1>
</chapter>