Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 644b84e

Browse filesBrowse files
Translate library/multiprocessing.shared_memory.po (#585)
Co-authored-by: cschan <45995789+cschan1828@users.noreply.github.com>
1 parent 3d1b20d commit 644b84e
Copy full SHA for 644b84e

File tree

Expand file treeCollapse file tree

1 file changed

+102
-14
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+102
-14
lines changed

‎library/multiprocessing.shared_memory.po

Copy file name to clipboardExpand all lines: library/multiprocessing.shared_memory.po
+102-14Lines changed: 102 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
# SOME DESCRIPTIVE TITLE.
2-
# Copyright (C) 2001-2022, Python Software Foundation
1+
# Copyright (C) 2001-2023, Python Software Foundation
32
# This file is distributed under the same license as the Python package.
4-
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
53
#
4+
# Translators:
5+
# Matt Wang <mattwang44@gmail.com>, 2023
66
msgid ""
77
msgstr ""
88
"Project-Id-Version: Python 3.12\n"
99
"Report-Msgid-Bugs-To: \n"
1010
"POT-Creation-Date: 2023-07-26 00:03+0000\n"
11-
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12-
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11+
"PO-Revision-Date: 2023-12-11 00:03+0800\n"
12+
"Last-Translator: Matt Wang <mattwang44@gmail.com>\n"
1313
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
1414
"tw)\n"
1515
"Language: zh_TW\n"
@@ -22,6 +22,7 @@ msgid ""
2222
":mod:`multiprocessing.shared_memory` --- Shared memory for direct access "
2323
"across processes"
2424
msgstr ""
25+
":mod:`multiprocessing.shared_memory` --- 對於共享記憶體的跨行程直接存取"
2526

2627
#: ../../library/multiprocessing.shared_memory.rst:7
2728
msgid "**Source code:** :source:`Lib/multiprocessing/shared_memory.py`"
@@ -37,6 +38,11 @@ msgid ""
3738
"`SharedMemoryManager`, is also provided in the ``multiprocessing.managers`` "
3839
"module."
3940
msgstr ""
41+
"該模組提供了一個 :class:`SharedMemory` 類別,用於分配和管理被多核心或對稱多處"
42+
"理器 (symmetric multiprocessor, SMP) 機器上的一個或多個行程存取的共享記憶體。"
43+
"為了協助共享記憶體的生命週期管理,特別是跨不同行程的管理,``multiprocessing."
44+
"managers`` 模組中還提供了一個 :class:`~multiprocessing.managers.BaseManager` "
45+
"子類別 :class:`SharedMemoryManager`。"
4046

4147
#: ../../library/multiprocessing.shared_memory.rst:26
4248
msgid ""
@@ -52,6 +58,13 @@ msgid ""
5258
"via disk or socket or other communications requiring the serialization/"
5359
"deserialization and copying of data."
5460
msgstr ""
61+
"在此模組中,共享記憶體是指「System V 風格」的共享記憶體區塊(儘管不一定如此明"
62+
"確實作),而不是指「分散式共享記憶體 (distributed shared memory)」。這種型別"
63+
"的共享記憶體允許不同的行程潛在地讀取和寫入揮發性記憶體 (volatile memory) 的公"
64+
"開(或共享)區域。通常行程只能存取自己的行程記憶體空間,但共享記憶體允許在行"
65+
"程之間共享資料,從而避免需要跨行程傳遞資料的情境。與透過硬碟或 "
66+
"socket 或其他需要序列化/還原序列化 (serialization/deserialization) 和複製資料"
67+
"的通訊方式以共享資料相比,直接透過記憶體共享資料可以提供顯著的性能優勢。"
5568

5669
#: ../../library/multiprocessing.shared_memory.rst:41
5770
msgid ""
@@ -61,6 +74,9 @@ msgid ""
6174
"different process can attach to that same shared memory block using that "
6275
"same name."
6376
msgstr ""
77+
"建立新的共享記憶體區塊或附加到現有的共享記憶體區塊。每個共享記憶體區塊都被分"
78+
"配了一個唯一的名稱。透過這種方式,一個行程可以建立具有特定名稱的共享記憶體區"
79+
"塊,而不同的行程可以使用該相同名稱附加到同一共享記憶體區塊。"
6480

6581
#: ../../library/multiprocessing.shared_memory.rst:47
6682
msgid ""
@@ -71,19 +87,27 @@ msgid ""
7187
"block is no longer needed by any process, the :meth:`unlink()` method should "
7288
"be called to ensure proper cleanup."
7389
msgstr ""
90+
"作為跨行程共享資料的資源,共享記憶體區塊的壽命可能比建立它們的原始行程還要"
91+
"長。當一個行程不再需要存取但其他行程可能仍需要的共享記憶體區塊時,應該呼叫 :"
92+
"meth:`close()` 方法。當任何行程不再需要共享記憶體區塊時,應呼叫 :meth:"
93+
"`unlink()` 方法以確保正確清理。"
7494

7595
#: ../../library/multiprocessing.shared_memory.rst:54
7696
msgid ""
7797
"*name* is the unique name for the requested shared memory, specified as a "
7898
"string. When creating a new shared memory block, if ``None`` (the default) "
7999
"is supplied for the name, a novel name will be generated."
80100
msgstr ""
101+
"*name* 是所請求的共享記憶體的唯一名稱,指定為字串。建立新的共享記憶體區塊時,"
102+
"如果名稱提供為 ``None``\\ (預設值),則會生成一個新的名稱。"
81103

82104
#: ../../library/multiprocessing.shared_memory.rst:58
83105
msgid ""
84106
"*create* controls whether a new shared memory block is created (``True``) or "
85107
"an existing shared memory block is attached (``False``)."
86108
msgstr ""
109+
"*create* 控制是否建立新的共享記憶體區塊 (``True``) 或附加現有的共享記憶體區"
110+
"塊 (``False``)。"
87111

88112
#: ../../library/multiprocessing.shared_memory.rst:61
89113
msgid ""
@@ -93,6 +117,10 @@ msgid ""
93117
"memory block may be larger or equal to the size requested. When attaching "
94118
"to an existing shared memory block, the ``size`` parameter is ignored."
95119
msgstr ""
120+
"*size* 指定了建立新共享記憶體區塊時請求的位元組數。由於某些平台會根據該平台的"
121+
"記憶體頁 (memory page) 大小來選擇分配記憶體區塊,因此共享記憶體區塊的確切大小"
122+
"可能大於或等於請求的大小。當附加到現有共享記憶體區塊時,``size`` 參數將被忽"
123+
"略。"
96124

97125
#: ../../library/multiprocessing.shared_memory.rst:69
98126
msgid ""
@@ -101,6 +129,9 @@ msgid ""
101129
"instance is no longer needed. Note that calling ``close()`` does not cause "
102130
"the shared memory block itself to be destroyed."
103131
msgstr ""
132+
"關閉從此實例對共享記憶體的存取。為了確保正確清理資源,一旦實例不再被需要,所"
133+
"有實例都應該呼叫 ``close()``。請注意,呼叫 ``close()`` 不會使得共享記憶體區塊"
134+
"本身被銷毀。"
104135

105136
#: ../../library/multiprocessing.shared_memory.rst:77
106137
msgid ""
@@ -114,37 +145,46 @@ msgid ""
114145
"relinquishing its hold on a shared memory block may call ``unlink()`` and :"
115146
"meth:`close()` in either order."
116147
msgstr ""
148+
"請求銷毀底層共享記憶體區塊。為了確保正確清理資源,應該在需要共享記憶體區塊的"
149+
"所有行程中呼叫一次(且僅一次)\\ ``unlink()``。請求銷毀後,共享記憶體區塊可能"
150+
"會也可能不會立即銷毀,此行為可能因平台而異。呼叫 ``unlink()`` 後嘗試存取共享"
151+
"記憶體區塊內的資料可能會導致記憶體存取錯誤。注意:最後一個放棄持有某共享記憶"
152+
"體區塊的行程可以按任意順序呼叫 ``unlink()`` 和 :meth:`close()`。"
117153

118154
#: ../../library/multiprocessing.shared_memory.rst:90
119155
msgid "A memoryview of contents of the shared memory block."
120-
msgstr ""
156+
msgstr "共享記憶體區塊內容的記憶體視圖 (memoryview)。"
121157

122158
#: ../../library/multiprocessing.shared_memory.rst:94
123159
msgid "Read-only access to the unique name of the shared memory block."
124-
msgstr ""
160+
msgstr "對共享記憶體區塊之唯一名稱的唯讀存取。"
125161

126162
#: ../../library/multiprocessing.shared_memory.rst:98
127163
msgid "Read-only access to size in bytes of the shared memory block."
128-
msgstr ""
164+
msgstr "對共享記憶體區塊大小(以位元組為單位)的唯讀存取。"
129165

130166
#: ../../library/multiprocessing.shared_memory.rst:101
131167
msgid ""
132168
"The following example demonstrates low-level use of :class:`SharedMemory` "
133169
"instances::"
134-
msgstr ""
170+
msgstr "以下範例示範了 :class:`SharedMemory` 實例的低階使用方式: ::"
135171

136172
#: ../../library/multiprocessing.shared_memory.rst:127
137173
msgid ""
138174
"The following example demonstrates a practical use of the :class:"
139175
"`SharedMemory` class with `NumPy arrays <https://numpy.org/>`_, accessing "
140176
"the same ``numpy.ndarray`` from two distinct Python shells:"
141177
msgstr ""
178+
"以下範例示範了 :class:`SharedMemory` 類別與 `NumPy 陣列 <https://numpy.org/"
179+
">`_\\ 的實際用法:從兩個不同的 Python shell 存取相同的 ``numpy.ndarray``:"
142180

143181
#: ../../library/multiprocessing.shared_memory.rst:181
144182
msgid ""
145183
"A subclass of :class:`~multiprocessing.managers.BaseManager` which can be "
146184
"used for the management of shared memory blocks across processes."
147185
msgstr ""
186+
":class:`~multiprocessing.managers.BaseManager` 的子類別,可用於跨行程管理共享"
187+
"記憶體區塊。"
148188

149189
#: ../../library/multiprocessing.shared_memory.rst:184
150190
msgid ""
@@ -159,13 +199,22 @@ msgid ""
159199
"instances through a ``SharedMemoryManager``, we avoid the need to manually "
160200
"track and trigger the freeing of shared memory resources."
161201
msgstr ""
202+
"在 :class:`SharedMemoryManager` 實例上呼叫 :meth:`~multiprocessing.managers."
203+
"BaseManager.start` 會啟動一個新行程。這個新行程的唯一目的是管理那些透過它建立"
204+
"出的所有共享記憶體區塊的生命週期。要觸發釋放該行程管理的所有共享記憶體區塊,"
205+
"請在實例上呼叫 :meth:`~multiprocessing.managers.BaseManager.shutdown()`,這會"
206+
"觸發對該行程管理的所有 :class:`SharedMemory` 物件的 :meth:`SharedMemory."
207+
"unlink()` 呼叫,然後再停止這個行程。透過 ``SharedMemoryManager`` 建立 "
208+
"``SharedMemory`` 實例,我們無需手動追蹤和觸發共享記憶體資源的釋放。"
162209

163210
#: ../../library/multiprocessing.shared_memory.rst:196
164211
msgid ""
165212
"This class provides methods for creating and returning :class:`SharedMemory` "
166213
"instances and for creating a list-like object (:class:`ShareableList`) "
167214
"backed by shared memory."
168215
msgstr ""
216+
"此類別提供了用於建立和回傳 :class:`SharedMemory` 實例以及建立由共享記憶體支援"
217+
"的類串列物件 (:class:`ShareableList`) 的方法。"
169218

170219
#: ../../library/multiprocessing.shared_memory.rst:200
171220
msgid ""
@@ -174,24 +223,31 @@ msgid ""
174223
"may be used to connect to an existing ``SharedMemoryManager`` service from "
175224
"other processes."
176225
msgstr ""
226+
"請參閱 :class:`multiprocessing.managers.BaseManager` 了解繼承的 *address* 和 "
227+
"*authkey* 可選輸入引數的描述以及如何使用它們從其他行程連接到現有的 "
228+
"``SharedMemoryManager`` 服務。"
177229

178230
#: ../../library/multiprocessing.shared_memory.rst:207
179231
msgid ""
180232
"Create and return a new :class:`SharedMemory` object with the specified "
181233
"``size`` in bytes."
182234
msgstr ""
235+
"建立並回傳一個新的 :class:`SharedMemory` 物件,該物件具有指定的 ``size``\\ "
236+
"(以位元組為單位)。"
183237

184238
#: ../../library/multiprocessing.shared_memory.rst:212
185239
msgid ""
186240
"Create and return a new :class:`ShareableList` object, initialized by the "
187241
"values from the input ``sequence``."
188242
msgstr ""
243+
"建立並回傳一個新的 :class:`ShareableList` 物件,該物件由輸入 ``sequence`` 中"
244+
"的值初始化。"
189245

190246
#: ../../library/multiprocessing.shared_memory.rst:216
191247
msgid ""
192248
"The following example demonstrates the basic mechanisms of a :class:"
193249
"`SharedMemoryManager`:"
194-
msgstr ""
250+
msgstr "以下範例示範了 :class:`SharedMemoryManager` 的基本作用機制:"
195251

196252
#: ../../library/multiprocessing.shared_memory.rst:234
197253
msgid ""
@@ -200,13 +256,18 @@ msgid ""
200256
"to ensure that all shared memory blocks are released after they are no "
201257
"longer needed:"
202258
msgstr ""
259+
"以下範例描述了一種可能更方便的模式,即透過 :keyword:`with` 陳述式使用 :class:"
260+
"`SharedMemoryManager` 物件,以確保所有共享記憶體區塊不再被需要後都被釋放:"
203261

204262
#: ../../library/multiprocessing.shared_memory.rst:253
205263
msgid ""
206264
"When using a :class:`SharedMemoryManager` in a :keyword:`with` statement, "
207265
"the shared memory blocks created using that manager are all released when "
208266
"the :keyword:`with` statement's code block finishes execution."
209267
msgstr ""
268+
"在 :keyword:`with` 陳述式中使用 :class:`SharedMemoryManager` 時,當 :keyword:"
269+
"`with` 陳述式的程式碼區塊執行完畢時,使用該管理器建立的共享記憶體區塊都會被釋"
270+
"放。"
210271

211272
#: ../../library/multiprocessing.shared_memory.rst:260
212273
msgid ""
@@ -219,13 +280,21 @@ msgid ""
219280
"no append, insert, etc.) and do not support the dynamic creation of new :"
220281
"class:`ShareableList` instances via slicing."
221282
msgstr ""
283+
"提供一個類似串列的可變物件,其中有被儲存的所有值都儲存在共享記憶體區塊中。這"
284+
"限制了可存儲的值只能夠是內建資料型別 ``int``\\ (帶符號的 64 位元 (signed 64-"
285+
"bit))、``float``、``bool``、``str``\\ (編碼為 utf-8 時個別小於 10M 位元"
286+
"組)、``bytes``\\ (個別小於 10M 位元組)和 ``None``。它還與內建的 ``list`` "
287+
"型別有顯著不同,因為這些串列不能更改其總長度(即不能追加 (append)、插入等),"
288+
"並且不支援透過切片動態建立新的 :class:`ShareableList` 實例。"
222289

223290
#: ../../library/multiprocessing.shared_memory.rst:270
224291
msgid ""
225292
"*sequence* is used in populating a new ``ShareableList`` full of values. Set "
226293
"to ``None`` to instead attach to an already existing ``ShareableList`` by "
227294
"its unique shared memory name."
228295
msgstr ""
296+
"*sequence* 用於填充 (populate) 一個充滿值的新 ``ShareableList``。設定為 "
297+
"``None`` 以透過其唯一的共享記憶體名稱來附加到已經存在的 ``ShareableList``。"
229298

230299
#: ../../library/multiprocessing.shared_memory.rst:274
231300
msgid ""
@@ -234,6 +303,9 @@ msgid ""
234303
"``ShareableList``, specify its shared memory block's unique name while "
235304
"leaving ``sequence`` set to ``None``."
236305
msgstr ""
306+
"如 :class:`SharedMemory` 的定義中所述,*name* 是被請求之共享記憶體的唯一名"
307+
"稱。當附加到現有的 ``ShareableList`` 時,指定其共享記憶體區塊的唯一名稱,同時"
308+
"將 ``sequence`` 設定為 ``None``。"
237309

238310
#: ../../library/multiprocessing.shared_memory.rst:281
239311
msgid ""
@@ -243,46 +315,58 @@ msgid ""
243315
"rstrip(b'\\x00')`` behavior is considered a bug and may go away in the "
244316
"future. See :gh:`106939`."
245317
msgstr ""
318+
":class:`bytes` 和 :class:`str` 值存在一個已知問題。如果它們以 ``\\x00`` nul "
319+
"位元組或字元結尾,那麼當透過索引從 :class:`ShareableList` 中獲取它們時,這些"
320+
"位元組或字元可能會被\\ *默默地剝離 (silently stripped)*。這種 ``."
321+
"rstrip(b'\\x00')`` 行為被認為是一個錯誤,將來可能會消失。請參閱 :gh:"
322+
"`106939`。"
246323

247324
#: ../../library/multiprocessing.shared_memory.rst:287
248325
msgid ""
249326
"For applications where rstripping of trailing nulls is a problem, work "
250327
"around it by always unconditionally appending an extra non-0 byte to the end "
251328
"of such values when storing and unconditionally removing it when fetching:"
252329
msgstr ""
330+
"對於去除尾隨空值 (rstripping of trailing nulls) 會出問題的應用程式,變通解法 "
331+
"(workaround) 是始終無條件地在儲存時於此類值的末尾追加一個額外非 0 位元組,並"
332+
"在獲取時也無條件地刪除它:"
253333

254334
#: ../../library/multiprocessing.shared_memory.rst:310
255335
msgid "Returns the number of occurrences of ``value``."
256-
msgstr ""
336+
msgstr "回傳 ``value`` 出現的次數。"
257337

258338
#: ../../library/multiprocessing.shared_memory.rst:314
259339
msgid ""
260340
"Returns first index position of ``value``. Raises :exc:`ValueError` if "
261341
"``value`` is not present."
262342
msgstr ""
343+
"回傳 ``value`` 的第一個索引位置。如果 ``value`` 不存在,則引發 :exc:"
344+
"`ValueError`。"
263345

264346
#: ../../library/multiprocessing.shared_memory.rst:319
265347
msgid ""
266348
"Read-only attribute containing the :mod:`struct` packing format used by all "
267349
"currently stored values."
268-
msgstr ""
350+
msgstr "唯讀屬性,包含所有目前有儲存的值所使用的 :mod:`struct` 打包格式。"
269351

270352
#: ../../library/multiprocessing.shared_memory.rst:324
271353
msgid "The :class:`SharedMemory` instance where the values are stored."
272-
msgstr ""
354+
msgstr "儲存值的 :class:`SharedMemory` 實例。"
273355

274356
#: ../../library/multiprocessing.shared_memory.rst:327
275357
msgid ""
276358
"The following example demonstrates basic use of a :class:`ShareableList` "
277359
"instance:"
278-
msgstr ""
360+
msgstr "以下範例示範了 :class:`ShareableList` 實例的基本用法:"
279361

280362
#: ../../library/multiprocessing.shared_memory.rst:360
281363
msgid ""
282364
"The following example depicts how one, two, or many processes may access the "
283365
"same :class:`ShareableList` by supplying the name of the shared memory block "
284366
"behind it:"
285367
msgstr ""
368+
"以下範例描述了一個、兩個或多個行程如何透過提供後面的共享記憶體區塊名稱來存取"
369+
"同一個 :class:`ShareableList`:"
286370

287371
#: ../../library/multiprocessing.shared_memory.rst:375
288372
msgid ""
@@ -292,6 +376,10 @@ msgid ""
292376
"deserialized object has the same unique name and is just attached to an "
293377
"existing object with the same name (if the object is still alive):"
294378
msgstr ""
379+
"以下範例示範了如果需要,可以對 ``ShareableList``\\ (和底層 "
380+
"``SharedMemory``\\ )物件進行 pickle 和 unpickle。請注意,它仍然是相同的共享"
381+
"物件。發生這種情況是因為反序列化的物件具有相同的唯一名稱,並且只是附加到具有"
382+
"相同名稱的現有物件(如果該物件仍然存在):"
295383

296384
#: ../../library/multiprocessing.shared_memory.rst:11
297385
msgid "Shared Memory"

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.