linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Wu X.C." <bobwxc@email.cn>
To: teng sterling <sterlingteng@gmail.com>
Cc: Alex Shi <alexs@kernel.org>, Jonathan Corbet <corbet@lwn.net>,
	Yanteng Si <siyanteng@loongson.cn>,
	linux-doc@vger.kernel.org
Subject: Re: [PATCH 1/2] docs/zh_CN: Add translation zh_CN/kernel-hacking/locking.rst
Date: Mon, 19 Apr 2021 14:04:48 +0800	[thread overview]
Message-ID: <20210419060448.GA3967@bobwxc.top> (raw)
In-Reply-To: <CAMU9jJoe3-DJa8FwwsbciYn9bnfBr+BX+4_3Y5=8VA_OnysW_w@mail.gmail.com>

On Mon, Apr 19, 2021 at 11:32:15AM +0800, teng sterling wrote:
> Wu XiangCheng <bobwxc@email.cn> 于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@email.cn>
> > ---
> >  .../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@email.cn>
> > +
> > +.. _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


  reply	other threads:[~2021-04-19  6:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-18 16:10 [PATCH 1/2] docs/zh_CN: Add translation zh_CN/kernel-hacking/locking.rst Wu XiangCheng
2021-04-18 16:11 ` [PATCH 2/2] docs: kernel-hacking: Fix two ref links Wu XiangCheng
2021-04-19  3:32 ` [PATCH 1/2] docs/zh_CN: Add translation zh_CN/kernel-hacking/locking.rst teng sterling
2021-04-19  6:04   ` Wu X.C. [this message]
2021-04-19 11:57   ` teng sterling
2021-04-19 13:00     ` Wu X.C.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210419060448.GA3967@bobwxc.top \
    --to=bobwxc@email.cn \
    --cc=alexs@kernel.org \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=siyanteng@loongson.cn \
    --cc=sterlingteng@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).