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
66msgid ""
77msgstr ""
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-08-16 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"
2424msgstr ""
25+ ":mod:`multiprocessing.shared_memory` --- 對於共享記憶體的跨行程直接存取"
2526
2627#: ../../library/multiprocessing.shared_memory.rst:7
2728msgid "**Source code:** :source:`Lib/multiprocessing/shared_memory.py`"
@@ -37,6 +38,11 @@ msgid ""
3738"`SharedMemoryManager`, is also provided in the ``multiprocessing.managers`` "
3839"module."
3940msgstr ""
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
4248msgid ""
@@ -52,6 +58,13 @@ msgid ""
5258"via disk or socket or other communications requiring the serialization/"
5359"deserialization and copying of data."
5460msgstr ""
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
5770msgid ""
@@ -61,6 +74,9 @@ msgid ""
6174"different process can attach to that same shared memory block using that "
6275"same name."
6376msgstr ""
77+ "建立新的共享記憶體區塊或附加到現有的共享記憶體區塊。每個共享記憶體區塊都被分"
78+ "配了一個唯一的名稱。透過這種方式,一個行程可以建立具有特定名稱的共享記憶體區"
79+ "塊,而不同的行程可以使用該相同名稱附加到同一共享記憶體區塊。"
6480
6581#: ../../library/multiprocessing.shared_memory.rst:47
6682msgid ""
@@ -71,28 +87,40 @@ msgid ""
7187"block is no longer needed by any process, the :meth:`unlink()` method should "
7288"be called to ensure proper cleanup."
7389msgstr ""
90+ "作為跨行程共享資料的資源,共享記憶體區塊的壽命可能比建立它們的原始行程還要"
91+ "長。當一個行程不再需要存取但其他行程可能仍需要的共享記憶體區塊時,應該呼叫 :"
92+ "meth:`close()` 方法。當任何行程不再需要共享記憶體區塊時,應呼叫 :meth:"
93+ "`unlink()` 方法以確保正確清理。"
7494
7595#: ../../library/multiprocessing.shared_memory.rst:54
7696msgid ""
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."
80100msgstr ""
101+ "*name* 是所請求的共享記憶體的唯一名稱,指定為字串。建立新的共享記憶體區塊時,"
102+ "如果名稱提供為 ``None``\\ (預設值),則會生成一個新的名稱。"
81103
82104#: ../../library/multiprocessing.shared_memory.rst:58
83105msgid ""
84106"*create* controls whether a new shared memory block is created (``True``) or "
85107"an existing shared memory block is attached (``False``)."
86108msgstr ""
109+ "*create* 控制是否建立新的共享記憶體區塊 (``True``) 或附加現有的共享記憶體區"
110+ "塊 (``False``)。"
87111
88112#: ../../library/multiprocessing.shared_memory.rst:61
113+ #, fuzzy
89114msgid ""
90115"*size* specifies the requested number of bytes when creating a new shared "
91116"memory block. Because some platforms choose to allocate chunks of memory "
92117"based upon that platform's memory page size, the exact size of the shared "
93118"memory block may be larger or equal to the size requested. When attaching "
94119"to an existing shared memory block, the ``size`` parameter is ignored."
95120msgstr ""
121+ "*size* 指定建立新共享記憶體區塊時請求的位元組數。由於某些平台選擇根據該平台的"
122+ "記憶體頁大小來分配記憶體區塊,因此共享記憶體區塊的確切大小可能大於或等於請求"
123+ "的大小。當附加到現有共享記憶體區塊時,``size`` 參數將被忽略。"
96124
97125#: ../../library/multiprocessing.shared_memory.rst:69
98126msgid ""
@@ -101,8 +129,12 @@ msgid ""
101129"instance is no longer needed. Note that calling ``close()`` does not cause "
102130"the shared memory block itself to be destroyed."
103131msgstr ""
132+ "關閉從此實例對共享記憶體的存取。為了確保正確清理資源,一旦不再需要實例,所有"
133+ "實例都應該呼叫 ``close()``。請注意,呼叫 ``close()`` 不會使得共享記憶體區塊本"
134+ "身被銷毀。"
104135
105136#: ../../library/multiprocessing.shared_memory.rst:77
137+ #, fuzzy
106138msgid ""
107139"Requests that the underlying shared memory block be destroyed. In order to "
108140"ensure proper cleanup of resources, ``unlink()`` should be called once (and "
@@ -114,39 +146,49 @@ msgid ""
114146"relinquishing its hold on a shared memory block may call ``unlink()`` and :"
115147"meth:`close()` in either order."
116148msgstr ""
149+ "請求銷毀底層共享記憶體區塊。為了確保正確清理資源,應該在需要共享記憶體區塊的"
150+ "所有行程中呼叫一次(且僅一次)\\ ``unlink()``。請求銷毀後,共享記憶體區塊可能"
151+ "會也可能不會立即銷毀,並且此行為可能因平台而異。呼叫 ``unlink()`` 後嘗試存取"
152+ "共享記憶體區塊內的資料可能會導致記憶體存取錯誤。注意:最後一個放棄對共享記憶"
153+ "體區塊的持有的行程可以按任意順序呼叫 ``unlink()`` 和 :meth:`close()`。"
117154
118155#: ../../library/multiprocessing.shared_memory.rst:90
119156msgid "A memoryview of contents of the shared memory block."
120- msgstr ""
157+ msgstr "共享記憶體區塊內容的記憶體視圖 (memoryview)。 "
121158
122159#: ../../library/multiprocessing.shared_memory.rst:94
123160msgid "Read-only access to the unique name of the shared memory block."
124- msgstr ""
161+ msgstr "對共享記憶體區塊之唯一名稱的唯讀存取。 "
125162
126163#: ../../library/multiprocessing.shared_memory.rst:98
127164msgid "Read-only access to size in bytes of the shared memory block."
128- msgstr ""
165+ msgstr "對共享記憶體區塊大小(以位元組為單位)的唯讀存取。 "
129166
130167#: ../../library/multiprocessing.shared_memory.rst:101
131168msgid ""
132169"The following example demonstrates low-level use of :class:`SharedMemory` "
133170"instances::"
134- msgstr ""
171+ msgstr "以下範例示範了 :class:`SharedMemory` 實例的低階使用方式:: : "
135172
136173#: ../../library/multiprocessing.shared_memory.rst:127
137174msgid ""
138175"The following example demonstrates a practical use of the :class:"
139176"`SharedMemory` class with `NumPy arrays <https://numpy.org/>`_, accessing "
140177"the same ``numpy.ndarray`` from two distinct Python shells:"
141178msgstr ""
179+ "以下範例示範了 :class:`SharedMemory` 類別與 `NumPy 陣列 <https://numpy.org/"
180+ ">`_ 的實際用法:從兩個不同的 Python shell 存取相同的 ``numpy.ndarray``:"
142181
143182#: ../../library/multiprocessing.shared_memory.rst:181
144183msgid ""
145184"A subclass of :class:`~multiprocessing.managers.BaseManager` which can be "
146185"used for the management of shared memory blocks across processes."
147186msgstr ""
187+ ":class:`~multiprocessing.managers.BaseManager` 的子類別,可用於跨行程管理共享"
188+ "記憶體區塊。"
148189
149190#: ../../library/multiprocessing.shared_memory.rst:184
191+ #, fuzzy
150192msgid ""
151193"A call to :meth:`~multiprocessing.managers.BaseManager.start` on a :class:"
152194"`SharedMemoryManager` instance causes a new process to be started. This new "
@@ -159,13 +201,22 @@ msgid ""
159201"instances through a ``SharedMemoryManager``, we avoid the need to manually "
160202"track and trigger the freeing of shared memory resources."
161203msgstr ""
204+ "在 :class:`SharedMemoryManager` 實例上呼叫:meth:`~multiprocessing.managers."
205+ "BaseManager.start` 會導致啟動一個新行程。這個新行程的唯一目的是管理透過它建立"
206+ "的所有共享記憶體區塊的生命週期。要觸發釋放該行程管理的所有共享記憶體區塊,請"
207+ "在實例上呼叫:meth:`~multiprocessing.managers.BaseManager.shutdown()`。這會觸"
208+ "發對該行程管理的所有 :class:`SharedMemory` 物件的 :meth:`SharedMemory."
209+ "unlink()` 呼叫,然後停止行程本身。透過透過 ``SharedMemoryManager`` 建立 "
210+ "``SharedMemory`` 實例,我們無需手動追蹤和觸發共享記憶體資源的釋放。"
162211
163212#: ../../library/multiprocessing.shared_memory.rst:196
164213msgid ""
165214"This class provides methods for creating and returning :class:`SharedMemory` "
166215"instances and for creating a list-like object (:class:`ShareableList`) "
167216"backed by shared memory."
168217msgstr ""
218+ "此類別提供了用於建立和回傳 :class:`SharedMemory` 實例以及建立由共享記憶體支援"
219+ "的類列表物件 (:class:`ShareableList`) 的方法。"
169220
170221#: ../../library/multiprocessing.shared_memory.rst:200
171222msgid ""
@@ -174,41 +225,56 @@ msgid ""
174225"may be used to connect to an existing ``SharedMemoryManager`` service from "
175226"other processes."
176227msgstr ""
228+ "請參閱 :class:`multiprocessing.managers.BaseManager` 了解繼承的 *address* 和 "
229+ "*authkey* 可選輸入引數的描述以及如何使用它們從其他行程連接到現有的 "
230+ "``SharedMemoryManager`` 服務。"
177231
178232#: ../../library/multiprocessing.shared_memory.rst:207
179233msgid ""
180234"Create and return a new :class:`SharedMemory` object with the specified "
181235"``size`` in bytes."
182236msgstr ""
237+ "建立並回傳一個新的 :class:`SharedMemory` 物件,該物件具有指定的 ``size``\\ "
238+ "(以位元組為單位)。"
183239
184240#: ../../library/multiprocessing.shared_memory.rst:212
185241msgid ""
186242"Create and return a new :class:`ShareableList` object, initialized by the "
187243"values from the input ``sequence``."
188244msgstr ""
245+ "建立並回傳一個新的 :class:`ShareableList` 物件,該物件由輸入 ``sequence`` 中"
246+ "的值初始化。"
189247
190248#: ../../library/multiprocessing.shared_memory.rst:216
191249msgid ""
192250"The following example demonstrates the basic mechanisms of a :class:"
193251"`SharedMemoryManager`:"
194- msgstr ""
252+ msgstr "以下範例示範了 :class:`SharedMemoryManager` 的基本作用機制: "
195253
196254#: ../../library/multiprocessing.shared_memory.rst:234
255+ #, fuzzy
197256msgid ""
198257"The following example depicts a potentially more convenient pattern for "
199258"using :class:`SharedMemoryManager` objects via the :keyword:`with` statement "
200259"to ensure that all shared memory blocks are released after they are no "
201260"longer needed:"
202261msgstr ""
262+ "以下範例描述了一種可能更方便的模式,即透過 :keyword:`with` 陳述式使用 :class:"
263+ "`SharedMemoryManager` 物件,以確保所有共享記憶體區塊在不再需要後都被釋放:"
203264
204265#: ../../library/multiprocessing.shared_memory.rst:253
266+ #, fuzzy
205267msgid ""
206268"When using a :class:`SharedMemoryManager` in a :keyword:`with` statement, "
207269"the shared memory blocks created using that manager are all released when "
208270"the :keyword:`with` statement's code block finishes execution."
209271msgstr ""
272+ "在 :keyword:`with` 陳述式中使用 :class:`SharedMemoryManager` 時,當 :keyword:"
273+ "`with` 陳述式的程式碼塊執行完畢時,使用該管理器建立的共享記憶體區塊都會被釋"
274+ "放。"
210275
211276#: ../../library/multiprocessing.shared_memory.rst:260
277+ #, fuzzy
212278msgid ""
213279"Provides a mutable list-like object where all values stored within are "
214280"stored in a shared memory block. This constrains storable values to only "
@@ -219,13 +285,22 @@ msgid ""
219285"no append, insert, etc.) and do not support the dynamic creation of new :"
220286"class:`ShareableList` instances via slicing."
221287msgstr ""
288+ "提供一個類似列表的可變物件,其中儲存的所有值都儲存在共享記憶體區塊中。這將可"
289+ "存儲值限制為僅 ``int``(帶符號的 64 位)、``float``、``bool``、``str``(編碼"
290+ "為 utf-8 時每個小於 10M 位元組), ``bytes`` (每個小於10M 位元組)和``None``"
291+ "內建資料型別。它還與內建的 ``list`` 型別顯著不同,因為這些列表不能更改其總長"
292+ "度(即不能追加、插入等),並且不支援動態建立新的 :class:`ShareableList` 透過"
293+ "切片的實例。"
222294
223295#: ../../library/multiprocessing.shared_memory.rst:270
296+ #, fuzzy
224297msgid ""
225298"*sequence* is used in populating a new ``ShareableList`` full of values. Set "
226299"to ``None`` to instead attach to an already existing ``ShareableList`` by "
227300"its unique shared memory name."
228301msgstr ""
302+ "*sequence* 用於填充一個充滿值的新 ``ShareableList``。設定為 ``None`` 以透過其"
303+ "唯一的共享記憶體名稱附加到已經存在的 ``ShareableList``。"
229304
230305#: ../../library/multiprocessing.shared_memory.rst:274
231306msgid ""
@@ -234,55 +309,71 @@ msgid ""
234309"``ShareableList``, specify its shared memory block's unique name while "
235310"leaving ``sequence`` set to ``None``."
236311msgstr ""
312+ "如 :class:`SharedMemory` 的定義中所述,*name* 是被請求之共享記憶體的唯一名"
313+ "稱。當附加到現有的 ``ShareableList`` 時,指定其共享記憶體區塊的唯一名稱,同時"
314+ "將 ``sequence`` 設定為 ``None``。"
237315
238316#: ../../library/multiprocessing.shared_memory.rst:281
317+ #, fuzzy
239318msgid ""
240319"A known issue exists for :class:`bytes` and :class:`str` values. If they end "
241320"with ``\\ x00`` nul bytes or characters, those may be *silently stripped* "
242321"when fetching them by index from the :class:`ShareableList`. This ``."
243322"rstrip(b'\\ x00')`` behavior is considered a bug and may go away in the "
244323"future. See :gh:`106939`."
245324msgstr ""
325+ ":class:`bytes` 和 :class:`str` 值存在一個已知問題。如果它們以 ``\\ x00`` nul "
326+ "位元組或字元結尾,那麼當透過索引從 :class:`ShareableList` 中獲取它們時,這些"
327+ "位元組或字元可能會被 *默默地剝離*。這種 ``.rstrip(b'\\ x00')`` 行為被認為是一"
328+ "個錯誤,將來可能會消失。請參閱 :gh:`106939`。"
246329
247330#: ../../library/multiprocessing.shared_memory.rst:287
331+ #, fuzzy
248332msgid ""
249333"For applications where rstripping of trailing nulls is a problem, work "
250334"around it by always unconditionally appending an extra non-0 byte to the end "
251335"of such values when storing and unconditionally removing it when fetching:"
252336msgstr ""
337+ "對於存在尾隨空值刪除問題的應用程序,可以透過在儲存時始終無條件地在此類值的末"
338+ "尾附加一個額外的非 0 位元組並在獲取時無條件地刪除它來解決該問題:"
253339
254340#: ../../library/multiprocessing.shared_memory.rst:310
255341msgid "Returns the number of occurrences of ``value``."
256- msgstr ""
342+ msgstr "回傳 ``value`` 出現的次數。 "
257343
258344#: ../../library/multiprocessing.shared_memory.rst:314
259345msgid ""
260346"Returns first index position of ``value``. Raises :exc:`ValueError` if "
261347"``value`` is not present."
262348msgstr ""
349+ "回傳 ``value`` 的第一個索引位置。如果 ``value`` 不存在,則引發 :exc:"
350+ "`ValueError`。"
263351
264352#: ../../library/multiprocessing.shared_memory.rst:319
265353msgid ""
266354"Read-only attribute containing the :mod:`struct` packing format used by all "
267355"currently stored values."
268- msgstr ""
356+ msgstr "唯讀屬性,包含所有目前有儲存的值所使用的 :mod:`struct` 打包格式。 "
269357
270358#: ../../library/multiprocessing.shared_memory.rst:324
271359msgid "The :class:`SharedMemory` instance where the values are stored."
272- msgstr ""
360+ msgstr "儲存值的 :class:`SharedMemory` 實例。 "
273361
274362#: ../../library/multiprocessing.shared_memory.rst:327
275363msgid ""
276364"The following example demonstrates basic use of a :class:`ShareableList` "
277365"instance:"
278- msgstr ""
366+ msgstr "以下範例示範了 :class:`ShareableList` 實例的基本用法: "
279367
280368#: ../../library/multiprocessing.shared_memory.rst:360
369+ #, fuzzy
281370msgid ""
282371"The following example depicts how one, two, or many processes may access the "
283372"same :class:`ShareableList` by supplying the name of the shared memory block "
284373"behind it:"
285374msgstr ""
375+ "以下範例描述了一個、兩個或多個行程如何透過提供其後面的共享記憶體區塊的名稱來"
376+ "存取同一個 :class:`ShareableList`:"
286377
287378#: ../../library/multiprocessing.shared_memory.rst:375
288379msgid ""
@@ -292,6 +383,10 @@ msgid ""
292383"deserialized object has the same unique name and is just attached to an "
293384"existing object with the same name (if the object is still alive):"
294385msgstr ""
386+ "以下範例示範了如果需要,可以對 ``ShareableList``\\ (和底層 "
387+ "``SharedMemory``\\ )物件進行 pickle 和 unpickle。請注意,它仍然是相同的共享"
388+ "物件。發生這種情況是因為反序列化的物件具有相同的唯一名稱,並且只是附加到具有"
389+ "相同名稱的現有物件(如果該物件仍然存在):"
295390
296391#: ../../library/multiprocessing.shared_memory.rst:11
297392msgid "Shared Memory"