Re: [PATCH 1/2] docs/zh_CN: Add translation zh_CN/kernel-hacking/locking.rst

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 19, 2021 at 11:32:15AM +0800, teng sterling wrote:
> Wu XiangCheng <bobwxc@xxxxxxxx> 于2021年4月19日周一 上午12:11写道:
> >
> > Add a new translation
> >   Documentation/translations/zh_CN/kernel-hacking/locking.rst
> > and link it to zh_CN/kernel-hacking/index.rst
> >
> > Signed-off-by: Wu XiangCheng <bobwxc@xxxxxxxx>
> > ---
> >  .../zh_CN/kernel-hacking/index.rst            |    5 +-
> >  .../zh_CN/kernel-hacking/locking.rst          | 1249 +++++++++++++++++
> >  2 files changed, 1250 insertions(+), 4 deletions(-)
> >  create mode 100644 Documentation/translations/zh_CN/kernel-hacking/locking.rst
> >
> > diff --git a/Documentation/translations/zh_CN/kernel-hacking/index.rst b/Documentation/translations/zh_CN/kernel-hacking/index.rst
> > index df530de2278d..230439ae21de 100644
> > --- a/Documentation/translations/zh_CN/kernel-hacking/index.rst
> > +++ b/Documentation/translations/zh_CN/kernel-hacking/index.rst
> > @@ -16,7 +16,4 @@
> >     :maxdepth: 2
> >
> >     hacking
> > -
> > -TODO
> > -
> > -- locking
> > +   locking
> > diff --git a/Documentation/translations/zh_CN/kernel-hacking/locking.rst b/Documentation/translations/zh_CN/kernel-hacking/locking.rst
> > new file mode 100644
> > index 000000000000..66f144e48d0c
> > --- /dev/null
> > +++ b/Documentation/translations/zh_CN/kernel-hacking/locking.rst
> > @@ -0,0 +1,1249 @@
> > +.. SPDX-License-Identifier: GPL-2.0
> > +
> > +.. include:: ../disclaimer-zh_CN.rst
> > +
> > +:Original: Documentation/kernel-hacking/locking.rst
> > +
> > +:译者:
> > +
> > + 吴想成 Wu XiangCheng <bobwxc@xxxxxxxx>
> > +
> > +.. _kernel_hacking_lock_zh:
> > +
> > +==========
> > +锁操作指北
> > +==========

> 指北 -> 指南?
> I think kernel documents are publications, and the words used here are
> not formal, especially the title.
> ”指北“和”指南“在词义上有等同的地方,”指南“较为正式、严肃且使用范围广泛,”指北“较为轻松随意。
> 我们应该在不同的场合使用不同的词。详情请参阅:
> [1]李德龙.“指北”与“指南”[J].语文建设,2003(05):40.
> [2]牛津高阶双语词典
> [1]张鹏.指南针为什么不叫指北针[J].数学大世界(小学三四年级适用),2011(03):20.

Interesting, it's not a grammar problem, but a semantic problem.

The original title is "Unreliable Guide To Locking".
It it really "unreliable"? No, it is humble and funny.
“指北” also catch this meaning.

FYI, see <https://gitee.com/gitee-community/opensource-guide>

> > +
> > +:Author: Rusty Russell
> > +
> > +前言
> > +====
> > +
> > +欢迎来到Rusty的不靠谱内核锁操作问题指南。本文档描述了Linux内核2.6版本的锁系统。
> > +
> > +随着Linux内核中超线程和抢占的广泛可用,进行内核编程的每个人都需要了解SMP
> > +(Symmetrical Multi-Processing,对称多处理)的并发与锁的基本原理。
> > +
> > +并发问题
> > +========
> > +
> > +*(如果您知道什么是竞态[Race Condition],请跳过。)*

> delete *

OK

> > +
> > +在普通程序中,可以按如下方式递增计数器:
> > +
> > +::
> > +
> > +          very_important_count++;
> > +
> > +
> > +以下是他们预期会发生的:
> > +
> > +.. table:: 预期结果
> > +
> > +  +------------------------------------+------------------------------------+
> > +  | 实例 1                             | 实例 2                             |
> > +  +====================================+====================================+
> > +  | 读取 very_important_count (5)      |                                    |
> > +  +------------------------------------+------------------------------------+
> > +  | 加 1 (6)                           |                                    |
> > +  +------------------------------------+------------------------------------+
> > +  | 写回 very_important_count (6)      |                                    |
> > +  +------------------------------------+------------------------------------+
> > +  |                                    | 读取 very_important_count (6)      |
> > +  +------------------------------------+------------------------------------+
> > +  |                                    | 加 1 (7)                           |
> > +  +------------------------------------+------------------------------------+
> > +  |                                    | 写回 very_important_count (7)      |
> > +  +------------------------------------+------------------------------------+

> very_important_count Is not a file or storage hardware, it is just a
> variable in a program segment, so it should be translated as:
> read -> 读
> write -> 写

OK.

> > +
> > +以下是可能会发生的:
> > +
> > +.. table:: 可能的结果
> > +
> > +  +------------------------------------+------------------------------------+
> > +  | 实例 1                             | 实例 2                             |
> > +  +====================================+====================================+
> > +  | 读取 very_important_count (5)      |                                    |
> > +  +------------------------------------+------------------------------------+
> > +  |                                    | 读取 very_important_count (5)      |
> > +  +------------------------------------+------------------------------------+
> > +  | 加 1 (6)                           |                                    |
> > +  +------------------------------------+------------------------------------+
> > +  |                                    | 加 1 (6)                           |
> > +  +------------------------------------+------------------------------------+
> > +  | 写回 very_important_count (6)      |                                    |
> > +  +------------------------------------+------------------------------------+
> > +  |                                    | 写回 very_important_count (6)      |
> > +  +------------------------------------+------------------------------------+

> ”读“ and "写”

OK.

> > +
> > +
> > +竞争态势与临界区域

> 竞态? 竞争态势?

竞争态势,略作 竞态
标题中使用全称,下方说明括注简称与原词

> Please be consistent

> > +------------------
> > +
> > +这种重叠会导致结果取决于多个任务的相对时间,称为竞争态势(Race Condition,
> Appeared for the third time
> delete ()
> > +竞态)。包含并发问题的代码段称为临界区域(Critical Region)。特别是从Linux
> > +开始在SMP机器上运行以来,它们成为内核设计和实现中的主要问题之一。
> > +
> > +抢占(Preemption)可以产生相同的效果,即使只有一个CPU:通过在关键区域抢占一个

> 关键区域?临界区域(Critical Region)?
> Please be consistent

use 临界区域
will correct

> > +任务,就会出现一样的竞争条件。在这种情况下,抢占的线程可能会运行关键区域本身。
> > +
> > +解决方案是识别这些同步访问何时发生,并使用锁来确保任意时刻只有一个实例可以进
> > +入关键区域。Linux内核中有许多友好的原语可以帮助您做到这一点。也有一些不好使的
> > +原语,不过我会假装他们不存在。
> > +

> There's a thread called Hungry, which preemptions me.  ~>_<~
> The afternoon continues。

Nice humor! I like it.

Thanks,
Wu




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux