# Arabic translation of manpages # This file is distributed under the same license as the manpages-l10n package. # Copyright © of this file: # زايد السعيدي , 2026. msgid "" msgstr "" "Project-Id-Version: manpages-l10n 4.30.2\n" "POT-Creation-Date: 2026-06-05 06:25+0200\n" "PO-Revision-Date: 2026-06-06 00:00+0400\n" "Last-Translator: Zayed Al-Saidi \n" "Language-Team: Arabic \n" "Language: ar\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 &&" " n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n" "X-Generator: Lokalize 23.08.5\n" #. type: TH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "futex" msgstr "futex" #. type: TH #: archlinux debian-unstable opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "2026-02-14" msgstr "14 فبراير 2026" #. type: TH #: archlinux debian-unstable #, no-wrap msgid "Linux man-pages 6.18" msgstr "صفحات دليل لينكس 6.18" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "NAME" msgstr "الاسم" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "futex - fast user-space locking" msgstr "futex - قفل سريع في مساحة المستخدم" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "LIBRARY" msgstr "المكتبة" #. type: Plain text #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron #: opensuse-leap-16-1 opensuse-tumbleweed msgid "Standard C library (I,\\ I<-lc>)" msgstr "مكتبة سي المعيارية (I،\\ I<-lc>)" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "SYNOPSIS" msgstr "موجز" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "" "B<#include Elinux/futex.hE> /* Definition of B constants" " */\n" "B<#include Esys/syscall.hE> /* Definition of B constants */\n" "B<#include Eunistd.hE>\n" msgstr "" "B<#include Elinux/futex.hE> /* تعريف ثوابت B */\n" "B<#include Esys/syscall.hE> /* تعريف ثوابت B */\n" "B<#include Eunistd.hE>\n" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "BIB<, int >IB<, ...);>\n" msgstr "" "BIB<, int >IB<, ...);>\n" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "DESCRIPTION" msgstr "الوصف" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The B() system call provides a method for waiting until a certain " "condition becomes true. It is typically used as a blocking construct in the " "context of shared-memory synchronization. When using futexes, the majority " "of the synchronization operations are performed in user space. A user-space " "program employs the B() system call only when it is likely that the " "program has to block for a longer time until the condition becomes true. " "Other B() operations can be used to wake any processes or threads " "waiting for a particular condition." msgstr "" "يوفر استدعاء النظام B() وسيلة للانتظار حتى يتحقق شرط معين. يُستخدم " "عادةً كبنية حابسة في سياق مزامنة الذاكرة المشتركة. عند استخدام الـ futexes، " "تُنفذ أغلبية عمليات المزامنة في مساحة المستخدم. يوظف برنامج مساحة المستخدم " "استدعاء النظام B() فقط عندما يُرجح أن البرنامج سيُحبس لفترة طويلة حتى " "يتحقق الشرط. يمكن استخدام عمليات B() الأخرى لإيقاظ أي عمليات أو خيوط " "تنتظر شرطًا محددًا." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "A futex is a 32-bit value\\[em]referred to below as a I\\[em]whose address is supplied to the B() system call. " "(Futexes are 32 bits in size on all platforms, including 64-bit systems.) " "All futex operations are governed by this value. In order to share a futex " "between processes, the futex is placed in a region of shared memory, created " "using (for example) B(2) or B(2). (Thus, the futex word may " "have different virtual addresses in different processes, but these addresses " "all refer to the same location in physical memory.) In a multithreaded " "program, it is sufficient to place the futex word in a global variable " "shared by all threads." msgstr "" "الـ futex هو قيمة بحجم 32 بتًا —يُشار إليها أدناه باسم I<كلمة futex>— يُزود " "استدعاء النظام B() بعنوانها. (يبلغ حجم الـ futexes حوالي 32 بتًا في " "جميع المنصات، بما في ذلك الأنظمة بمعمارية 64 بتًا). تُحكم جميع عمليات الـ " "futex بهذه القيمة. ولمشاركة futex بين العمليات، يُوضع في منطقة من الذاكرة " "المشتركة، تُنشأ باستخدام (على سبيل المثال) B(2) أو B(2). (وبذلك، " "قد تملك كلمة الـ futex عناوين افتراضية مختلفة في عمليات مختلفة، ولكن هذه " "العناوين تشير جميعها إلى الموقع نفسه في الذاكرة الفيزيائية). في البرامج " "متعددة الخيوط، يكفي وضع كلمة الـ futex في متغير عام مشترك بين جميع الخيوط." # #. #-#-#-#-# archlinux: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. Notes from Darren Hart (Dec 2015): #. Totally ordered with respect futex operations refers to semantics #. of the ACQUIRE/RELEASE operations and how they impact ordering of #. memory reads and writes. The kernel futex operations are protected #. by spinlocks, which ensure that all operations are serialized #. with respect to one another. #. This is a lot to attempt to define in this document. Perhaps a #. reference to linux/Documentation/memory-barriers.txt as a footnote #. would be sufficient? Or perhaps for this manual, "serialized" would #. be sufficient, with a footnote regarding "totally ordered" and a #. pointer to the memory-barrier documentation? #. FIXME(Torvald Riegel): #. Eventually we want to have some text in NOTES to satisfy #. the reference in the following sentence #. See NOTES for a detailed specification of #. the synchronization semantics. #. type: Plain text #. #-#-#-#-# debian-trixie: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. Notes from Darren Hart (Dec 2015): #. Totally ordered with respect futex operations refers to semantics #. of the ACQUIRE/RELEASE operations and how they impact ordering of #. memory reads and writes. The kernel futex operations are protected #. by spinlocks, which ensure that all operations are serialized #. with respect to one another. #. This is a lot to attempt to define in this document. Perhaps a #. reference to linux/Documentation/memory-barriers.txt as a footnote #. would be sufficient? Or perhaps for this manual, "serialized" would #. be sufficient, with a footnote regarding "totally ordered" and a #. pointer to the memory-barrier documentation? #. FIXME(Torvald Riegel): #. Eventually we want to have some text in NOTES to satisfy #. the reference in the following sentence #. See NOTES for a detailed specification of #. the synchronization semantics. #. type: Plain text #. #-#-#-#-# debian-unstable: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. Notes from Darren Hart (Dec 2015): #. Totally ordered with respect futex operations refers to semantics #. of the ACQUIRE/RELEASE operations and how they impact ordering of #. memory reads and writes. The kernel futex operations are protected #. by spinlocks, which ensure that all operations are serialized #. with respect to one another. #. This is a lot to attempt to define in this document. Perhaps a #. reference to linux/Documentation/memory-barriers.txt as a footnote #. would be sufficient? Or perhaps for this manual, "serialized" would #. be sufficient, with a footnote regarding "totally ordered" and a #. pointer to the memory-barrier documentation? #. FIXME(Torvald Riegel): #. Eventually we want to have some text in NOTES to satisfy #. the reference in the following sentence #. See NOTES for a detailed specification of #. the synchronization semantics. #. type: Plain text #. #-#-#-#-# fedora-44: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. Notes from Darren Hart (Dec 2015): #. Totally ordered with respect futex operations refers to semantics #. of the ACQUIRE/RELEASE operations and how they impact ordering of #. memory reads and writes. The kernel futex operations are protected #. by spinlocks, which ensure that all operations are serialized #. with respect to one another. #. This is a lot to attempt to define in this document. Perhaps a #. reference to linux/Documentation/memory-barriers.txt as a footnote #. would be sufficient? Or perhaps for this manual, "serialized" would #. be sufficient, with a footnote regarding "totally ordered" and a #. pointer to the memory-barrier documentation? #. FIXME(Torvald Riegel): #. Eventually we want to have some text in NOTES to satisfy #. the reference in the following sentence #. See NOTES for a detailed specification of #. the synchronization semantics. #. type: Plain text #. #-#-#-#-# fedora-rawhide: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. Notes from Darren Hart (Dec 2015): #. Totally ordered with respect futex operations refers to semantics #. of the ACQUIRE/RELEASE operations and how they impact ordering of #. memory reads and writes. The kernel futex operations are protected #. by spinlocks, which ensure that all operations are serialized #. with respect to one another. #. This is a lot to attempt to define in this document. Perhaps a #. reference to linux/Documentation/memory-barriers.txt as a footnote #. would be sufficient? Or perhaps for this manual, "serialized" would #. be sufficient, with a footnote regarding "totally ordered" and a #. pointer to the memory-barrier documentation? #. FIXME(Torvald Riegel): #. Eventually we want to have some text in NOTES to satisfy #. the reference in the following sentence #. See NOTES for a detailed specification of #. the synchronization semantics. #. type: Plain text #. #-#-#-#-# mageia-cauldron: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. Notes from Darren Hart (Dec 2015): #. Totally ordered with respect futex operations refers to semantics #. of the ACQUIRE/RELEASE operations and how they impact ordering of #. memory reads and writes. The kernel futex operations are protected #. by spinlocks, which ensure that all operations are serialized #. with respect to one another. #. This is a lot to attempt to define in this document. Perhaps a #. reference to linux/Documentation/memory-barriers.txt as a footnote #. would be sufficient? Or perhaps for this manual, "serialized" would #. be sufficient, with a footnote regarding "totally ordered" and a #. pointer to the memory-barrier documentation? #. FIXME(Torvald Riegel): #. Eventually we want to have some text in NOTES to satisfy #. the reference in the following sentence #. See NOTES for a detailed specification of #. the synchronization semantics. #. type: Plain text #. #-#-#-#-# opensuse-leap-16-1: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. Notes from Darren Hart (Dec 2015): #. Totally ordered with respect futex operations refers to semantics #. of the ACQUIRE/RELEASE operations and how they impact ordering of #. memory reads and writes. The kernel futex operations are protected #. by spinlocks, which ensure that all operations are serialized #. with respect to one another. #. This is a lot to attempt to define in this document. Perhaps a #. reference to linux/Documentation/memory-barriers.txt as a footnote #. would be sufficient? Or perhaps for this manual, "serialized" would #. be sufficient, with a footnote regarding "totally ordered" and a #. pointer to the memory-barrier documentation? #. FIXME(Torvald Riegel): #. Eventually we want to have some text in NOTES to satisfy #. the reference in the following sentence #. See NOTES for a detailed specification of #. the synchronization semantics. #. type: Plain text #. #-#-#-#-# opensuse-tumbleweed: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. Notes from Darren Hart (Dec 2015): #. Totally ordered with respect futex operations refers to semantics #. of the ACQUIRE/RELEASE operations and how they impact ordering of #. memory reads and writes. The kernel futex operations are protected #. by spinlocks, which ensure that all operations are serialized #. with respect to one another. #. This is a lot to attempt to define in this document. Perhaps a #. reference to linux/Documentation/memory-barriers.txt as a footnote #. would be sufficient? Or perhaps for this manual, "serialized" would #. be sufficient, with a footnote regarding "totally ordered" and a #. pointer to the memory-barrier documentation? #. FIXME(Torvald Riegel): #. Eventually we want to have some text in NOTES to satisfy #. the reference in the following sentence #. See NOTES for a detailed specification of #. the synchronization semantics. #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "When executing a futex operation that requests to block a thread, the kernel " "will block only if the futex word has the value that the calling thread " "supplied (as one of the arguments of the B() call) as the expected " "value of the futex word. The loading of the futex word's value, the " "comparison of that value with the expected value, and the actual blocking " "will happen atomically and will be totally ordered with respect to " "concurrent operations performed by other threads on the same futex word. " "Thus, the futex word is used to connect the synchronization in user space " "with the implementation of blocking by the kernel. Analogously to an atomic " "compare-and-exchange operation that potentially changes shared memory, " "blocking via a futex is an atomic compare-and-block operation." msgstr "" "عند تنفيذ عملية futex تطلب حبس خيط، ستحبسه النواة فقط إذا كانت كلمة futex " "تملك القيمة التي قدمها I<المستدعِي> (كأحد معطيات استدعاء B()) بصفتها " "القيمة المتوقعة لكلمة futex. عملية تحميل قيمة كلمة futex، ومقارنة تلك القيمة " "مع القيمة المتوقعة، والحبس الفعلي ستحدث بشكل ذري وستكون مرتبة كليًا بالنسبة " "للعمليات المتزامنة التي تجريها الخيوط الأخرى على كلمة futex نفسها. وبذلك، " "تُستخدم كلمة futex لربط المزامنة في مساحة المستخدم بتنفيذ الحبس من قبل " "النواة. وعلى غرار عملية المقارنة والتبديل (compare-and-exchange) الذرية التي " "قد تغير الذاكرة المشتركة، فإن الحبس عبر futex هو عملية مقارنة وحبس ذرية." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "One use of futexes is for implementing locks. The state of the lock (i.e., " "acquired or not acquired) can be represented as an atomically accessed flag " "in shared memory. In the uncontended case, a thread can access or modify " "the lock state with atomic instructions, for example atomically changing it " "from not acquired to acquired using an atomic compare-and-exchange " "instruction. (Such instructions are performed entirely in user mode, and " "the kernel maintains no information about the lock state.) On the other " "hand, a thread may be unable to acquire a lock because it is already " "acquired by another thread. It then may pass the lock's flag as a futex " "word and the value representing the acquired state as the expected value to " "a B() wait operation. This B() operation will block if and " "only if the lock is still acquired (i.e., the value in the futex word still " "matches the \"acquired state\"). When releasing the lock, a thread has to " "first reset the lock state to not acquired and then execute a futex " "operation that wakes threads blocked on the lock flag used as a futex word " "(this can be further optimized to avoid unnecessary wake-ups). See " "B(7) for more detail on how to use futexes." msgstr "" "أحد استخدامات الـ futexes هو تنفيذ الأقفال. حالة القفل (أي: مستحوذ عليه أو " "غير مستحوذ عليه) يمكن تمثيلها كراية يُوصَل إليها ذريًا في الذاكرة المشتركة." " في " "حالة عدم التنازع، يمكن للخيط الوصول إلى حالة القفل أو تعديلها باستخدام " "تعليمات ذرية، على سبيل المثال تغييره ذريًا من غير مستحوذ عليه إلى مستحوذ عليه " "باستخدام تعليمات مقارنة وتبديل ذرية. (تُنفذ مثل هذه التعليمات بالكامل في وضع " "المستخدم، ولا تحتفظ النواة بأي معلومات عن حالة القفل). ومن ناحية أخرى، قد " "يتعذر على خيط الاستحواذ على قفل لأنه مستحوذ عليه بالفعل من قبل خيط آخر. " "يمكنه حينئذٍ تمرير راية القفل ككلمة futex والقيمة التي تمثل حالة الاستحواذ " "كقيمة متوقعة لعملية انتظار B(). ستقوم عملية B() هذه بالحبس إذا " "وفقط إذا كان القفل لا يزال مستحوذًا عليه (أي أن القيمة في كلمة futex لا تزال " "تطابق \"حالة الاستحواذ\"). عند تحرير القفل، يجب على الخيط أولاً إعادة ضبط " "حالة القفل إلى غير مستحوذ عليه ثم تنفيذ عملية futex توقظ الخيوط المحبوسة على " "راية القفل المستخدمة ككلمة futex (يمكن تحسين ذلك لاحقًا لتجنب عمليات الإيقاظ " "غير الضرورية). انظر B(7) لمزيد من التفاصيل حول كيفية استخدام الـ " "futexes." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Besides the basic wait and wake-up futex functionality, there are further " "futex operations aimed at supporting more complex use cases." msgstr "" "إلى جانب وظائف الانتظار والإيقاظ الأساسية في futex، هناك عمليات futex إضافية " "تهدف إلى دعم حالات استخدام أكثر تعقيدًا." #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "Note that no explicit initialization or destruction is necessary to use " "futexes; the kernel maintains a futex (i.e., the kernel-internal " "implementation artifact) only while operations such as " "B(2const) are being performed on a particular futex word." msgstr "" "لاحظ أنه لا يلزم تهيئة أو تدمير صريح لاستخدام الـ futexes؛ تحتفظ النواة بالـ " "futex (أي أثر التنفيذ الداخلي للنواة) فقط أثناء تنفيذ عمليات مثل " "B(2const) على كلمة futex معينة." #. type: SS #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Arguments" msgstr "المعطيات" # #. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "The I argument points to the futex word. On all platforms, futexes " "are four-byte integers that must be aligned on a four-byte boundary. The " "operation to perform on the futex is specified in the I argument." msgstr "" "يشير المعطى I إلى كلمة futex. في جميع المنصات، تكون الـ futexes " "أعدادًا صحيحة بحجم أربعة بايتات ويجب أن تكون محاذية على حدود أربعة بايتات. " "تُحدد العملية المراد تنفيذها على الـ futex في المعطى I." #. type: SS #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Futex operations" msgstr "عمليات Futex" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "The I argument consists of two parts: a command that specifies the " "operation to be performed, bitwise ORed with zero or more options that " "modify the behavior of the operation. The options that may be included in " "I are as follows:" msgstr "" "يتكون المعطى I من جزأين: أمر يحدد العملية المراد تنفيذها، مدمجًا عبر " "عملية OR بتية مع خيار واحد أو أكثر يعدل سلوك العملية. الخيارات التي قد تُضمن " "في I هي كما يلي:" #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B (since Linux 2.6.22)" msgstr "B (منذ لينكس 2.6.22)" #. commit 34f01cc1f512fa783302982776895c73714ebbc2 #. I.e., It allows the kernel choose the fast path for validating #. the user-space address and avoids expensive VMA lookups, #. taking reference counts on file backing store, and so on. #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "This option bit can be employed with all futex operations. It tells the " "kernel that the futex is process-private and not shared with another process " "(i.e., it is being used for synchronization only between threads of the same " "process). This allows the kernel to make some additional performance " "optimizations." msgstr "" "يمكن استخدام بت الخيار هذا مع جميع عمليات futex. يخبر النواة أن الـ futex " "خاص بالعملية وليس مشتركًا مع عملية أخرى (أي يُستخدم للمزامنة فقط بين خيوط " "العملية نفسها). يسمح هذا للنواة بإجراء بعض تحسينات الأداء الإضافية." #. #-#-#-#-# archlinux: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. except the obsolete FUTEX_FD(2const), for which the "private" flag was #. meaningless #. type: Plain text #. #-#-#-#-# debian-trixie: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. except the obsolete FUTEX_FD, for which the "private" flag was #. meaningless #. type: Plain text #. #-#-#-#-# debian-unstable: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. except the obsolete FUTEX_FD(2const), for which the "private" flag was #. meaningless #. type: Plain text #. #-#-#-#-# fedora-44: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. except the obsolete FUTEX_FD, for which the "private" flag was #. meaningless #. type: Plain text #. #-#-#-#-# fedora-rawhide: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. except the obsolete FUTEX_FD, for which the "private" flag was #. meaningless #. type: Plain text #. #-#-#-#-# mageia-cauldron: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. except the obsolete FUTEX_FD(2const), for which the "private" flag was #. meaningless #. type: Plain text #. #-#-#-#-# opensuse-leap-16-1: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. except the obsolete FUTEX_FD(2const), for which the "private" flag was #. meaningless #. type: Plain text #. #-#-#-#-# opensuse-tumbleweed: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. except the obsolete FUTEX_FD(2const), for which the "private" flag was #. meaningless #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "As a convenience, Ilinux/futex.hE> defines a set of constants with " "the suffix B<_PRIVATE> that are equivalents of all of the operations listed " "below, but with the B ORed into the constant value. " "Thus, there are B, B, and so on." msgstr "" "من باب التسهيل، يعرّف Ilinux/futex.hE> مجموعة من الثوابت باللاحقة " "B<_PRIVATE> التي تكافئ جميع العمليات المدرجة أدناه، ولكن مع دمج " "B في قيمة الثابت عبر عملية OR. وبذلك، توجد " "B وB، وهكذا." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B (since Linux 2.6.28)" msgstr "B (منذ لينكس 2.6.28)" #. commit 1acdac104668a0834cfa267de9946fac7764d486 #. commit 337f13046ff03717a9e99675284a817527440a49 #. commit bf22a6976897977b0a3f1aeba6823c959fc4fdae #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "This option bit can be employed only with the B(2const), " "B(2const), (since Linux 4.5) B(2const), " "and (since Linux 5.14) B(2const) operations." msgstr "" "يمكن استخدام بت الخيار هذا فقط مع عمليات B(2const)، " "وB(2const)، و(منذ لينكس 4.5) B(2const)، " "و(منذ لينكس 5.14) B(2const)." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "If this option is set, the kernel measures the I against the " "B clock." msgstr "" "إذا ضُبط هذا الخيار، تقيس النواة مهلة الانتظار I مقابل ساعة الوقت " "الحقيقي B." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "If this option is not set, the kernel measures the I against the " "B clock." msgstr "" "إذا لم يُضبط هذا الخيار، تقيس النواة مهلة الانتظار I مقابل ساعة " "الوقت الرتيب B." # #. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "The operation specified in I is one of the following:" msgstr "العملية المحددة في I هي واحدة مما يلي:" #. type: TP #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "B(2const)" msgstr "B(2const)" #. type: TQ #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "B(2const)" msgstr "B(2const)" #. type: TQ #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "B(2const)" msgstr "B(2const)" #. type: TQ #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "B(2const)" msgstr "B(2const)" #. type: TQ #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "B(2const)" msgstr "B(2const)" #. type: TQ #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "B(2const)" msgstr "B(2const)" #. type: TQ #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "B(2const)" msgstr "B(2const)" #. type: TQ #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "B(2const)" msgstr "B(2const)" #. type: SS #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Priority-inheritance futexes" msgstr "Futexes توريث الأولويات" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Linux supports priority-inheritance (PI) futexes in order to handle priority-" "inversion problems that can be encountered with normal futex locks. " "Priority inversion is the problem that occurs when a high-priority task is " "blocked waiting to acquire a lock held by a low-priority task, while tasks " "at an intermediate priority continuously preempt the low-priority task from " "the CPU. Consequently, the low-priority task makes no progress toward " "releasing the lock, and the high-priority task remains blocked." msgstr "" "يدعم لينكس futexes توريث الأولويات (PI) للتعامل مع مشكلات انعكاس الأولويات " "التي قد تواجه أقفال futex العادية. انعكاس الأولويات هو المشكلة التي تحدث " "عندما تُحبس مهمة عالية الأولوية بانتظار الاستحواذ على قفل تملكه مهمة منخفضة " "الأولوية، بينما تقوم مهام ذات أولوية متوسطة باستمرار بإزاحة المهمة منخفضة " "الأولوية من المعالج. ونتيجة لذلك، لا تحرز المهمة منخفضة الأولوية أي تقدم نحو " "تحرير القفل، وتظل المهمة عالية الأولوية محبوسة." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Priority inheritance is a mechanism for dealing with the priority-inversion " "problem. With this mechanism, when a high-priority task becomes blocked by " "a lock held by a low-priority task, the priority of the low-priority task is " "temporarily raised to that of the high-priority task, so that it is not " "preempted by any intermediate level tasks, and can thus make progress toward " "releasing the lock. To be effective, priority inheritance must be " "transitive, meaning that if a high-priority task blocks on a lock held by a " "lower-priority task that is itself blocked by a lock held by another " "intermediate-priority task (and so on, for chains of arbitrary length), then " "both of those tasks (or more generally, all of the tasks in a lock chain) " "have their priorities raised to be the same as the high-priority task." msgstr "" "توريث الأولويات هو آلية للتعامل مع مشكلة انعكاس الأولويات. بموجب هذه الآلية، " "عندما تُحبس مهمة عالية الأولوية بسبب قفل تملكه مهمة منخفضة الأولوية، تُرفع " "أولوية المهمة منخفضة الأولوية مؤقتًا إلى مستوى أولوية المهمة عالية الأولوية، " "بحيث لا تزيحها أي مهام ذات مستوى متوسط، وبذلك يمكنها إحراز تقدم نحو تحرير " "القفل. ليكون توريث الأولويات فعالاً، يجب أن يكون متعديًا، مما يعني أنه إذا " "حُبست مهمة عالية الأولوية بسبب قفل تملكه مهمة منخفضة الأولوية والمحبوسة هي " "نفسها بسبب قفل تملكه مهمة أخرى متوسطة الأولوية (وهكذا، لسلاسل بأي طول)، فإن " "كلتا المهمتين (أو بشكل أعم، جميع المهام في سلسلة القفل) تُرفع أولوياتها لتصبح " "مماثلة للمهمة عالية الأولوية." # #. #-#-#-#-# archlinux: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. Quoting Darren Hart: #. These opcodes paired with the PI futex value policy (described below) #. defines a "futex" as PI aware. These were created very specifically #. in support of PI pthread_mutexes, so it makes a lot more sense to #. talk about a PI aware pthread_mutex, than a PI aware futex, since #. there is a lot of policy and scaffolding that has to be built up #. around it to use it properly (this is what a PI pthread_mutex is). #. type: Plain text #. #-#-#-#-# debian-trixie: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. Quoting Darren Hart: #. These opcodes paired with the PI futex value policy (described below) #. defines a "futex" as PI aware. These were created very specifically #. in support of PI pthread_mutexes, so it makes a lot more sense to #. talk about a PI aware pthread_mutex, than a PI aware futex, since #. there is a lot of policy and scaffolding that has to be built up #. around it to use it properly (this is what a PI pthread_mutex is). #. type: Plain text #. #-#-#-#-# debian-unstable: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. Quoting Darren Hart: #. These opcodes paired with the PI futex value policy (described below) #. defines a "futex" as PI aware. These were created very specifically #. in support of PI pthread_mutexes, so it makes a lot more sense to #. talk about a PI aware pthread_mutex, than a PI aware futex, since #. there is a lot of policy and scaffolding that has to be built up #. around it to use it properly (this is what a PI pthread_mutex is). #. type: Plain text #. #-#-#-#-# fedora-44: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. Quoting Darren Hart: #. These opcodes paired with the PI futex value policy (described below) #. defines a "futex" as PI aware. These were created very specifically #. in support of PI pthread_mutexes, so it makes a lot more sense to #. talk about a PI aware pthread_mutex, than a PI aware futex, since #. there is a lot of policy and scaffolding that has to be built up #. around it to use it properly (this is what a PI pthread_mutex is). #. type: Plain text #. #-#-#-#-# fedora-rawhide: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. Quoting Darren Hart: #. These opcodes paired with the PI futex value policy (described below) #. defines a "futex" as PI aware. These were created very specifically #. in support of PI pthread_mutexes, so it makes a lot more sense to #. talk about a PI aware pthread_mutex, than a PI aware futex, since #. there is a lot of policy and scaffolding that has to be built up #. around it to use it properly (this is what a PI pthread_mutex is). #. type: Plain text #. #-#-#-#-# mageia-cauldron: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. Quoting Darren Hart: #. These opcodes paired with the PI futex value policy (described below) #. defines a "futex" as PI aware. These were created very specifically #. in support of PI pthread_mutexes, so it makes a lot more sense to #. talk about a PI aware pthread_mutex, than a PI aware futex, since #. there is a lot of policy and scaffolding that has to be built up #. around it to use it properly (this is what a PI pthread_mutex is). #. type: Plain text #. #-#-#-#-# opensuse-leap-16-1: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. Quoting Darren Hart: #. These opcodes paired with the PI futex value policy (described below) #. defines a "futex" as PI aware. These were created very specifically #. in support of PI pthread_mutexes, so it makes a lot more sense to #. talk about a PI aware pthread_mutex, than a PI aware futex, since #. there is a lot of policy and scaffolding that has to be built up #. around it to use it properly (this is what a PI pthread_mutex is). #. type: Plain text #. #-#-#-#-# opensuse-tumbleweed: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. Quoting Darren Hart: #. These opcodes paired with the PI futex value policy (described below) #. defines a "futex" as PI aware. These were created very specifically #. in support of PI pthread_mutexes, so it makes a lot more sense to #. talk about a PI aware pthread_mutex, than a PI aware futex, since #. there is a lot of policy and scaffolding that has to be built up #. around it to use it properly (this is what a PI pthread_mutex is). #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "From a user-space perspective, what makes a futex PI-aware is a policy " "agreement (described below) between user space and the kernel about the " "value of the futex word, coupled with the use of the PI-futex operations " "described below. (Unlike the other futex operations described above, the PI-" "futex operations are designed for the implementation of very specific IPC " "mechanisms.)" msgstr "" "من منظور مساحة المستخدم، ما يجعل الـ futex مدركًا لتوريث الأولويات (PI-aware) " "هو اتفاق سياسة (موصوف أدناه) بين مساحة المستخدم والنواة حول قيمة كلمة futex، " "مقترنًا باستخدام عمليات PI-futex الموضحة أدناه. (على عكس عمليات futex الأخرى " "الموضحة أعلاه، صُممت عمليات PI-futex لتنفيذ آليات اتصال بين العمليات (IPC) " "محددة للغاية)." #. mtk: The following text is drawn from the Hart/Guniguntala paper #. (listed in SEE ALSO), but I have reworded some pieces #. significantly. #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The PI-futex operations described below differ from the other futex " "operations in that they impose policy on the use of the value of the futex " "word:" msgstr "" "تختلف عمليات PI-futex الموضحة أدناه عن عمليات futex الأخرى في أنها تفرض " "سياسة على استخدام قيمة كلمة futex:" #. type: IP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "\\[bu]" msgstr "\\[bu]" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "If the lock is not acquired, the futex word's value shall be 0." msgstr "إذا لم يُستحوذ على القفل، يجب أن تكون قيمة كلمة futex هي 0." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "If the lock is acquired, the futex word's value shall be the thread ID (TID; " "see B(2)) of the owning thread." msgstr "" "إذا استُحوذ على القفل، يجب أن تكون قيمة كلمة futex هي معرف الخيط (TID؛ انظر " "B(2)) للخيط المالك." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "If the lock is owned and there are threads contending for the lock, then the " "B bit shall be set in the futex word's value; in other words, " "this value is:" msgstr "" "إذا كان القفل مملوكًا وهناك خيوط تتنازع عليه، يجب ضبط بت B في " "قيمة كلمة futex؛ بعبارة أخرى، هذه القيمة هي:" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "FUTEX_WAITERS | TID\n" msgstr "FUTEX_WAITERS | TID\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "(Note that is invalid for a PI futex word to have no owner and " "B set.)" msgstr "" "(لاحظ أنه من غير الصالح أن تكون كلمة PI futex بلا مالك مع ضبط " "B)." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "With this policy in place, a user-space application can acquire an " "unacquired lock or release a lock using atomic instructions executed in user " "mode (e.g., a compare-and-swap operation such as I on the x86 " "architecture). Acquiring a lock simply consists of using compare-and-swap " "to atomically set the futex word's value to the caller's TID if its previous " "value was 0. Releasing a lock requires using compare-and-swap to set the " "futex word's value to 0 if the previous value was the expected TID." msgstr "" "مع تطبيق هذه السياسة، يمكن لتطبيق مساحة المستخدم الاستحواذ على قفل غير " "مستحوذ عليه أو تحرير قفل باستخدام تعليمات ذرية تُنفذ في وضع المستخدم (على " "سبيل المثال، عملية مقارنة وتبديل مثل I في معمارية x86). يتكون " "الاستحواذ على قفل ببساطة من استخدام المقارنة والتبديل لضبط قيمة كلمة futex " "ذريًا إلى معرف خيط (TID) المستدعي إذا كانت قيمتها السابقة 0. يتطلب تحرير " "القفل استخدام المقارنة والتبديل لضبط قيمة كلمة futex إلى 0 إذا كانت القيمة " "السابقة هي TID المتوقع." #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "If a futex is already acquired (i.e., has a nonzero value), waiters must " "employ the B(2const) or B(2const) " "operations to acquire the lock. If other threads are waiting for the lock, " "then the B bit is set in the futex value; in this case, the " "lock owner must employ the B(2const) operation to release " "the lock." msgstr "" "إذا كان الـ futex مستحوذًا عليه بالفعل (أي يملك قيمة غير صفرية)، يجب على " "المنتظرين توظيف عمليات B(2const) أو B(2const) " "للاستحواذ على القفل. إذا كانت هناك خيوط أخرى تنتظر القفل، يُضبط بت " "B في قيمة الـ futex؛ في هذه الحالة، يجب على مالك القفل توظيف " "عملية B(2const) لتحرير القفل." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "In the cases where callers are forced into the kernel (i.e., required to " "perform a B() call), they then deal directly with a so-called RT-" "mutex, a kernel locking mechanism which implements the required priority-" "inheritance semantics. After the RT-mutex is acquired, the futex value is " "updated accordingly, before the calling thread returns to user space." msgstr "" "في الحالات التي يُجبر فيها المستدعون على الدخول إلى النواة (أي يُطلب منهم " "إجراء استدعاء B())، فإنهم يتعاملون مباشرة مع ما يسمى RT-mutex، وهي " "آلية إقفال في النواة تنفذ دلالات توريث الأولويات المطلوبة. بعد الاستحواذ على " "RT-mutex، تُحدث قيمة الـ futex وفقًا لذلك، قبل أن يعود الخيط المستدعي إلى " "مساحة المستخدم." #. #-#-#-#-# archlinux: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. tglx (July 2015): #. If there are multiple waiters on a pi futex then a wake pi operation #. will wake the first waiter and hand over the lock to this waiter. This #. includes handing over the rtmutex which represents the futex in the #. kernel. The strict requirement is that the futex owner and the rtmutex #. owner must be the same, except for the update period which is #. serialized by the futex internal locking. That means the kernel must #. update the user-space value prior to returning to user space #. type: Plain text #. #-#-#-#-# debian-trixie: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. tglx (July 2015): #. If there are multiple waiters on a pi futex then a wake pi operation #. will wake the first waiter and hand over the lock to this waiter. This #. includes handing over the rtmutex which represents the futex in the #. kernel. The strict requirement is that the futex owner and the rtmutex #. owner must be the same, except for the update period which is #. serialized by the futex internal locking. That means the kernel must #. update the user-space value prior to returning to user space #. type: Plain text #. #-#-#-#-# debian-unstable: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. tglx (July 2015): #. If there are multiple waiters on a pi futex then a wake pi operation #. will wake the first waiter and hand over the lock to this waiter. This #. includes handing over the rtmutex which represents the futex in the #. kernel. The strict requirement is that the futex owner and the rtmutex #. owner must be the same, except for the update period which is #. serialized by the futex internal locking. That means the kernel must #. update the user-space value prior to returning to user space #. type: Plain text #. #-#-#-#-# fedora-44: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. tglx (July 2015): #. If there are multiple waiters on a pi futex then a wake pi operation #. will wake the first waiter and hand over the lock to this waiter. This #. includes handing over the rtmutex which represents the futex in the #. kernel. The strict requirement is that the futex owner and the rtmutex #. owner must be the same, except for the update period which is #. serialized by the futex internal locking. That means the kernel must #. update the user-space value prior to returning to user space #. type: Plain text #. #-#-#-#-# fedora-rawhide: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. tglx (July 2015): #. If there are multiple waiters on a pi futex then a wake pi operation #. will wake the first waiter and hand over the lock to this waiter. This #. includes handing over the rtmutex which represents the futex in the #. kernel. The strict requirement is that the futex owner and the rtmutex #. owner must be the same, except for the update period which is #. serialized by the futex internal locking. That means the kernel must #. update the user-space value prior to returning to user space #. type: Plain text #. #-#-#-#-# mageia-cauldron: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. tglx (July 2015): #. If there are multiple waiters on a pi futex then a wake pi operation #. will wake the first waiter and hand over the lock to this waiter. This #. includes handing over the rtmutex which represents the futex in the #. kernel. The strict requirement is that the futex owner and the rtmutex #. owner must be the same, except for the update period which is #. serialized by the futex internal locking. That means the kernel must #. update the user-space value prior to returning to user space #. type: Plain text #. #-#-#-#-# opensuse-leap-16-1: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. tglx (July 2015): #. If there are multiple waiters on a pi futex then a wake pi operation #. will wake the first waiter and hand over the lock to this waiter. This #. includes handing over the rtmutex which represents the futex in the #. kernel. The strict requirement is that the futex owner and the rtmutex #. owner must be the same, except for the update period which is #. serialized by the futex internal locking. That means the kernel must #. update the user-space value prior to returning to user space #. type: Plain text #. #-#-#-#-# opensuse-tumbleweed: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. tglx (July 2015): #. If there are multiple waiters on a pi futex then a wake pi operation #. will wake the first waiter and hand over the lock to this waiter. This #. includes handing over the rtmutex which represents the futex in the #. kernel. The strict requirement is that the futex owner and the rtmutex #. owner must be the same, except for the update period which is #. serialized by the futex internal locking. That means the kernel must #. update the user-space value prior to returning to user space #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "It is important to note that the kernel will update the futex word's value " "prior to returning to user space. (This prevents the possibility of the " "futex word's value ending up in an invalid state, such as having an owner " "but the value being 0, or having waiters but not having the B " "bit set.)" msgstr "" "من المهم ملاحظة أن النواة ستحدث قيمة كلمة futex قبل العودة إلى مساحة " "المستخدم. (يمنع هذا احتمال انتهاء قيمة كلمة futex في حالة غير صالحة، مثل " "وجود مالك بينما القيمة هي 0، أو وجود منتظرين دون ضبط بت B)." #. #-#-#-#-# archlinux: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. tglx (July 2015): #. The FUTEX_OWNER_DIED bit can also be set on uncontended futexes, where #. the kernel has no state associated. This happens via the robust futex #. mechanism. In that case the futex value will be set to #. FUTEX_OWNER_DIED. The robust futex mechanism is also available for non #. PI futexes. #. type: Plain text #. #-#-#-#-# debian-trixie: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. tglx (July 2015): #. The FUTEX_OWNER_DIED bit can also be set on uncontended futexes, where #. the kernel has no state associated. This happens via the robust futex #. mechanism. In that case the futex value will be set to #. FUTEX_OWNER_DIED. The robust futex mechanism is also available for non #. PI futexes. #. type: Plain text #. #-#-#-#-# debian-unstable: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. tglx (July 2015): #. The FUTEX_OWNER_DIED bit can also be set on uncontended futexes, where #. the kernel has no state associated. This happens via the robust futex #. mechanism. In that case the futex value will be set to #. FUTEX_OWNER_DIED. The robust futex mechanism is also available for non #. PI futexes. #. type: Plain text #. #-#-#-#-# fedora-44: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. tglx (July 2015): #. The FUTEX_OWNER_DIED bit can also be set on uncontended futexes, where #. the kernel has no state associated. This happens via the robust futex #. mechanism. In that case the futex value will be set to #. FUTEX_OWNER_DIED. The robust futex mechanism is also available for non #. PI futexes. #. type: Plain text #. #-#-#-#-# fedora-rawhide: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. tglx (July 2015): #. The FUTEX_OWNER_DIED bit can also be set on uncontended futexes, where #. the kernel has no state associated. This happens via the robust futex #. mechanism. In that case the futex value will be set to #. FUTEX_OWNER_DIED. The robust futex mechanism is also available for non #. PI futexes. #. type: Plain text #. #-#-#-#-# mageia-cauldron: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. tglx (July 2015): #. The FUTEX_OWNER_DIED bit can also be set on uncontended futexes, where #. the kernel has no state associated. This happens via the robust futex #. mechanism. In that case the futex value will be set to #. FUTEX_OWNER_DIED. The robust futex mechanism is also available for non #. PI futexes. #. type: Plain text #. #-#-#-#-# opensuse-leap-16-1: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. tglx (July 2015): #. The FUTEX_OWNER_DIED bit can also be set on uncontended futexes, where #. the kernel has no state associated. This happens via the robust futex #. mechanism. In that case the futex value will be set to #. FUTEX_OWNER_DIED. The robust futex mechanism is also available for non #. PI futexes. #. type: Plain text #. #-#-#-#-# opensuse-tumbleweed: futex.2.pot (PACKAGE VERSION) #-#-#-#-# #. tglx (July 2015): #. The FUTEX_OWNER_DIED bit can also be set on uncontended futexes, where #. the kernel has no state associated. This happens via the robust futex #. mechanism. In that case the futex value will be set to #. FUTEX_OWNER_DIED. The robust futex mechanism is also available for non #. PI futexes. #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "If a futex has an associated RT-mutex in the kernel (i.e., there are blocked " "waiters) and the owner of the futex/RT-mutex dies unexpectedly, then the " "kernel cleans up the RT-mutex and hands it over to the next waiter. This in " "turn requires that the user-space value is updated accordingly. To indicate " "that this is required, the kernel sets the B bit in the " "futex word along with the thread ID of the new owner. User space can detect " "this situation via the presence of the B bit and is then " "responsible for cleaning up the stale state left over by the dead owner." msgstr "" "إذا كان لـ futex ما يقابله من RT-mutex في النواة (أي يوجد منتظرون محبوسون) " "ومات مالك الـ futex/RT-mutex بشكل غير متوقع، تقوم النواة بتنظيف الـ RT-mutex " "وتسليمه للمنتظر التالي. وهذا بدوره يتطلب تحديث قيمة مساحة المستخدم وفقًا " "لذلك. وللإشارة إلى أن هذا مطلوب، تضبط النواة بت B في كلمة " "futex مع معرف الخيط للمالك الجديد. يمكن لمساحة المستخدم اكتشاف هذا الموقف " "عبر وجود بت B وهي المسؤولة حينئذٍ عن تنظيف الحالة القديمة " "التي تركها المالك الميت." #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "PI futexes are operated on by specifying one of the values listed below in " "I. Note that the PI futex operations must be used as paired operations " "and are subject to some additional requirements:" msgstr "" "تُجرى العمليات على PI futexes عبر تحديد إحدى القيم المدرجة أدناه في I. " "لاحظ أنه يجب استخدام عمليات PI futex كعمليات مزدوجة وتخضع لبعض المتطلبات " "الإضافية:" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "B(2const), B(2const), and " "B(2const) pair with B(2const). " "B(2const) must be called only on a futex owned by the " "calling thread, as defined by the value policy, otherwise the error B " "results." msgstr "" "تزدوج B(2const) وB(2const) و " "B(2const) مع B(2const). يجب استدعاء " "B(2const) فقط على futex يملكه الخيط المستدعي، كما هو محدد " "في سياسة القيمة، وإلا سينتج الخطأ B." #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "B(2const) pairs with " "B(2const). This must be performed from a non-PI futex " "to a distinct PI futex (or the error B results). Additionally, the " "number of waiters to be woken must be 1 (or the error B results)." msgstr "" "تزدوج B(2const) مع B(2const). " "يجب أن يتم ذلك من futex ليس PI إلى PI futex مختلف (وإلا سينتج الخطأ " "B). بالإضافة إلى ذلك، يجب أن يكون عدد المنتظرين المراد إيقاظهم 1 " "(وإلا سينتج الخطأ B)." # #. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "The PI futex operations are as follows:" msgstr "عمليات PI futex هي كما يلي:" #. type: TP #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "B(2const)" msgstr "B(2const)" #. type: TQ #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "B(2const)" msgstr "B(2const)" #. type: TQ #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "B(2const)" msgstr "B(2const)" #. type: TQ #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "B(2const)" msgstr "B(2const)" #. type: TQ #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "B(2const)" msgstr "B(2const)" #. type: TQ #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "B(2const)" msgstr "B(2const)" # # # # # #. Darren Hart notes that a patch to allow glibc to fully support #. PI-aware pthreads condition variables has not yet been accepted into #. glibc. The story is complex, and can be found at #. https://sourceware.org/bugzilla/show_bug.cgi?id=11588 #. Darren notes that in the meantime, the patch is shipped with various #. PREEMPT_RT-enabled Linux systems. #. Related to the preceding, Darren proposed that somewhere, man-pages #. should document the following point: #. While the Linux kernel, since Linux 2.6.31, supports requeueing of #. priority-inheritance (PI) aware mutexes via the #. FUTEX_WAIT_REQUEUE_PI and FUTEX_CMP_REQUEUE_PI futex operations, #. the glibc implementation does not yet take full advantage of this. #. Specifically, the condvar internal data lock remains a non-PI aware #. mutex, regardless of the type of the pthread_mutex associated with #. the condvar. This can lead to an unbounded priority inversion on #. the internal data lock even when associating a PI aware #. pthread_mutex with a condvar during a pthread_cond*_wait #. operation. For this reason, it is not recommended to rely on #. priority inheritance when using pthread condition variables. #. The problem is that the obvious location for this text is #. the pthread_cond*wait(3) man page. However, such a man page #. does not currently exist. #. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "The B(2const) and B(2const) " "were added to support a fairly specific use case: support for priority-" "inheritance-aware POSIX threads condition variables. The idea is that these " "operations should always be paired, in order to ensure that user space and " "the kernel remain in sync. Thus, in the B(2const) " "operation, the user-space application pre-specifies the target of the " "requeue that takes place in the B(2const) operation." msgstr "" "أُضيفت B(2const) وB(2const) لدعم " "حالة استخدام محددة تمامًا: دعم متغيرات حالة خيوط POSIX المدركة لتوريث " "الأولويات. الفكرة هي أن هذه العمليات يجب أن تزدوج دائمًا لضمان بقاء مساحة " "المستخدم والنواة متزامنتين. وبذلك، في عملية " "B(2const)، يحدد تطبيق مساحة المستخدم مسبقًا هدف إعادة " "الصف (requeue) التي تحدث في عملية B(2const)." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "RETURN VALUE" msgstr "قيمة الإرجاع" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "On error, -1 is returned, and I is set to indicate the error." msgstr "عند الخطأ، تُعاد القيمة -1، ويُضبط I للإشارة إلى الخطأ." # #. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "The return value on success depends on the operation." msgstr "تعتمد قيمة الإرجاع عند النجاح على العملية." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "ERRORS" msgstr "الأخطاء" #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "No read access to the memory of a futex word." msgstr "لا يوجد وصول قراءة إلى ذاكرة كلمة futex." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "I did not point to a valid user-space address." msgstr "لا يشير I إلى عنوان صالح في مساحة المستخدم." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "I does not point to a valid object\\[em]that is, the address is not " "four-byte-aligned." msgstr "" "لا يشير I إلى كائن صالح —أي أن العنوان ليس محاذيًا لأربعة بايتات." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "Invalid argument." msgstr "معطى غير صالح." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "Invalid operation specified in I." msgstr "عملية غير صالحة محددة في I." # #. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "The B option was specified in I, but the " "accompanying operation was neither B(2const), " "B(2const), nor B(2const)." msgstr "" "حُدد الخيار B في I، ولكن العملية المرافقة لم تكن " "B(2const)، ولا B(2const)، ولا " "B(2const)." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "STANDARDS" msgstr "المعايير" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "Linux." msgstr "لينكس." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "HISTORY" msgstr "التاريخ" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "Linux 2.6.0." msgstr "لينكس 2.6.0." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Initial futex support was merged in Linux 2.5.7 but with different semantics " "from what was described above. A four-argument system call with the " "semantics described in this page was introduced in Linux 2.5.40. A fifth " "argument was added in Linux 2.5.70, and a sixth argument was added in Linux " "2.6.7." msgstr "" "دُمج دعم futex الأولي في لينكس 2.5.7 ولكن بدلالات مختلفة عما وُصف أعلاه. قُدم " "استدعاء نظام بأربعة معطيات مع الدلالات الموضحة في هذه الصفحة في لينكس " "2.5.40. أُضيف معطى خامس في لينكس 2.5.70، وأُضيف معطى سادس في لينكس 2.6.7." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "EXAMPLES" msgstr "أمثلة" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The program below demonstrates use of futexes in a program where a parent " "process and a child process use a pair of futexes located inside a shared " "anonymous mapping to synchronize access to a shared resource: the terminal. " "The two processes each write I (a command-line argument that " "defaults to 5 if omitted) messages to the terminal and employ a " "synchronization protocol that ensures that they alternate in writing " "messages. Upon running this program we see output such as the following:" msgstr "" "يوضح البرنامج أدناه استخدام الـ futexes في برنامج حيث تستخدم فيه عملية أب " "وعملية ابن زوجًا من الـ futexes الموجودة داخل تخطيط مجهول مشترك لمزامنة " "الوصول إلى مورد مشترك: الطرفية. تكتب كل واحدة من العمليتين I رسالة " "(معطى في سطر الأوامر قيمته المبدئية 5 إذا حُذف) إلى الطرفية وتوظف بروتوكول " "مزامنة يضمن تبادلهما في كتابة الرسائل. عند تشغيل هذا البرنامج، نرى مخرجات " "مثل ما يلي:" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "" "$B< ./futex_demo>;\n" "Parent (18534) 0\n" "Child (18535) 0\n" "Parent (18534) 1\n" "Child (18535) 1\n" "Parent (18534) 2\n" "Child (18535) 2\n" "Parent (18534) 3\n" "Child (18535) 3\n" "Parent (18534) 4\n" "Child (18535) 4\n" msgstr "" "$B< ./futex_demo>;\n" "Parent (18534) 0\n" "Child (18535) 0\n" "Parent (18534) 1\n" "Child (18535) 1\n" "Parent (18534) 2\n" "Child (18535) 2\n" "Parent (18534) 3\n" "Child (18535) 3\n" "Parent (18534) 4\n" "Child (18535) 4\n" #. type: SS #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Program source" msgstr "مصدر البرنامج" #. type: Plain text #: archlinux debian-unstable opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "" "/* futex_demo.c\n" "\\&\n" " Usage: futex_demo [nloops]\n" " (Default: 5)\n" "\\&\n" " Demonstrate the use of futexes in a program where parent and child\n" " use a pair of futexes located inside a shared anonymous mapping to\n" " synchronize access to a shared resource: the terminal. The two\n" " processes each write \\[aq]num-loops\\[aq] messages to the terminal and" " employ\n" " a synchronization protocol that ensures that they alternate in\n" " writing messages.\n" "*/\n" "#define _GNU_SOURCE\n" "#include Eerr.hE\n" "#include Eerrno.hE\n" "#include Elinux/futex.hE\n" "#include Estdatomic.hE\n" "#include Estdint.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/mman.hE\n" "#include Esys/syscall.hE\n" "#include Esys/time.hE\n" "#include Esys/wait.hE\n" "#include Eunistd.hE\n" "\\&\n" "static uint32_t *futex1, *futex2, *iaddr;\n" "\\&\n" "static int\n" "futex(uint32_t *uaddr, int op, uint32_t val,\n" " const struct timespec *timeout, uint32_t *uaddr2, uint32_t val3)\n" "{\n" " return syscall(SYS_futex, uaddr, op, val,\n" " timeout, uaddr2, val3);\n" "}\n" "\\&\n" "/* Acquire the futex pointed to by \\[aq]futexp\\[aq]: wait for its value to\n" " become 1, and then set the value to 0. */\n" "\\&\n" "static void\n" "fwait(uint32_t *futexp)\n" "{\n" " long s;\n" " const uint32_t one = 1;\n" "\\&\n" " /* atomic_compare_exchange_strong(ptr, oldval, newval)\n" " atomically performs the equivalent of:\n" "\\&\n" " if (*ptr == *oldval)\n" " *ptr = newval;\n" "\\&\n" " It returns true if the test yielded true and *ptr was updated. */\n" "\\&\n" " for (;;) {\n" "\\&\n" " /* Is the futex available? */\n" " if (atomic_compare_exchange_strong(futexp, &one, 0))\n" " break; /* Yes */\n" "\\&\n" " /* Futex is not available; wait. */\n" "\\&\n" " s = futex(futexp, FUTEX_WAIT, 0, NULL, NULL, 0);\n" " if (s == -1 && errno != EAGAIN)\n" " err(EXIT_FAILURE, \"futex-FUTEX_WAIT\");\n" " }\n" "}\n" "\\&\n" "/* Release the futex pointed to by \\[aq]futexp\\[aq]: if the futex" " currently\n" " has the value 0, set its value to 1 and then wake any futex waiters,\n" " so that if the peer is blocked in fwait(), it can proceed. */\n" "\\&\n" "static void\n" "fpost(uint32_t *futexp)\n" "{\n" " long s;\n" " const uint32_t zero = 0;\n" "\\&\n" " /* atomic_compare_exchange_strong() was described\n" " in comments above. */\n" "\\&\n" " if (atomic_compare_exchange_strong(futexp, &zero, 1)) {\n" " s = futex(futexp, FUTEX_WAKE, 1, NULL, NULL, 0);\n" " if (s == -1)\n" " err(EXIT_FAILURE, \"futex-FUTEX_WAKE\");\n" " }\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " pid_t childPid;\n" " unsigned int nloops;\n" "\\&\n" " setbuf(stdout, NULL);\n" "\\&\n" " nloops = (argc E 1) ? atoi(argv[1]) : 5;\n" "\\&\n" " /* Create a shared anonymous mapping that will hold the futexes.\n" " Since the futexes are being shared between processes, we\n" " subsequently use the \"shared\" futex operations (i.e., not the\n" " ones suffixed \"_PRIVATE\"). */\n" "\\&\n" " iaddr = mmap(NULL, sizeof(*iaddr) * 2, PROT_READ | PROT_WRITE,\n" " MAP_ANONYMOUS | MAP_SHARED, -1, 0);\n" " if (iaddr == MAP_FAILED)\n" " err(EXIT_FAILURE, \"mmap\");\n" "\\&\n" " futex1 = &iaddr[0];\n" " futex2 = &iaddr[1];\n" "\\&\n" " *futex1 = 0; /* State: unavailable */\n" " *futex2 = 1; /* State: available */\n" "\\&\n" " /* Create a child process that inherits the shared anonymous\n" " mapping. */\n" "\\&\n" " childPid = fork();\n" " if (childPid == -1)\n" " err(EXIT_FAILURE, \"fork\");\n" "\\&\n" " if (childPid == 0) { /* Child */\n" " for (unsigned int j = 0; j E nloops; j++) {\n" " fwait(futex1);\n" " printf(\"Child (%jd) %u\\[rs]n\", (intmax_t) getpid(), j);\n" " fpost(futex2);\n" " }\n" "\\&\n" " exit(EXIT_SUCCESS);\n" " }\n" "\\&\n" " /* Parent falls through to here. */\n" "\\&\n" " for (unsigned int j = 0; j E nloops; j++) {\n" " fwait(futex2);\n" " printf(\"Parent (%jd) %u\\[rs]n\", (intmax_t) getpid(), j);\n" " fpost(futex1);\n" " }\n" "\\&\n" " wait(NULL);\n" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" "/* futex_demo.c\n" "\\&\n" " الاستخدام: futex_demo [nloops]\n" " (المبدئي: 5)\n" "\\&\n" " توضيح استخدام الـ futexes في برنامج حيث يستخدم الأب والابن\n" " زوجًا من الـ futexes الموجودة داخل تخطيط مجهول مشترك لـ\n" " مزامنة الوصول إلى مورد مشترك: الطرفية. تكتب كل واحدة من\n" " العمليتين رسائل بـ \\[aq]num-loops\\[aq] إلى الطرفية وتوظف\n" " بروتوكول مزامنة يضمن تبادلهما في\n" " كتابة الرسائل.\n" "*/\n" "#define _GNU_SOURCE\n" "#include Eerr.hE\n" "#include Eerrno.hE\n" "#include Elinux/futex.hE\n" "#include Estdatomic.hE\n" "#include Estdint.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/mman.hE\n" "#include Esys/syscall.hE\n" "#include Esys/time.hE\n" "#include Esys/wait.hE\n" "#include Eunistd.hE\n" "\\&\n" "static uint32_t *futex1, *futex2, *iaddr;\n" "\\&\n" "static int\n" "futex(uint32_t *uaddr, int op, uint32_t val,\n" " const struct timespec *timeout, uint32_t *uaddr2, uint32_t val3)\n" "{\n" " return syscall(SYS_futex, uaddr, op, val,\n" " timeout, uaddr2, val3);\n" "}\n" "\\&\n" "/* الاستحواذ على الـ futex الذي يشير إليه \\[aq]futexp\\[aq]: الانتظار حتى" " تصبح قيمته\n" " 1، ثم ضبط القيمة إلى 0. */\n" "\\&\n" "static void\n" "fwait(uint32_t *futexp)\n" "{\n" " long s;\n" " const uint32_t one = 1;\n" "\\&\n" " /* atomic_compare_exchange_strong(ptr, oldval, newval)\n" " ينفذ ذريًا ما يعادل:\n" "\\&\n" " if (*ptr == *oldval)\n" " *ptr = newval;\n" "\\&\n" " يعيد true إذا كان الاختبار صحيحًا وحُدث *ptr. */\n" "\\&\n" " for (;;) {\n" "\\&\n" " /* هل الـ futex متاح؟ */\n" " if (atomic_compare_exchange_strong(futexp, &one, 0))\n" " break; /* نعم */\n" "\\&\n" " /* الـ futex غير متاح؛ انتظر. */\n" "\\&\n" " s = futex(futexp, FUTEX_WAIT, 0, NULL, NULL, 0);\n" " if (s == -1 && errno != EAGAIN)\n" " err(EXIT_FAILURE, \"futex-FUTEX_WAIT\");\n" " }\n" "}\n" "\\&\n" "/* تحرير الـ futex الذي يشير إليه \\[aq]futexp\\[aq]: إذا كانت قيمة الـ futex" " حاليًا\n" " 0، فاضبط قيمته إلى 1 ثم أيقظ أي منتظرين لـ futex،\n" " بحيث إذا كان النظير محبوسًا في fwait()، يمكنه المتابعة. */\n" "\\&\n" "static void\n" "fpost(uint32_t *futexp)\n" "{\n" " long s;\n" " const uint32_t zero = 0;\n" "\\&\n" " /* atomic_compare_exchange_strong() شُرحت\n" " في التعليقات أعلاه. */\n" "\\&\n" " if (atomic_compare_exchange_strong(futexp, &zero, 1)) {\n" " s = futex(futexp, FUTEX_WAKE, 1, NULL, NULL, 0);\n" " if (s == -1)\n" " err(EXIT_FAILURE, \"futex-FUTEX_WAKE\");\n" " }\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " pid_t childPid;\n" " unsigned int nloops;\n" "\\&\n" " setbuf(stdout, NULL);\n" "\\&\n" " nloops = (argc E 1) ? atoi(argv[1]) : 5;\n" "\\&\n" " /* إنشاء تخطيط مجهول مشترك سيحتوي على الـ futexes.\n" " بما أن الـ futexes ستُشارك بين العمليات، فسنستخدم\n" " لاحقًا عمليات الـ futex \"المشتركة\" (أي ليس\n" " التي تنتهي بـ \"_PRIVATE\"). */\n" "\\&\n" " iaddr = mmap(NULL, sizeof(*iaddr) * 2, PROT_READ | PROT_WRITE,\n" " MAP_ANONYMOUS | MAP_SHARED, -1, 0);\n" " if (iaddr == MAP_FAILED)\n" " err(EXIT_FAILURE, \"mmap\");\n" "\\&\n" " futex1 = &iaddr[0];\n" " futex2 = &iaddr[1];\n" "\\&\n" " *futex1 = 0; /* الحالة: غير متاح */\n" " *futex2 = 1; /* الحالة: متاح */\n" "\\&\n" " /* إنشاء عملية ابن ترث التخطيط المجهول المشترك.\n" " */\n" "\\&\n" " childPid = fork();\n" " if (childPid == -1)\n" " err(EXIT_FAILURE, \"fork\");\n" "\\&\n" " if (childPid == 0) { /* الابن */\n" " for (unsigned int j = 0; j E nloops; j++) {\n" " fwait(futex1);\n" " printf(\"Child (%jd) %u\\[rs]n\", (intmax_t) getpid(), j);\n" " fpost(futex2);\n" " }\n" "\\&\n" " exit(EXIT_SUCCESS);\n" " }\n" "\\&\n" " /* الأب يصل إلى هنا. */\n" "\\&\n" " for (unsigned int j = 0; j E nloops; j++) {\n" " fwait(futex2);\n" " printf(\"Parent (%jd) %u\\[rs]n\", (intmax_t) getpid(), j);\n" " fpost(futex1);\n" " }\n" "\\&\n" " wait(NULL);\n" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" #. SRC END #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "SEE ALSO" msgstr "انظر أيضًا" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "B(2), B(2), " "B(3), B(7), B(7)" msgstr "" "B(2), B(2), " "B(3), B(7), B(7)" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "The following kernel source files:" msgstr "ملفات مصدر النواة التالية:" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "I" msgstr "I" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "I" msgstr "I" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "I" msgstr "I" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "I" msgstr "I" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "I" msgstr "I" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "Franke, H., Russell, R., and Kirwood, M., 2002." msgstr "Franke, H., Russell, R., and Kirwood, M., 2002." #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "E<.UR http:\\://kernel.org/\\:doc/\\:ols/\\:2002/\\:ols2002-pages-479-495." "pdf> I E<.UE> " "(from proceedings of the Ottawa Linux Symposium 2002)." msgstr "" "E<.UR http:\\://kernel.org/\\:doc/\\:ols/\\:2002/\\:ols2002-pages-479-495." "pdf> I E<.UE> " "(من وقائع ندوة أوتاوا للينكس 2002)." #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "Hart, D., 2009. E<.UR http:\\://lwn.net/\\:Articles/\\:360699/> I E<.UE .>" msgstr "" "Hart, D., 2009. E<.UR http:\\://lwn.net/\\:Articles/\\:360699/> I E<.UE .>" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "Hart, D.\\& and Guniguntala, D., 2009. E<.UR http:\\://lwn.net/\\:images/\\:" "conf/\\:rtlws11/\\:papers/\\:proc/\\:p10.pdf> I E<.UE> (from proceedings of the 2009 Real-Time Linux " "Workshop)." msgstr "" "Hart, D.\\& و Guniguntala, D., 2009. E<.UR http\\://lwn.net/\\:images/\\:" "conf/\\:rtlws11/\\:papers/\\:proc/\\:p10.pdf> I E<.UE> (من وقائع ورشة عمل لينكس للوقت الحقيقي 2009)." #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "Drepper, U., 2011. E<.UR http:\\://www.akkadia.org/\\:drepper/\\:futex.pdf> " "I E<.UE .>" msgstr "" "Drepper, U., 2011. E<.UR http\\://www.akkadia.org/\\:drepper/\\:futex.pdf> " "I<الفوتكسات خادعة> E<.UE .>" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed msgid "" "Futex example library, E<.UR https:\\://mirrors.kernel.org/\\:pub/\\:linux/" "\\:kernel/\\:people/\\:rusty/> futex-*.tar.bz2 E<.UE .>" msgstr "" "مكتبة أمثلة فوتكس، E<.UR https\\://mirrors.kernel.org/\\:pub/\\:linux/\\:" "kernel/\\:people/\\:rusty/> futex-*.tar.bz2 E<.UE .>" #. type: TH #: debian-trixie #, no-wrap msgid "2024-06-15" msgstr "15 يونيو 2024" #. type: TH #: debian-trixie #, no-wrap msgid "Linux man-pages 6.9.1" msgstr "صفحات دليل لينكس 6.9.1" #. type: Plain text #: debian-trixie msgid "Standard C library (I, I<-lc>)" msgstr "مكتبة سي المعيارية (I، I<-lc>)" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "" "B<#include Elinux/futex.hE> /* Definition of B" " constants */\n" "B<#include Esys/syscall.hE> /* Definition of B constants" " */\n" "B<#include Eunistd.hE>\n" msgstr "" "B<#include Elinux/futex.hE> /* تعريف ثوابت B */\n" "B<#include Esys/syscall.hE> /* تعريف ثوابت B */\n" "B<#include Eunistd.hE>\n" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "" "BIB<, int >IB<, uint32_t" " >IB<,>\n" "B< const struct timespec *>IB<,>I< > /* or: BIB< */>\n" "B< uint32_t *>IB<, uint32_t >IB<);>\n" msgstr "" "BIB<, int >IB<, uint32_t" " >IB<,>\n" "B< const struct timespec *>IB<,>I< > /* أو: BIB< */>\n" "B< uint32_t *>IB<, uint32_t >IB<);>\n" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "I: glibc provides no wrapper for B(), necessitating the use of " "B(2)." msgstr "" "I<ملاحظة>: لا توفر glibc أي غلاف لـ B()، مما يستوجب استخدام " "B(2)." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "Note that no explicit initialization or destruction is necessary to use " "futexes; the kernel maintains a futex (i.e., the kernel-internal " "implementation artifact) only while operations such as B, " "described below, are being performed on a particular futex word." msgstr "" "لاحظ أنه لا يلزم تهيئة أو تدمير صريح لاستخدام الفوتكسات؛ فـ النواة تحتفظ " "بفوتكس (أي أثر التنفيذ الداخلي لـ النواة) فقط أثناء إجراء عمليات مثل " "B، الموضحة أدناه، على كلمة فوتكس معينة." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "The I argument points to the futex word. On all platforms, futexes " "are four-byte integers that must be aligned on a four-byte boundary. The " "operation to perform on the futex is specified in the I argument; " "I is a value whose meaning and purpose depends on I." msgstr "" "تُشير المعطاة I إلى كلمة الفوتكس. في جميع المنصات، الفوتكسات هي أعداد " "صحيحة من أربعة بايتات يجب محاذاتها على حد أربعة بايتات. تُحدد العملية المطلوب " "تنفيذها على الفوتكس في المعطاة I؛ و I هي قيمة يعتمد معناها " "والغرض منها على I." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "The remaining arguments (I, I, and I) are required " "only for certain of the futex operations described below. Where one of " "these arguments is not required, it is ignored." msgstr "" "المعطيات المتبقية (I، و I، و I) مطلوبة فقط لعمليات " "فوتكس معينة موصوفة أدناه. وعندما لا تكون إحدى هذه المعطيات مطلوبة، تُتجاهل." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "For several blocking operations, the I argument is a pointer to a " "I structure that specifies a timeout for the operation. However, " "notwithstanding the prototype shown above, for some operations, the least " "significant four bytes of this argument are instead used as an integer whose " "meaning is determined by the operation. For these operations, the kernel " "casts the I value first to I, then to I, " "and in the remainder of this page, this argument is referred to as I " "when interpreted in this fashion." msgstr "" "بالنسبة لعدة عمليات حاصرة، تكون المعطاة I مؤشراً إلى هيكل " "I يحدد مهلة للعملية. ومع ذلك، وبالرغم من النموذج الموضح أعلاه، ففي " "بعض العمليات، تُستخدم البايتات الأربعة الأقل أهمية من هذه المعطاة بدلاً من" " ذلك " "كعدد صحيح يحدد معناه بواسطة العملية. لهذه العمليات، تحول النواة قيمة " "I أولاً إلى I، ثم إلى I، وفي بقية هذه " "الصفحة، يشار إلى هذه المعطاة باسم I عند تفسيرها بهذا الأسلوب." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "Where it is required, the I argument is a pointer to a second futex " "word that is employed by the operation." msgstr "" "عندما تكون مطلوبة، تكون المعطاة I مؤشراً إلى كلمة فوتكس ثانية " "تستخدمها العملية." # #. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "The interpretation of the final integer argument, I, depends on the " "operation." msgstr "تعتمد ترجمة المعطاة الصحيحة النهائية، I، على العملية." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "The I argument consists of two parts: a command that specifies the " "operation to be performed, bitwise ORed with zero or more options that " "modify the behaviour of the operation. The options that may be included in " "I are as follows:" msgstr "" "تتكون المعطاة I من جزأين: أمر يحدد العملية المراد تنفيذها، معمول " "له OR بتياً مع خيار واحد أو أكثر من الخيارات التي تعدل سلوك العملية. الخيارات " "التي قد تُضمّن في I هي كما يلي:" #. commit 1acdac104668a0834cfa267de9946fac7764d486 #. commit 337f13046ff03717a9e99675284a817527440a49 #. commit bf22a6976897977b0a3f1aeba6823c959fc4fdae #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "This option bit can be employed only with the B, " "B, (since Linux 4.5) B, and (since Linux " "5.14) B operations." msgstr "" "لا يمكن استخدام بت الخيار هذا إلا مع عمليات B، و " "B، و (منذ لينكس 4.5) B، و (منذ لينكس " "5.14) B." # #. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "The operation specified in I is one of the following:" msgstr "العملية المحددة في I هي واحدة مما يلي:" #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B (since Linux 2.6.0)" msgstr "B (منذ لينكس 2.6.0)" #. Strictly speaking, since some time in Linux 2.5.x #. FIXME: Torvald, I think we may need to add some explanation of #. "totally ordered" here. #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "This operation tests that the value at the futex word pointed to by the " "address I still contains the expected value I, and if so, then " "sleeps waiting for a B operation on the futex word. The load of " "the value of the futex word is an atomic memory access (i.e., using atomic " "machine instructions of the respective architecture). This load, the " "comparison with the expected value, and starting to sleep are performed " "atomically and totally ordered with respect to other futex operations on the " "same futex word. If the thread starts to sleep, it is considered a waiter " "on this futex word. If the futex value does not match I, then the call " "fails immediately with the error B." msgstr "" "تختبر هذه العملية ما إذا كانت القيمة في كلمة الفوتكس التي يشير إليها العنوان " "I لا تزال تحتوي على القيمة المتوقعة I، وإذا كان الأمر كذلك، " "فإنها تنام في انتظار عملية B على كلمة الفوتكس. تحميل قيمة كلمة " "الفوتكس هو وصول ذري للذاكرة (أي باستخدام تعليمات الآلة الذرية للبنية " "المعنية). يُنفذ هذا التحميل، والمقارنة مع القيمة المتوقعة، وبدء النوم بشكل " "ذري وبترتيب كلي بالنسبة لعمليات فوتكس الأخرى على نفس كلمة الفوتكس. إذا بدأ " "الخيط في النوم، فيُعتبر منتظراً على كلمة الفوتكس هذه. إذا لم تتطابق قيمة " "الفوتكس مع I، فستفشل المكالمة فوراً مع الخطأ B." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "The purpose of the comparison with the expected value is to prevent lost " "wake-ups. If another thread changed the value of the futex word after the " "calling thread decided to block based on the prior value, and if the other " "thread executed a B operation (or similar wake-up) after the " "value change and before this B operation, then the calling " "thread will observe the value change and will not start to sleep." msgstr "" "الغرض من المقارنة مع القيمة المتوقعة هو منع فقدان عمليات التنبيه. إذا قام " "خيط آخر بتغيير قيمة كلمة الفوتكس بعد أن قرر الخيط المستدعي الحصر بناءً على " "القيمة السابقة، وإذا قام الخيط الآخر بتنفيذ عملية B (أو تنبيه " "مشابه) بعد تغيير القيمة وقبل عملية B هذه، فسيلاحظ الخيط المستدعي " "تغيير القيمة ولن يبدأ في النوم." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "If the I is not NULL, the structure it points to specifies a " "timeout for the wait. (This interval will be rounded up to the system clock " "granularity, and is guaranteed not to expire early.) The timeout is by " "default measured according to the B clock, but, since Linux " "4.5, the B clock can be selected by specifying " "B in I. If I is NULL, the call " "blocks indefinitely." msgstr "" "إذا كانت I ليست NULL، فإن الهيكل الذي تشير إليه يحدد مهلة للانتظار. " "(سيتم تقريب هذه الفترة إلى دقة ساعة النظام، ومن المضمون عدم انتهاء صلاحيتها " "مبكراً.) تُقاس المهلة مبدئياً وفقاً لساعة B، ولكن منذ لينكس " "4.5، يمكن اختيار ساعة B بتحديد B في " "I. إذا كانت I هي NULL، فستُحصر المكالمة إلى أجل غير مسمى." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "I: for B, I is interpreted as a I " "value. This differs from other futex operations, where I is " "interpreted as an absolute value. To obtain the equivalent of B " "with an absolute timeout, employ B with I specified " "as B." msgstr "" "I<ملاحظة>: بالنسبة لـ B، تُفسر I كقيمة I<نسبية>. وهذا " "يختلف عن عمليات فوتكس الأخرى، حيث تُفسر I كقيمة مطلقة. للحصول على ما " "يعادل B بمهلة مطلقة، استخدم B مع تحديد " "I كـ B." # # #. FIXME . (Torvald) I think we should remove this. Or maybe adapt to a #. different example. #. For #. .BR futex (7), #. this call is executed if decrementing the count gave a negative value #. (indicating contention), #. and will sleep until another process or thread releases #. the futex and executes the #. .B FUTEX_WAKE #. operation. #. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "The arguments I and I are ignored." msgstr "تُتجاهل المعطيات I و I." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B (since Linux 2.6.0)" msgstr "B (منذ لينكس 2.6.0)" #. Strictly speaking, since Linux 2.5.x #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "This operation wakes at most I of the waiters that are waiting (e.g., " "inside B) on the futex word at the address I. Most " "commonly, I is specified as either 1 (wake up a single waiter) or " "B (wake up all waiters). No guarantee is provided about which " "waiters are awoken (e.g., a waiter with a higher scheduling priority is not " "guaranteed to be awoken in preference to a waiter with a lower priority)." msgstr "" "توقظ هذه العملية على الأكثر I من المنتظرين الذين ينتظرون (على سبيل " "المثال، داخل B) على كلمة الفوتكس في العنوان I. الأكثر " "شيوعاً هو تحديد I كـ 1 (إيقاظ منتظر واحد) أو B (إيقاظ جميع " "المنتظرين). لا يُقدم أي ضمان بشأن المنتظرين الذين سيتم إيقاظهم (على سبيل " "المثال، لا يضمن إيقاظ منتظر ذي أولوية جدولة أعلى قبل منتظر ذي أولوية أقل)." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "The arguments I, I, and I are ignored." msgstr "تُتجاهل المعطيات I، و I، و I." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B (from Linux 2.6.0 up to and including Linux 2.6.25)" msgstr "B (من لينكس 2.6.0 حتى لينكس 2.6.25 بما في ذلك)" #. Strictly speaking, from Linux 2.5.x to Linux 2.6.25 #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "This operation creates a file descriptor that is associated with the futex " "at I. The caller must close the returned file descriptor after use. " "When another process or thread performs a B on the futex word, " "the file descriptor indicates as being readable with B(2)، و B(2)، و B(7)" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "The file descriptor can be used to obtain asynchronous notifications: if " "I is nonzero, then, when another process or thread executes a " "B, the caller will receive the signal number that was passed in " "I." msgstr "" "يمكن استخدام واصف الملف للحصول على إشعارات غير متزامنة: إذا كانت I غير " "صفرية، فعندما تقوم عملية أو خيط آخر بتنفيذ B، سيتلقى المستدعِي " "رقم الإشارة الذي تم تمريره في I." # #. commit 82af7aca56c67061420d618cc5a30f0fd4106b80 #. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "Because it was inherently racy, B has been removed from Linux " "2.6.26 onward." msgstr "" "نظراً لأنه كان ينطوي بطبيعته على تنافس، فقد حُذف B من لينكس 2.6.26 " "فصاعداً." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B (since Linux 2.6.0)" msgstr "B (منذ لينكس 2.6.0)" # #. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "This operation performs the same task as B (see below), " "except that no check is made using the value in I. (The argument " "I is ignored.)" msgstr "" "تؤدي هذه العملية نفس المهمة التي تؤديها B (انظر أدناه)، " "باستثناء أنه لا يتم إجراء أي فحص باستخدام القيمة في I. (تُتجاهل المعطاة " "I.)" #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B (since Linux 2.6.7)" msgstr "B (منذ لينكس 2.6.7)" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "This operation first checks whether the location I still contains the " "value I. If not, the operation fails with the error B. " "Otherwise, the operation wakes up a maximum of I waiters that are " "waiting on the futex at I. If there are more than I waiters, " "then the remaining waiters are removed from the wait queue of the source " "futex at I and added to the wait queue of the target futex at " "I. The I argument specifies an upper limit on the number of " "waiters that are requeued to the futex at I." msgstr "" "تتحقق هذه العملية أولاً مما إذا كان الموقع I لا يزال يحتوي على القيمة " "I. إذا لم يكن الأمر كذلك، تفشل العملية مع الخطأ B. وإلا، فإن " "العملية توقظ حداً أقصى قدره I من المنتظرين الذين ينتظرون على الفوتكس عند " "I. إذا كان هناك أكثر من I من المنتظرين، فسيتم حذف المنتظرين " "المتبقين من صف انتظار فوتكس المصدر عند I وإضافتهم إلى صف انتظار فوتكس " "الهدف عند I. تحدد المعطاة I حداً أقصى لعدد المنتظرين الذين سيتم " "نقلهم إلى صف فوتكس آخر عند I." #. FIXME(Torvald) Is the following correct? Or is just the decision #. which threads to wake or requeue part of the atomic operation? #. Notes from a f2f conversation with Thomas Gleixner (Aug 2015): ### #. The operation is serialized with respect to operations on both #. source and target futex. No other waiter can enqueue itself #. for waiting and no other waiter can dequeue itself because of #. a timeout or signal. #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "The load from I is an atomic memory access (i.e., using atomic " "machine instructions of the respective architecture). This load, the " "comparison with I, and the requeueing of any waiters are performed " "atomically and totally ordered with respect to other operations on the same " "futex word." msgstr "" "التحميل من I هو وصول ذري للذاكرة (أي باستخدام تعليمات الآلة الذرية " "للبنية المعنية). يُنفذ هذا التحميل، والمقارنة مع I، وإعادة وضع أي " "منتظرين في صف آخر بشكل ذري وبترتيب كلي بالنسبة للعمليات الأخرى على نفس كلمة " "الفوتكس." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "Typical values to specify for I are 0 or 1. (Specifying B is " "not useful, because it would make the B operation " "equivalent to B.) The limit value specified via I is " "typically either 1 or B. (Specifying the argument as 0 is not " "useful, because it would make the B operation equivalent " "to B.)" msgstr "" "القيم النموذجية لتحديد I هي 0 أو 1. (تحديد B غير مفيد، لأنه " "سيجعل عملية B مكافئة لـ B.) قيمة الحد المحددة " "عبر I هي عادةً إما 1 أو B. (تحديد المعطاة كـ 0 غير مفيد، لأنه " "سيجعل عملية B مكافئة لـ B.)" #. But, as Rich Felker points out, there remain valid use cases for #. FUTEX_REQUEUE, for example, when the calling thread is requeuing #. the target(s) to a lock that the calling thread owns #. From: Rich Felker #. Date: Wed, 29 Oct 2014 22:43:17 -0400 #. To: Darren Hart #. CC: libc-alpha@sourceware.org, ... #. Subject: Re: Add futex wrapper to glibc? #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "The B operation was added as a replacement for the " "earlier B. The difference is that the check of the value at " "I can be used to ensure that requeueing happens only under certain " "conditions, which allows race conditions to be avoided in certain use cases." msgstr "" "أُضيفت عملية B كبديل لعملية B السابقة. " "والفرق هو أن التحقق من القيمة عند I يمكن استخدامه لضمان حدوث إعادة " "الصف فقط في ظل ظروف معينة، مما يسمح بتجنب حالات التسابق في حالات استخدام " "معينة." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "Both B and B can be used to avoid " "\"thundering herd\" wake-ups that could occur when using B in " "cases where all of the waiters that are woken need to acquire another " "futex. Consider the following scenario, where multiple waiter threads are " "waiting on B, a wait queue implemented using a futex:" msgstr "" "يمكن استخدام كل من B و B لتجنب تنبيهات " "\"القطيع الهائج\" التي قد تحدث عند استخدام B في الحالات التي " "يحتاج فيها جميع المنتظرين الذين تم إيقاظهم إلى حيازة فوتكس آخر. تأمل " "السيناريو التالي، حيث تنتظر خيوط منتظرين متعددة على B، وهو صف انتظار نُفذ " "باستخدام فوتكس:" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "" "lock(A)\n" "while (!check_value(V)) {\n" " unlock(A);\n" " block_on(B);\n" " lock(A);\n" "};\n" "unlock(A);\n" msgstr "" "lock(A)\n" "while (!check_value(V)) {\n" " unlock(A);\n" " block_on(B);\n" " lock(A);\n" "};\n" "unlock(A);\n" # #. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "If a waker thread used B, then all waiters waiting on B would be " "woken up, and they would all try to acquire lock A. However, waking all of " "the threads in this manner would be pointless because all except one of the " "threads would immediately block on lock A again. By contrast, a requeue " "operation wakes just one waiter and moves the other waiters to lock A, and " "when the woken waiter unlocks A then the next waiter can proceed." msgstr "" "إذا استخدم خيط منبه B، فسيتم إيقاظ جميع المنتظرين الذين ينتظرون " "على B، وسيحاولون جميعاً حيازة القفل A. ومع ذلك، فإن إيقاظ جميع الخيوط بهذه " "الطريقة سيكون بلا فائدة لأن جميع الخيوط باستثناء واحد ستنحصر فوراً على القفل " "A مرة أخرى. في المقابل، توقظ عملية إعادة الصف منتظراً واحداً فقط وتنقل " "المنتظرين الآخرين إلى القفل A، وعندما يحرر المنتظر المستيقظ القفل A، يمكن " "للمنتظر التالي المضي قدماً." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B (since Linux 2.6.14)" msgstr "B (منذ لينكس 2.6.14)" #. commit 4732efbeb997189d9f9b04708dc26bf8613ed721 #. Author: Jakub Jelinek #. Date: Tue Sep 6 15:16:25 2005 -0700 #. FIXME. (Torvald) The glibc condvar implementation is currently being #. revised (e.g., to not use an internal lock anymore). #. It is probably more future-proof to remove this paragraph. #. [Torvald, do you have an update here?] #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "This operation was added to support some user-space use cases where more " "than one futex must be handled at the same time. The most notable example " "is the implementation of B(3), which requires " "operations on two futexes, the one used to implement the mutex and the one " "used in the implementation of the wait queue associated with the condition " "variable. B allows such cases to be implemented without " "leading to high rates of contention and context switching." msgstr "" "أُضيفت هذه العملية لدعم بعض حالات استخدام مساحة المستخدم حيث يجب التعامل مع " "أكثر من فوتكس في نفس الوقت. أبرز مثال على ذلك هو تنفيذ " "B(3)، الذي يتطلب عمليات على فوتكسين، أحدهما يُستخدم " "لتنفيذ الاستبعاد المتبادل والآخر يُستخدم في تنفيذ صف الانتظار المرتبط بمتغير " "الحالة. يسمح B بتنفيذ مثل هذه الحالات دون التسبب في معدلات " "عالية من التنافس وتبديل السياق." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "The B operation is equivalent to executing the following code " "atomically and totally ordered with respect to other futex operations on any " "of the two supplied futex words:" msgstr "" "عملية B تعادل تنفيذ الكود التالي بشكل ذري وبترتيب كلي فيما " "يتعلق بعمليات فوتكس الأخرى على أي من كلمتي فوتكس المقدمتين:" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "" "uint32_t oldval = *(uint32_t *) uaddr2;\n" "*(uint32_t *) uaddr2 = oldval I I;\n" "futex(uaddr, FUTEX_WAKE, val, 0, 0, 0);\n" "if (oldval I I)\n" " futex(uaddr2, FUTEX_WAKE, val2, 0, 0, 0);\n" msgstr "" "uint32_t oldval = *(uint32_t *) uaddr2;\n" "*(uint32_t *) uaddr2 = oldval I I;\n" "futex(uaddr, FUTEX_WAKE, val, 0, 0, 0);\n" "if (oldval I I)\n" " futex(uaddr2, FUTEX_WAKE, val2, 0, 0, 0);\n" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "In other words, B does the following:" msgstr "بعبارة أخرى، يقوم B بما يلي:" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "saves the original value of the futex word at I and performs an " "operation to modify the value of the futex at I; this is an atomic " "read-modify-write memory access (i.e., using atomic machine instructions of " "the respective architecture)" msgstr "" "يحفظ القيمة الأصلية لكلمة الفوتكس عند I وينفذ عملية لتعديل قيمة " "الفوتكس عند I؛ هذا هو وصول ذري للذاكرة من نوع قراءة-تعديل-كتابة (أي " "باستخدام تعليمات الآلة الذرية للبنية المعنية)" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "wakes up a maximum of I waiters on the futex for the futex word at " "I; and" msgstr "" "يوقظ بحد أقصى I من المنتظرين على الفوتكس لكلمة الفوتكس عند I؛ و" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "dependent on the results of a test of the original value of the futex word " "at I, wakes up a maximum of I waiters on the futex for the " "futex word at I." msgstr "" "اعتماداً على نتائج اختبار القيمة الأصلية لكلمة الفوتكس عند I، يوقظ " "بحد أقصى I من المنتظرين على الفوتكس لكلمة الفوتكس عند I." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "The operation and comparison that are to be performed are encoded in the " "bits of the argument I. Pictorially, the encoding is:" msgstr "" "تُرمز العملية والمقارنة المراد تنفيذهما في بتات المعطاة I. بالرسم، " "التشفير هو:" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "" "+---+---+-----------+-----------+\n" "|op |cmp| oparg | cmparg |\n" "+---+---+-----------+-----------+\n" " 4 4 12 12 E== # of bits\n" msgstr "" "+---+---+-----------+-----------+\n" "|op |cmp| oparg | cmparg |\n" "+---+---+-----------+-----------+\n" " 4 4 12 12 E== عدد البتات\n" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "Expressed in code, the encoding is:" msgstr "معبراً عنه بالكود، التشفير هو:" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "" "#define FUTEX_OP(op, oparg, cmp, cmparg) \\[rs]\n" " (((op & 0xf) EE 28) | \\[rs]\n" " ((cmp & 0xf) EE 24) | \\[rs]\n" " ((oparg & 0xfff) EE 12) | \\[rs]\n" " (cmparg & 0xfff))\n" msgstr "" "#define FUTEX_OP(op, oparg, cmp, cmparg) \\[rs]\n" " (((op & 0xf) EE 28) | \\[rs]\n" " ((cmp & 0xf) EE 24) | \\[rs]\n" " ((oparg & 0xfff) EE 12) | \\[rs]\n" " (cmparg & 0xfff))\n" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "In the above, I and I are each one of the codes listed below. The " "I and I components are literal numeric values, except as " "noted below." msgstr "" "فيما سبق، I و I كل منهما كود من الأكواد المدرجة أدناه. المكونان " "I و I هما قيم عددية حرفية، إلا كما هو موضح أدناه." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "The I component has one of the following values:" msgstr "يحتوي المكون I على إحدى القيم التالية:" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "" "FUTEX_OP_SET 0 /* uaddr2 = oparg; */\n" "FUTEX_OP_ADD 1 /* uaddr2 += oparg; */\n" "FUTEX_OP_OR 2 /* uaddr2 |= oparg; */\n" "FUTEX_OP_ANDN 3 /* uaddr2 &= \\[ti]oparg; */\n" "FUTEX_OP_XOR 4 /* uaddr2 \\[ha]= oparg; */\n" msgstr "" "FUTEX_OP_SET 0 /* uaddr2 = oparg; */\n" "FUTEX_OP_ADD 1 /* uaddr2 += oparg; */\n" "FUTEX_OP_OR 2 /* uaddr2 |= oparg; */\n" "FUTEX_OP_ANDN 3 /* uaddr2 &= \\[ti]oparg; */\n" "FUTEX_OP_XOR 4 /* uaddr2 \\[ha]= oparg; */\n" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide #| msgid "" #| "In addition, bitwise ORing the following value into I causes " #| "I<(1\\~EE\\~oparg)> to be used as the operand:" msgid "" "In addition, bitwise ORing the following value into I causes I<(1\\ " "EE\\ oparg)> to be used as the operand:" msgstr "" "بالإضافة إلى ذلك، فإن إجراء OR بتياً للقيمة التالية في I يؤدي إلى استخدام " "I<(1\\ EE\\ oparg)> كـ معامل:" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "FUTEX_OP_ARG_SHIFT 8 /* Use (1 EE oparg) as operand */\n" msgstr "FUTEX_OP_ARG_SHIFT 8 /* استخدم (1 EE oparg) كمعامل */\n" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "The I field is one of the following:" msgstr "حقل I هو واحد مما يلي:" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "" "FUTEX_OP_CMP_EQ 0 /* if (oldval == cmparg) wake */\n" "FUTEX_OP_CMP_NE 1 /* if (oldval != cmparg) wake */\n" "FUTEX_OP_CMP_LT 2 /* if (oldval E cmparg) wake */\n" "FUTEX_OP_CMP_LE 3 /* if (oldval E= cmparg) wake */\n" "FUTEX_OP_CMP_GT 4 /* if (oldval E cmparg) wake */\n" "FUTEX_OP_CMP_GE 5 /* if (oldval E= cmparg) wake */\n" msgstr "" "FUTEX_OP_CMP_EQ 0 /* إذا كان (oldval == cmparg) استيقظ */\n" "FUTEX_OP_CMP_NE 1 /* إذا كان (oldval != cmparg) استيقظ */\n" "FUTEX_OP_CMP_LT 2 /* إذا كان (oldval E cmparg) استيقظ */\n" "FUTEX_OP_CMP_LE 3 /* إذا كان (oldval E= cmparg) استيقظ */\n" "FUTEX_OP_CMP_GT 4 /* إذا كان (oldval E cmparg) استيقظ */\n" "FUTEX_OP_CMP_GE 5 /* إذا كان (oldval E= cmparg) استيقظ */\n" # #. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "The return value of B is the sum of the number of waiters " "woken on the futex I plus the number of waiters woken on the futex " "I." msgstr "" "قيمة الإرجاع لـ B هي مجموع عدد المنتظرين الذين استيقظوا على " "فوتكس I بالإضافة إلى عدد المنتظرين الذين استيقظوا على فوتكس I." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B (since Linux 2.6.25)" msgstr "B (منذ لينكس 2.6.25)" #. commit cd689985cf49f6ff5c8eddc48d98b9d581d9475d #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "This operation is like B except that I is used to provide " "a 32-bit bit mask to the kernel. This bit mask, in which at least one bit " "must be set, is stored in the kernel-internal state of the waiter. See the " "description of B for further details." msgstr "" "تشبه هذه العملية B باستثناء أن I يُستخدم لتوفير قناع بتات " "32 بت لـ النواة. يُخزن قناع البتات هذا، والذي يجب ضبط بت واحد على الأقل فيه، " "في الحالة الداخلية لـ النواة للمنتظر. انظر وصف B لمزيد من " "التفاصيل." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "If I is not NULL, the structure it points to specifies an absolute " "timeout for the wait operation. If I is NULL, the operation can " "block indefinitely." msgstr "" "إذا كانت I ليست NULL، فإن الهيكل الذي تشير إليه يحدد مهلة مطلقة " "لعملية الانتظار. إذا كانت I هي NULL، يمكن حصر العملية إلى أجل غير " "مسمى." # #. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "The I argument is ignored." msgstr "تُتجاهل المعطاة I." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B (since Linux 2.6.25)" msgstr "B (منذ لينكس 2.6.25)" #. commit cd689985cf49f6ff5c8eddc48d98b9d581d9475d #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "This operation is the same as B except that the I argument " "is used to provide a 32-bit bit mask to the kernel. This bit mask, in which " "at least one bit must be set, is used to select which waiters should be " "woken up. The selection is done by a bitwise AND of the \"wake\" bit mask " "(i.e., the value in I) and the bit mask which is stored in the kernel-" "internal state of the waiter (the \"wait\" bit mask that is set using " "B). All of the waiters for which the result of the AND " "is nonzero are woken up; the remaining waiters are left sleeping." msgstr "" "هذه العملية هي نفسها B باستثناء أن المعطاة I تُستخدم لتوفير " "قناع بتات 32 بت لـ النواة. يُستخدم قناع البتات هذا، والذي يجب ضبط بت واحد على " "الأقل فيه، لتحديد المنتظرين الذين يجب إيقاظهم. يتم التحديد بواسطة AND بتياً " "لقناع بتات \"التنبيه\" (أي القيمة في I) وقناع البتات المخزن في الحالة " "الداخلية لـ النواة للمنتظر (قناع بتات \"الانتظار\" الذي يتم ضبطه باستخدام " "B). يتم إيقاظ جميع المنتظرين الذين تكون نتيجة AND لهم غير " "صفرية؛ ويُترك المنتظرون المتبقون نائمين." # # #. According to http://locklessinc.com/articles/futex_cheat_sheet/: #. "The original reason for the addition of these extensions #. was to improve the performance of pthread read-write locks #. in glibc. However, the pthreads library no longer uses the #. same locking algorithm, and these extensions are not used #. without the bitset parameter being all ones. #. The page goes on to note that the FUTEX_WAIT_BITSET operation #. is nevertheless used (with a bit mask of all ones) in order to #. obtain the absolute timeout functionality that is useful #. for efficiently implementing Pthreads APIs (which use absolute #. timeouts); FUTEX_WAIT provides only relative timeouts. #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "The effect of B and B is to allow " "selective wake-ups among multiple waiters that are blocked on the same " "futex. However, note that, depending on the use case, employing this bit-" "mask multiplexing feature on a futex can be less efficient than simply using " "multiple futexes, because employing bit-mask multiplexing requires the " "kernel to check all waiters on a futex, including those that are not " "interested in being woken up (i.e., they do not have the relevant bit set in " "their \"wait\" bit mask)." msgstr "" "تأثير B و B هو السماح بعمليات تنبيه " "انتقائية بين عدة منتظرين محصورين على نفس الفوتكس. ومع ذلك، لاحظ أنه، اعتماداً " "على حالة الاستخدام، قد يكون استخدام ميزة تعدد الإرسال بقناع البتات هذه على " "فوتكس أقل كفاءة من مجرد استخدام فوتكسات متعددة، لأن استخدام تعدد الإرسال " "بقناع البتات يتطلب من النواة فحص جميع المنتظرين على الفوتكس، بما في ذلك " "أولئك غير المهتمين بالاستيقاظ (أي ليس لديهم البت المعني مضبوطاً في قناع بتات " "\"الانتظار\" الخاص بهم)." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "The constant B, which corresponds to all 32 bits set " "in the bit mask, can be used as the I argument for " "B and B. Other than differences in " "the handling of the I argument, the B operation is " "equivalent to B with I specified as " "B; that is, allow a wake-up by any waker. The " "B operation is equivalent to B with I " "specified as B; that is, wake up any waiter(s)." msgstr "" "يمكن استخدام الثابت B، الذي يتوافق مع ضبط جميع " "البتات الـ 32 في قناع البتات، كـ معطاة I لـ B و " "B. وبخلاف الاختلافات في معالجة المعطاة I، فإن " "عملية B تعادل B مع تحديد I كـ " "B؛ أي السماح بالتنبيه من قبل أي منبه. عملية " "B تعادل B مع تحديد I كـ " "B؛ أي إيقاظ أي منتظر (أو منتظرين)." # #. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "The I and I arguments are ignored." msgstr "تُتجاهل المعطيات I و I." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "If a futex is already acquired (i.e., has a nonzero value), waiters must " "employ the B or B operations to acquire the " "lock. If other threads are waiting for the lock, then the B " "bit is set in the futex value; in this case, the lock owner must employ the " "B operation to release the lock." msgstr "" "إذا تم حيازة فوتكس بالفعل (أي له قيمة غير صفرية)، فيجب على المنتظرين استخدام " "عمليات B أو B لحيازة القفل. إذا كانت هناك " "خيوط أخرى تنتظر القفل، فسيتم ضبط بت B في قيمة الفوتكس؛ في هذه " "الحالة، يجب على مالك القفل استخدام عملية B لتحرير القفل." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "PI futexes are operated on by specifying one of the values listed below in " "I. Note that the PI futex operations must be used as paired " "operations and are subject to some additional requirements:" msgstr "" "يتم تشغيل فوتكسات PI بتحديد إحدى القيم المدرجة أدناه في I. لاحظ " "أنه يجب استخدام عمليات فوتكس PI كعمليات مزدوجة وهي تخضع لبعض المتطلبات " "الإضافية:" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "B, B, and B pair with " "B. B must be called only on a futex owned " "by the calling thread, as defined by the value policy, otherwise the error " "B results." msgstr "" "تتقابل العمليات B و B و B " "مع العملية B. ويجب ألا تُستدعى B إلا على " "فيوتكس (futex) يمتلكه خيط الاستدعاء، كما هو محدد في سياسة القيمة، وإلا " "فسينتج الخطأ B." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "B pairs with B. This must be " "performed from a non-PI futex to a distinct PI futex (or the error B " "results). Additionally, I (the number of waiters to be woken) must be " "1 (or the error B results)." msgstr "" "B يقترن مع B. يجب أن يتم ذلك من " "فوتكس غير PI إلى فوتكس PI متميز (وإلا ستكون النتيجة الخطأ B). " "بالإضافة إلى ذلك، يجب أن يكون I (عدد المنتظرين الذين سيتم إيقاظهم) هو 1 " "(وإلا ستكون النتيجة الخطأ B)." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B (since Linux 2.6.18)" msgstr "B (منذ لينكس 2.6.18)" #. commit c87e2837be82df479a6bae9f155c43516d2feebc #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "This operation is used after an attempt to acquire the lock via an atomic " "user-mode instruction failed because the futex word has a nonzero " "value\\[em]specifically, because it contained the (PID-namespace-specific) " "TID of the lock owner." msgstr "" "تُستخدم هذه العملية بعد فشل محاولة حيازة القفل عبر تعليمات ذرية في وضع " "المستخدم لأن كلمة الفوتكس لها قيمة غير صفرية\\[em]تحديداً، لأنها كانت تحتوي " "على TID (الخاص بنطاق أسماء PID) لمالك القفل." # # # # #. tglx (July 2015): #. The operation here is similar to the FUTEX_WAIT logic. When the user #. space atomic acquire does not succeed because the futex value was non #. zero, then the waiter goes into the kernel, takes the kernel internal #. lock and retries the acquisition under the lock. If the acquisition #. does not succeed either, then it sets the FUTEX_WAITERS bit, to signal #. the lock owner that it needs to go into the kernel. Here is the pseudo #. code: #. lock(kernel_lock); #. retry: #. /* #. * Owner might have unlocked in user space before we #. * were able to set the waiter bit. #. */ #. if (atomic_acquire(futex) == SUCCESS) { #. unlock(kernel_lock()); #. return 0; #. } #. /* #. * Owner might have unlocked after the above atomic_acquire() #. * attempt. #. */ #. if (atomic_set_waiters_bit(futex) != SUCCESS) #. goto retry; #. queue_waiter(); #. unlock(kernel_lock); #. block(); #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "The operation checks the value of the futex word at the address I. " "If the value is 0, then the kernel tries to atomically set the futex value " "to the caller's TID. If the futex word's value is nonzero, the kernel " "atomically sets the B bit, which signals the futex owner that " "it cannot unlock the futex in user space atomically by setting the futex " "value to 0. After that, the kernel:" msgstr "" "تتحقق العملية من قيمة كلمة الفوتكس عند العنوان I. إذا كانت القيمة 0، " "تحاول النواة ضبط قيمة الفوتكس ذرياً على TID الخاص بالمستدعي. إذا كانت قيمة " "كلمة الفوتكس غير صفرية، تقوم النواة بضبط بت B ذرياً، مما يعطي " "إشارة لمالك الفوتكس بأنه لا يمكنه إلغاء قفل الفوتكس في مساحة المستخدم ذرياً " "بضبط قيمة الفوتكس على 0. بعد ذلك، تقوم النواة بما يلي:" #. type: IP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "(1)" msgstr "(1)" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "Tries to find the thread which is associated with the owner TID." msgstr "تحاول العثور على الخيط المرتبط بـ TID للمالك." #. type: IP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "(2)" msgstr "(2)" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "Creates or reuses kernel state on behalf of the owner. (If this is the " "first waiter, there is no kernel state for this futex, so kernel state is " "created by locking the RT-mutex and the futex owner is made the owner of the " "RT-mutex. If there are existing waiters, then the existing state is reused.)" msgstr "" "تنشئ حالة النواة أو تعيد استخدامها نيابة عن المالك. (إذا كان هذا هو المنتظر " "الأول، فلا توجد حالة نواة لهذا الفوتكس، لذا تُنشأ حالة النواة بقفل RT-mutex " "ويتم جعل مالك الفوتكس مالكاً لـ RT-mutex. إذا كان هناك منتظرون موجودون " "بالفعل، فيعاد استخدام الحالة الموجودة.)" #. type: IP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "(3)" msgstr "(3)" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "Attaches the waiter to the futex (i.e., the waiter is enqueued on the RT-" "mutex waiter list)." msgstr "تلحق المنتظر بالفوتكس (أي يتم إدراج المنتظر في صف انتظار RT-mutex)." # #. August 2015: #. mtk: If the realm is restricted purely to SCHED_OTHER (SCHED_NORMAL) #. processes, does the nice value come into play also? #. tglx: No. SCHED_OTHER/NORMAL tasks are handled in FIFO order #. (i.e., task 1 blocks on lock A, held by task 2, #. while task 2 blocks on lock B, held by task 3) #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "If more than one waiter exists, the enqueueing of the waiter is in " "descending priority order. (For information on priority ordering, see the " "discussion of the B, B, and B " "scheduling policies in B(7).) The owner inherits either the waiter's " "CPU bandwidth (if the waiter is scheduled under the B " "policy) or the waiter's priority (if the waiter is scheduled under the " "B or B policy). This inheritance follows the lock " "chain in the case of nested locking and performs deadlock detection." msgstr "" "إذا وجد أكثر من منتظر واحد، يكون إدراج المنتظر في الصف بترتيب تنازلي " "للأولويات. (للحصول على معلومات حول ترتيب الأولويات، راجع مناقشة سياسات " "الجدولة B، و B، و B في B(7)). " "يرث المالك إما عرض النطاق الترددي للمعالج الخاص بالمنتظر (إذا كان المنتظر " "مجدولاً تحت سياسة B) أو أولوية المنتظر (إذا كان المنتظر " "مجدولاً تحت سياسة B أو B). يتبع هذا الميراث سلسلة القفل " "في حالة القفل المتداخل ويقوم باكتشاف الحصر المتبادل (Deadlock)." # # #. 2016-07-07 response from Thomas Gleixner on LKML: #. From: Thomas Gleixner #. Date: 6 July 2016 at 20:57 #. Subject: Re: futex: Allow FUTEX_CLOCK_REALTIME with FUTEX_WAIT op #. On Thu, 23 Jun 2016, Michael Kerrisk (man-pages) wrote: #. > On 06/23/2016 08:28 PM, Darren Hart wrote: #. > > And as a follow-on, what is the reason for FUTEX_LOCK_PI only using #. > > CLOCK_REALTIME? It seems reasonable to me that a user may want to wait a #. > > specific amount of time, regardless of wall time. #. > #. > Yes, that's another weird inconsistency. #. The reason is that phtread_mutex_timedlock() uses absolute timeouts based on #. CLOCK_REALTIME. glibc folks asked to make that the default behaviour back #. then when we added LOCK_PI. #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "The I argument provides a timeout for the lock attempt. If " "I is not NULL, the structure it points to specifies an absolute " "timeout, measured against the B clock. If I is " "NULL, the operation will block indefinitely." msgstr "" "توفر المعطاة I مهلة لمحاولة القفل. إذا كانت I ليست NULL، " "فإن الهيكل الذي تشير إليه يحدد مهلة مطلقة، تُقاس مقابل ساعة " "B. إذا كانت I هي NULL، فستُحصر العملية إلى أجل غير " "مسمى." # #. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "The I, I, and I arguments are ignored." msgstr "تُتجاهل المعطيات I، و I، و I." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B (since Linux 5.14)" msgstr "B (منذ لينكس 5.14)" # #. commit bf22a6976897977b0a3f1aeba6823c959fc4fdae #. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "This operation is the same as B, except that the clock " "against which I is measured is selectable. By default, the " "(absolute) timeout specified in I is measured against the " "B clock, but if the B flag is " "specified in I, then the timeout is measured against the " "B clock." msgstr "" "هذه العملية هي نفسها B، باستثناء أن الساعة التي تُقاس بها " "I قابلة للاختيار. مبدئياً، تُقاس المهلة (المطلقة) المحددة في " "I مقابل ساعة B، ولكن إذا تم تحديد علم " "B في I، فستُقاس المهلة مقابل ساعة " "B." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B (since Linux 2.6.18)" msgstr "B (منذ لينكس 2.6.18)" #. commit c87e2837be82df479a6bae9f155c43516d2feebc #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "This operation tries to acquire the lock at I. It is invoked when a " "user-space atomic acquire did not succeed because the futex word was not 0." msgstr "" "تحاول هذه العملية حيازة القفل عند I. تُستدعى عندما لم تنجح الحيازة " "الذرية في مساحة المستخدم لأن كلمة الفوتكس لم تكن 0." #. Paraphrasing a f2f conversation with Thomas Gleixner about the #. above point (Aug 2015): ### #. There is a rare possibility of a race condition involving an #. uncontended futex with no owner, but with waiters. The #. kernel-user-space contract is that if a futex is nonzero, you must #. go into kernel. The futex was owned by a task, and that task dies #. but there are no waiters, so the futex value is non zero. #. Therefore, the next locker has to go into the kernel, #. so that the kernel has a chance to clean up. (CMXCH on zero #. in user space would fail, so kernel has to clean up.) #. Darren Hart (Oct 2015): #. The trylock in the kernel has more state, so it can independently #. verify the flags that user space must trust implicitly. #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "Because the kernel has access to more state information than user space, " "acquisition of the lock might succeed if performed by the kernel in cases " "where the futex word (i.e., the state information accessible to use-space) " "contains stale state (B and/or B). This " "can happen when the owner of the futex died. User space cannot handle this " "condition in a race-free manner, but the kernel can fix this up and acquire " "the futex." msgstr "" "نظرًا لأن النواة لديها إمكانية الوصول إلى معلومات حالة أكثر من مساحة " "المستخدم، فقد تنجح حيازة القفل إذا قامت بها النواة في الحالات التي تحتوي " "فيها كلمة الفوتكس (أي معلومات الحالة التي يمكن لمساحة المستخدم الوصول إليها) " "على حالة قديمة (B و/أو B). يمكن أن يحدث هذا " "عند وفاة صاحب الفوتكس. لا تستطيع مساحة المستخدم التعامل مع هذه الحالة بطريقة " "خالية من التنافس، ولكن يمكن للنواة إصلاح ذلك وحيازة الفوتكس." # #. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "The I, I, I, and I arguments are ignored." msgstr "تُتجاهل المعطيات I، و I، و I، و I." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B (since Linux 2.6.18)" msgstr "B (منذ لينكس 2.6.18)" #. commit c87e2837be82df479a6bae9f155c43516d2feebc #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "This operation wakes the top priority waiter that is waiting in " "B or B on the futex address provided by the " "I argument." msgstr "" "توقظ هذه العملية المنتظر صاحب الأولوية القصوى الذي ينتظر في B " "أو B على عنوان الفوتكس المقدم بواسطة معطاة I." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "This is called when the user-space value at I cannot be changed " "atomically from a TID (of the owner) to 0." msgstr "" "يُستدعى هذا عندما لا يمكن تغيير القيمة في مساحة المستخدم عند I ذرياً" " من " "TID (للمالك) إلى 0." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B (since Linux 2.6.31)" msgstr "B (منذ لينكس 2.6.31)" #. commit 52400ba946759af28442dee6265c5c0180ac7122 #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "This operation is a PI-aware variant of B. It requeues " "waiters that are blocked via B on I from a non-" "PI source futex (I) to a PI target futex (I)." msgstr "" "هذه العملية هي متغير مدرك لـ PI من B. تعيد وضع المنتظرين " "المحصورين عبر B على I من فوتكس مصدر غير PI‏ " "(I) إلى فوتكس هدف PI‏ (I)." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "As with B, this operation wakes up a maximum of I " "waiters that are waiting on the futex at I. However, for " "B, I is required to be 1 (since the main point is " "to avoid a thundering herd). The remaining waiters are removed from the " "wait queue of the source futex at I and added to the wait queue of " "the target futex at I." msgstr "" "كما هو الحال مع B، توقظ هذه العملية بحد أقصى I من " "المنتظرين الذين ينتظرون على الفوتكس عند I. ومع ذلك، بالنسبة لـ " "B، يجب أن يكون I هو 1 (بما أن الهدف الرئيس هو " "تجنب القطيع الهائج). يُحذف المنتظرون المتبقون من صف انتظار فوتكس المصدر عند " "I ويُضافون إلى صف انتظار فوتكس الهدف عند I." # # #. val2 is the cap on the number of requeued waiters. #. In the glibc pthread_cond_broadcast() implementation, this argument #. is specified as INT_MAX, and for pthread_cond_signal() it is 0. #. The page at http://locklessinc.com/articles/futex_cheat_sheet/ #. notes that "priority-inheritance Futex to priority-inheritance #. Futex requeues are currently unsupported". However, probably #. the page does not need to say nothing about this, since #. Thomas Gleixner commented (July 2015): "they never will be #. supported because they make no sense at all" #. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "The I and I arguments serve the same purposes as for " "B." msgstr "" "تخدم المعطيات I و I نفس الأغراض كما في B." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B (since Linux 2.6.31)" msgstr "B (منذ لينكس 2.6.31)" #. commit 52400ba946759af28442dee6265c5c0180ac7122 #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "Wait on a non-PI futex at I and potentially be requeued (via a " "B operation in another task) onto a PI futex at " "I. The wait operation on I is the same as for B." msgstr "" "ينتظر على futex غير مرتبط بوراثة الأولوية (non-PI) عند I ومن المحتمل " "إعادة وضعه في الطابور (عبر عملية B في مهمة أخرى) على " "futex مرتبط بوراثة الأولوية (PI) عند I. عملية الانتظار على I " "هي نفسها في B." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "The waiter can be removed from the wait on I without requeueing on " "I via a B operation in another task. In this case, the " "B operation fails with the error B." msgstr "" "يمكن إزالة المنتظر من الانتظار على I دون إعادة وضعه في الطابور على " "I عبر عملية B في مهمة أخرى. وفي هذه الحالة، تفشل عملية " "B مع الخطأ B." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "The I argument is ignored." msgstr "يُتجاهل المعطى I." # # # # # #. Darren Hart notes that a patch to allow glibc to fully support #. PI-aware pthreads condition variables has not yet been accepted into #. glibc. The story is complex, and can be found at #. https://sourceware.org/bugzilla/show_bug.cgi?id=11588 #. Darren notes that in the meantime, the patch is shipped with various #. PREEMPT_RT-enabled Linux systems. #. Related to the preceding, Darren proposed that somewhere, man-pages #. should document the following point: #. While the Linux kernel, since Linux 2.6.31, supports requeueing of #. priority-inheritance (PI) aware mutexes via the #. FUTEX_WAIT_REQUEUE_PI and FUTEX_CMP_REQUEUE_PI futex operations, #. the glibc implementation does not yet take full advantage of this. #. Specifically, the condvar internal data lock remains a non-PI aware #. mutex, regardless of the type of the pthread_mutex associated with #. the condvar. This can lead to an unbounded priority inversion on #. the internal data lock even when associating a PI aware #. pthread_mutex with a condvar during a pthread_cond*_wait #. operation. For this reason, it is not recommended to rely on #. priority inheritance when using pthread condition variables. #. The problem is that the obvious location for this text is #. the pthread_cond*wait(3) man page. However, such a man page #. does not currently exist. #. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "The B and B were added to " "support a fairly specific use case: support for priority-inheritance-aware " "POSIX threads condition variables. The idea is that these operations should " "always be paired, in order to ensure that user space and the kernel remain " "in sync. Thus, in the B operation, the user-space " "application pre-specifies the target of the requeue that takes place in the " "B operation." msgstr "" "أُضيفت العمليتان B و B لدعم حالة " "استخدام محددة تمامًا: دعم متغيرات الحالة لخيوط POSIX المدركة لوراثة الأولوية. " "الفكرة هي وجوب إقران هاتين العمليتين دائمًا، لضمان بقاء مساحة المستخدم " "وI<النواة> متزامنتين. وبذلك، يحدد تطبيق مساحة المستخدم مسبقًا في عملية " "B هدف إعادة الاصطفاف الذي يحدث في عملية " "B." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "In the event of an error (and assuming that B() was invoked via " "B(2)), all operations return -1 and set I to indicate the " "error." msgstr "" "في حال حدوث خطأ (وبافتراض استدعاء B عبر B(2))، تعيد جميع " "العمليات -1 وتضبط I للإشارة إلى الخطأ." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "The return value on success depends on the operation, as described in the " "following list:" msgstr "" "تعتمد القيمة المعادة عند النجاح على العملية، كما هو موضح في القائمة التالية:" #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "Returns 0 if the caller was woken up. Note that a wake-up can also be " "caused by common futex usage patterns in unrelated code that happened to " "have previously used the futex word's memory location (e.g., typical futex-" "based implementations of Pthreads mutexes can cause this under some " "conditions). Therefore, callers should always conservatively assume that a " "return value of 0 can mean a spurious wake-up, and use the futex word's " "value (i.e., the user-space synchronization scheme) to decide whether to " "continue to block or not." msgstr "" "تعيد 0 إذا أُوقظ I<المستدعِي>. لاحظ أن الاستيقاظ قد ينتج أيضًا عن أنماط" " استخدام " "futex الشائعة في كود غير ذي صلة تصادف استخدامه سابقًا لموقع ذاكرة كلمة futex " "(على سبيل المثال، يمكن لتطبيقات mutexes خيوط Pthreads التقليدية المعتمدة على " "futex أن تسبب هذا في ظل ظروف معينة). لذا، يجب على I<المستدعِين> دائمًا افتراض " "أن القيمة المعادة 0 قد تعني استيقاظًا زائفًا، واستخدام قيمة كلمة futex (أي " "مخطط التزامن في مساحة المستخدم) لتقرير ما إذا كان سيستمر في الإعاقة أم لا." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "Returns the number of waiters that were woken up." msgstr "تعيد عدد المنتظرين الذين أُوقظوا." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "Returns the new file descriptor associated with the futex." msgstr "تعيد واصف الملف الجديد المرتبط بـ futex." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B" msgstr "B" #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "Returns the total number of waiters that were woken up or requeued to the " "futex for the futex word at I. If this value is greater than " "I, then the difference is the number of waiters requeued to the futex " "for the futex word at I." msgstr "" "تعيد إجمالي عدد المنتظرين الذين أُوقظوا أو أُعيد وضعهم في الطابور لـ futex" " عند " "كلمة futex في I. إذا كانت هذه القيمة أكبر من I، فإن الفرق هو " "عدد المنتظرين الذين أُعيد وضعهم في الطابور لـ futex عند كلمة futex في " "I." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "Returns the total number of waiters that were woken up. This is the sum of " "the woken waiters on the two futexes for the futex words at I and " "I." msgstr "" "تعيد إجمالي عدد المنتظرين الذين أُوقظوا. هذا هو مجموع المنتظرين المستيقظين " "على كلي الـ futexes لكلمتي futex عند I و I." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "Returns 0 if the caller was woken up. See B for how to " "interpret this correctly in practice." msgstr "" "تعيد 0 إذا أُوقظ I<المستدعِي>. انظر B لمعرفة كيفية تفسير ذلك بشكل " "صحيح في الممارسة العملية." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B" msgstr "B" #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "Returns 0 if the futex was successfully locked." msgstr "تعيد 0 إذا وُضع قفل futex بنجاح." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B" msgstr "B" #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B" msgstr "B" #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "Returns 0 if the futex was successfully unlocked." msgstr "تعيد 0 إذا فُك قفل futex بنجاح." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "Returns the total number of waiters that were woken up or requeued to the " "futex for the futex word at I. If this value is greater than " "I, then difference is the number of waiters requeued to the futex for " "the futex word at I." msgstr "" "تعيد إجمالي عدد المنتظرين الذين أُوقظوا أو أُعيد وضعهم في الطابور لـ futex" " عند " "كلمة futex في I. إذا كانت هذه القيمة أكبر من I، فإن الفرق هو " "عدد المنتظرين الذين أُعيد وضعهم في الطابور لـ futex عند كلمة futex في " "I." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B" msgstr "B" # #. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "Returns 0 if the caller was successfully requeued to the futex for the futex " "word at I." msgstr "" "تعيد 0 إذا أُعيد I<المستدعِي> بنجاح إلى طابور futex عند كلمة futex في " "I." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "(B, B, B) The value " "pointed to by I was not equal to the expected value I at the " "time of the call." msgstr "" "(B, B, B) القيمة التي " "يشير إليها I لم تكن مساوية للقيمة المتوقعة I في وقت الاستدعاء." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "B: on Linux, the symbolic names B and B (both of " "which appear in different parts of the kernel futex code) have the same " "value." msgstr "" "B<ملاحظة>: في لينكس، الاسمان الرمزيان B و B (اللذان " "يظهران في أجزاء مختلفة من كود futex في I<النواة>) لهما نفس القيمة." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "(B, B) The value pointed to by " "I is not equal to the expected value I." msgstr "" "(B, B) القيمة التي يشير إليها " "I لا تساوي القيمة المتوقعة I." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "(B, B, B, " "B) The futex owner thread ID of I (for " "B: I) is about to exit, but has not yet " "handled the internal state cleanup. Try again." msgstr "" "(B, B, B, " "B) معرف خيط مالك futex لـ I (بالنسبة لـ " "B: I) على وشك الخروج، لكنه لم يعالج بعد تنظيف " "الحالة الداخلية. حاول مرة أخرى." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "(B, B, B, " "B) The futex word at I is already locked by " "the caller." msgstr "" "(B, B, B, " "B) كلمة futex عند I مقفلة بالفعل من قِبل " "I<المستدعِي>." # #. FIXME . I see that kernel/locking/rtmutex.c uses EDEADLK in some #. places, and EDEADLOCK in others. On almost all architectures #. these constants are synonymous. Is there a reason that both #. names are used? #. tglx (July 2015): "No. We should probably fix that." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "(B) While requeueing a waiter to the PI futex for the " "futex word at I, the kernel detected a deadlock." msgstr "" "(B) أثناء إعادة وضع منتظر في طابور PI futex لكلمة " "futex عند I، اكتشفت I<النواة> حالة تعاجز (deadlock)." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "A required pointer argument (i.e., I, I, or I) did " "not point to a valid user-space address." msgstr "" "معطى مؤشر مطلوب (مثل I أو I أو I) لا يشير إلى عنوان " "صحيح في مساحة المستخدم." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "A B or B operation was interrupted by a " "signal (see B(7)). Before Linux 2.6.22, this error could also be " "returned for a spurious wakeup; since Linux 2.6.22, this no longer happens." msgstr "" "قوطعت عملية B أو B بواسطة إشارة (انظر " "B(7)). قبل إصدار لينكس 2.6.22، كان من الممكن أيضًا إعادة هذا الخطأ " "عند حدوث استيقاظ زائف؛ ومنذ الإصدار 2.6.22، لم يعد هذا يحدث." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "The operation in I is one of those that employs a timeout, but the " "supplied I argument was invalid (I was less than zero, or " "I was not less than 1,000,000,000)." msgstr "" "العملية في I هي واحدة من تلك التي تستخدم مهلة زمنية، لكن معطى " "I المقدم كان غير صالح (I أقل من الصفر، أو I ليس " "أقل من 1,000,000,000)." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "The operation specified in I employs one or both of the pointers " "I and I, but one of these does not point to a valid " "object\\[em]that is, the address is not four-byte-aligned." msgstr "" "تستخدم العملية المحددة في I أحد المؤشرين I و I أو " "كليهما، ولكن أحدهما لا يشير إلى كائن صالح؛ أي أن العنوان غير محاذٍ لأربعة " "بايتات." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "(B, B) The bit mask supplied in " "I is zero." msgstr "" "(B, B) قناع البتات المزود في I " "هو صفر." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "(B) I equals I (i.e., an attempt was " "made to requeue to the same futex)." msgstr "" "(B) I يساوي I (أي جرت محاولة لإعادة " "الاصطفاف في نفس الـ futex)." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "(B) The signal number supplied in I is invalid." msgstr "(B) رقم الإشارة المزود في I غير صالح." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "(B, B, B, B, " "B) The kernel detected an inconsistency between the user-" "space state at I and the kernel state\\[em]that is, it detected a " "waiter which waits in B or B on I." msgstr "" "(B, B, B, B, " "B) اكتشفت I<النواة> تضاربًا بين حالة مساحة المستخدم عند " "I وحالة I<النواة>؛ أي أنها اكتشفت منتظرًا ينتظر في B أو " "B على I." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "(B, B, B, " "B) The kernel detected an inconsistency between the user-" "space state at I and the kernel state. This indicates either state " "corruption or that the kernel found a waiter on I which is waiting " "via B or B." msgstr "" "(B, B, B, " "B) اكتشفت I<النواة> تضاربًا بين حالة مساحة المستخدم عند " "I وحالة I<النواة>. يشير هذا إما إلى فساد في الحالة أو أن I<النواة> " "وجدت منتظرًا على I ينتظر عبر B أو B." #. From a conversation with Thomas Gleixner (Aug 2015): ### #. The kernel sees: I have non PI state for a futex you tried to #. tell me was PI #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "(B) The kernel detected an inconsistency between the " "user-space state at I and the kernel state; that is, the kernel " "detected a waiter which waits via B or B on " "I." msgstr "" "(B) اكتشفت I<النواة> تضاربًا بين حالة مساحة المستخدم " "عند I وحالة I<النواة>؛ أي أن I<النواة> اكتشفت منتظرًا ينتظر عبر " "B أو B على I." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "(B) The kernel detected an inconsistency between the " "user-space state at I and the kernel state; that is, the kernel " "detected a waiter which waits via B or B on " "I." msgstr "" "(B) اكتشفت I<النواة> تضاربًا بين حالة مساحة المستخدم " "عند I وحالة I<النواة>؛ أي أن I<النواة> اكتشفت منتظرًا ينتظر عبر " "B أو B على I." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "(B) The kernel detected an inconsistency between the " "user-space state at I and the kernel state; that is, the kernel " "detected a waiter which waits on I via B or " "B (instead of B)." msgstr "" "(B) اكتشفت I<النواة> تضاربًا بين حالة مساحة المستخدم " "عند I وحالة I<النواة>؛ أي أن I<النواة> اكتشفت منتظرًا ينتظر على " "I عبر B أو B (بدلًا من " "B)." #. This deals with the case: #. wait_requeue_pi(A, B); #. requeue_pi(A, C); #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "(B) An attempt was made to requeue a waiter to a " "futex other than that specified by the matching B " "call for that waiter." msgstr "" "(B) جرت محاولة لإعادة اصطفاف منتظر في futex غير ذلك " "المحدد بواسطة استدعاء B المطابق لهذا المنتظر." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "(B) The I argument is not 1." msgstr "(B) المعطى I ليس 1." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "(B) The system-wide limit on the total number of open files has " "been reached." msgstr "" "(B) وُصل إلى الحد الأقصى لعدد الملفات المفتوحة على مستوى النظام." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "(B, B, B, " "B) The kernel could not allocate memory to hold state " "information." msgstr "" "(B, B, B, " "B) لم تتمكن I<النواة> من تخصيص ذاكرة للاحتفاظ بمعلومات " "الحالة." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "Invalid operation specified in I." msgstr "حددت عملية غير صالحة في I." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "The B option was specified in I, but the " "accompanying operation was neither B, B, " "B, nor B." msgstr "" "حُدد الخيار B في I، ولكن العملية المرافقة لم " "تكن B ولا B ولا B ولا " "B." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "(B, B, B, " "B, B, B) A " "run-time check determined that the operation is not available. The PI-futex " "operations are not implemented on all architectures and are not supported on " "some CPU variants." msgstr "" "(B, B, B, " "B, B, B) حدد " "فحص وقت التشغيل أن العملية غير متاحة. عمليات PI-futex غير مطبقة على جميع " "البنيات وغير مدعومة في بعض متغيرات وحدة المعالجة المركزية." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "(B, B, B, " "B) The caller is not allowed to attach itself to the " "futex at I (for B: the futex at I). " "(This may be caused by a state corruption in user space.)" msgstr "" "(B, B, B, " "B) لا يُسمح لـ I<المستدعِي> بربط نفسه بـ futex عند " "I (بالنسبة لـ B: الـ futex عند I). (قد " "يكون هذا ناتجًا عن فساد الحالة في مساحة المستخدم)." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "(B) The caller does not own the lock represented by the " "futex word." msgstr "(B) I<المستدعِي> لا يملك القفل الذي تمثله كلمة futex." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "(B, B, B, " "B) The thread ID in the futex word at I does " "not exist." msgstr "" "(B, B, B, " "B) معرف الخيط في كلمة futex عند I غير موجود." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "(B) The thread ID in the futex word at I does " "not exist." msgstr "" "(B) معرف الخيط في كلمة futex عند I غير موجود." #. type: TP #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "B" msgstr "B" # #. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "The operation in I employed the timeout specified in I, " "and the timeout expired before the operation completed." msgstr "" "استخدمت العملية في I المهلة الزمنية المحددة في I، وانتهت " "المهلة قبل اكتمال العملية." #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "" "$ B<./futex_demo>\n" "Parent (18534) 0\n" "Child (18535) 0\n" "Parent (18534) 1\n" "Child (18535) 1\n" "Parent (18534) 2\n" "Child (18535) 2\n" "Parent (18534) 3\n" "Child (18535) 3\n" "Parent (18534) 4\n" "Child (18535) 4\n" msgstr "" "$ B<./futex_demo>\n" "Parent (18534) 0\n" "Child (18535) 0\n" "Parent (18534) 1\n" "Child (18535) 1\n" "Parent (18534) 2\n" "Child (18535) 2\n" "Parent (18534) 3\n" "Child (18535) 3\n" "Parent (18534) 4\n" "Child (18535) 4\n" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "" "/* futex_demo.c\n" "\\&\n" " Usage: futex_demo [nloops]\n" " (Default: 5)\n" "\\&\n" " Demonstrate the use of futexes in a program where parent and child\n" " use a pair of futexes located inside a shared anonymous mapping to\n" " synchronize access to a shared resource: the terminal. The two\n" " processes each write \\[aq]num-loops\\[aq] messages to the terminal and" " employ\n" " a synchronization protocol that ensures that they alternate in\n" " writing messages.\n" "*/\n" "#define _GNU_SOURCE\n" "#include Eerr.hE\n" "#include Eerrno.hE\n" "#include Elinux/futex.hE\n" "#include Estdatomic.hE\n" "#include Estdint.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/mman.hE\n" "#include Esys/syscall.hE\n" "#include Esys/time.hE\n" "#include Esys/wait.hE\n" "#include Eunistd.hE\n" "\\&\n" "static uint32_t *futex1, *futex2, *iaddr;\n" "\\&\n" "static int\n" "futex(uint32_t *uaddr, int futex_op, uint32_t val,\n" " const struct timespec *timeout, uint32_t *uaddr2, uint32_t val3)\n" "{\n" " return syscall(SYS_futex, uaddr, futex_op, val,\n" " timeout, uaddr2, val3);\n" "}\n" "\\&\n" "/* Acquire the futex pointed to by \\[aq]futexp\\[aq]: wait for its value to\n" " become 1, and then set the value to 0. */\n" "\\&\n" "static void\n" "fwait(uint32_t *futexp)\n" "{\n" " long s;\n" " const uint32_t one = 1;\n" "\\&\n" " /* atomic_compare_exchange_strong(ptr, oldval, newval)\n" " atomically performs the equivalent of:\n" "\\&\n" " if (*ptr == *oldval)\n" " *ptr = newval;\n" "\\&\n" " It returns true if the test yielded true and *ptr was updated. */\n" "\\&\n" " while (1) {\n" "\\&\n" " /* Is the futex available? */\n" " if (atomic_compare_exchange_strong(futexp, &one, 0))\n" " break; /* Yes */\n" "\\&\n" " /* Futex is not available; wait. */\n" "\\&\n" " s = futex(futexp, FUTEX_WAIT, 0, NULL, NULL, 0);\n" " if (s == -1 && errno != EAGAIN)\n" " err(EXIT_FAILURE, \"futex-FUTEX_WAIT\");\n" " }\n" "}\n" "\\&\n" "/* Release the futex pointed to by \\[aq]futexp\\[aq]: if the futex" " currently\n" " has the value 0, set its value to 1 and then wake any futex waiters,\n" " so that if the peer is blocked in fwait(), it can proceed. */\n" "\\&\n" "static void\n" "fpost(uint32_t *futexp)\n" "{\n" " long s;\n" " const uint32_t zero = 0;\n" "\\&\n" " /* atomic_compare_exchange_strong() was described\n" " in comments above. */\n" "\\&\n" " if (atomic_compare_exchange_strong(futexp, &zero, 1)) {\n" " s = futex(futexp, FUTEX_WAKE, 1, NULL, NULL, 0);\n" " if (s == -1)\n" " err(EXIT_FAILURE, \"futex-FUTEX_WAKE\");\n" " }\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " pid_t childPid;\n" " unsigned int nloops;\n" "\\&\n" " setbuf(stdout, NULL);\n" "\\&\n" " nloops = (argc E 1) ? atoi(argv[1]) : 5;\n" "\\&\n" " /* Create a shared anonymous mapping that will hold the futexes.\n" " Since the futexes are being shared between processes, we\n" " subsequently use the \"shared\" futex operations (i.e., not the\n" " ones suffixed \"_PRIVATE\"). */\n" "\\&\n" " iaddr = mmap(NULL, sizeof(*iaddr) * 2, PROT_READ | PROT_WRITE,\n" " MAP_ANONYMOUS | MAP_SHARED, -1, 0);\n" " if (iaddr == MAP_FAILED)\n" " err(EXIT_FAILURE, \"mmap\");\n" "\\&\n" " futex1 = &iaddr[0];\n" " futex2 = &iaddr[1];\n" "\\&\n" " *futex1 = 0; /* State: unavailable */\n" " *futex2 = 1; /* State: available */\n" "\\&\n" " /* Create a child process that inherits the shared anonymous\n" " mapping. */\n" "\\&\n" " childPid = fork();\n" " if (childPid == -1)\n" " err(EXIT_FAILURE, \"fork\");\n" "\\&\n" " if (childPid == 0) { /* Child */\n" " for (unsigned int j = 0; j E nloops; j++) {\n" " fwait(futex1);\n" " printf(\"Child (%jd) %u\\[rs]n\", (intmax_t) getpid(), j);\n" " fpost(futex2);\n" " }\n" "\\&\n" " exit(EXIT_SUCCESS);\n" " }\n" "\\&\n" " /* Parent falls through to here. */\n" "\\&\n" " for (unsigned int j = 0; j E nloops; j++) {\n" " fwait(futex2);\n" " printf(\"Parent (%jd) %u\\[rs]n\", (intmax_t) getpid(), j);\n" " fpost(futex1);\n" " }\n" "\\&\n" " wait(NULL);\n" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" "/* futex_demo.c\n" "\\&\n" " Usage: futex_demo [nloops]\n" " (Default: 5)\n" "\\&\n" " Demonstrate the use of futexes in a program where parent and child\n" " use a pair of futexes located inside a shared anonymous mapping to\n" " synchronize access to a shared resource: the terminal. The two\n" " processes each write \\[aq]num-loops\\[aq] messages to the terminal and" " employ\n" " a synchronization protocol that ensures that they alternate in\n" " writing messages.\n" "*/\n" "#define _GNU_SOURCE\n" "#include Eerr.hE\n" "#include Eerrno.hE\n" "#include Elinux/futex.hE\n" "#include Estdatomic.hE\n" "#include Estdint.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/mman.hE\n" "#include Esys/syscall.hE\n" "#include Esys/time.hE\n" "#include Esys/wait.hE\n" "#include Eunistd.hE\n" "\\&\n" "static uint32_t *futex1, *futex2, *iaddr;\n" "\\&\n" "static int\n" "futex(uint32_t *uaddr, int futex_op, uint32_t val,\n" " const struct timespec *timeout, uint32_t *uaddr2, uint32_t val3)\n" "{\n" " return syscall(SYS_futex, uaddr, futex_op, val,\n" " timeout, uaddr2, val3);\n" "}\n" "\\&\n" "/* Acquire the futex pointed to by \\[aq]futexp\\[aq]: wait for its value to\n" " become 1, and then set the value to 0. */\n" "\\&\n" "static void\n" "fwait(uint32_t *futexp)\n" "{\n" " long s;\n" " const uint32_t one = 1;\n" "\\&\n" " /* atomic_compare_exchange_strong(ptr, oldval, newval)\n" " atomically performs the equivalent of:\n" "\\&\n" " if (*ptr == *oldval)\n" " *ptr = newval;\n" "\\&\n" " It returns true if the test yielded true and *ptr was updated. */\n" "\\&\n" " while (1) {\n" "\\&\n" " /* Is the futex available? */\n" " if (atomic_compare_exchange_strong(futexp, &one, 0))\n" " break; /* Yes */\n" "\\&\n" " /* Futex is not available; wait. */\n" "\\&\n" " s = futex(futexp, FUTEX_WAIT, 0, NULL, NULL, 0);\n" " if (s == -1 && errno != EAGAIN)\n" " err(EXIT_FAILURE, \"futex-FUTEX_WAIT\");\n" " }\n" "}\n" "\\&\n" "/* Release the futex pointed to by \\[aq]futexp\\[aq]: if the futex" " currently\n" " has the value 0, set its value to 1 and then wake any futex waiters,\n" " so that if the peer is blocked in fwait(), it can proceed. */\n" "\\&\n" "static void\n" "fpost(uint32_t *futexp)\n" "{\n" " long s;\n" " const uint32_t zero = 0;\n" "\\&\n" " /* atomic_compare_exchange_strong() was described\n" " in comments above. */\n" "\\&\n" " if (atomic_compare_exchange_strong(futexp, &zero, 1)) {\n" " s = futex(futexp, FUTEX_WAKE, 1, NULL, NULL, 0);\n" " if (s == -1)\n" " err(EXIT_FAILURE, \"futex-FUTEX_WAKE\");\n" " }\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " pid_t childPid;\n" " unsigned int nloops;\n" "\\&\n" " setbuf(stdout, NULL);\n" "\\&\n" " nloops = (argc E 1) ? atoi(argv[1]) : 5;\n" "\\&\n" " /* Create a shared anonymous mapping that will hold the futexes.\n" " Since the futexes are being shared between processes, we\n" " subsequently use the \"shared\" futex operations (i.e., not the\n" " ones suffixed \"_PRIVATE\"). */\n" "\\&\n" " iaddr = mmap(NULL, sizeof(*iaddr) * 2, PROT_READ | PROT_WRITE,\n" " MAP_ANONYMOUS | MAP_SHARED, -1, 0);\n" " if (iaddr == MAP_FAILED)\n" " err(EXIT_FAILURE, \"mmap\");\n" "\\&\n" " futex1 = &iaddr[0];\n" " futex2 = &iaddr[1];\n" "\\&\n" " *futex1 = 0; /* State: unavailable */\n" " *futex2 = 1; /* State: available */\n" "\\&\n" " /* Create a child process that inherits the shared anonymous\n" " mapping. */\n" "\\&\n" " childPid = fork();\n" " if (childPid == -1)\n" " err(EXIT_FAILURE, \"fork\");\n" "\\&\n" " if (childPid == 0) { /* Child */\n" " for (unsigned int j = 0; j E nloops; j++) {\n" " fwait(futex1);\n" " printf(\"Child (%jd) %u\\[rs]n\", (intmax_t) getpid(), j);\n" " fpost(futex2);\n" " }\n" "\\&\n" " exit(EXIT_SUCCESS);\n" " }\n" "\\&\n" " /* Parent falls through to here. */\n" "\\&\n" " for (unsigned int j = 0; j E nloops; j++) {\n" " fwait(futex2);\n" " printf(\"Parent (%jd) %u\\[rs]n\", (intmax_t) getpid(), j);\n" " fpost(futex1);\n" " }\n" "\\&\n" " wait(NULL);\n" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "I" msgstr "I" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "I" msgstr "I" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "I" msgstr "I" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "I" msgstr "I" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "I" msgstr "I" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "Franke, H., Russell, R., and Kirwood, M., 2002. I (from proceedings of the Ottawa " "Linux Symposium 2002)," msgstr "" "فرانك، هـ.، ورسل، ر.، وكيرود، م.، 2002. I<الضجيج، والـ Futexes والـ " "Furwocks: القفل السريع على مستوى المستخدم في لينكس> (من وقائع ندوة أوتاوا " "للينكس 2002)،" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "E<.UR http://kernel.org\\:/doc\\:/ols\\:/2002\\:/ols2002-pages-479-495.pdf> " "E<.UE>" msgstr "" "E<.UR http://kernel.org\\:/doc\\:/ols\\:/2002\\:/ols2002-pages-479-495.pdf> " "E<.UE>" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "Hart, D., 2009. I, E<.UR http://lwn.net/" "Articles/360699/> E<.UE>" msgstr "" "هارت، د.، 2009. I<نظرة عامة وتحديث حول futex>، E<.UR http://lwn.net/" "Articles/360699/> E<.UE>" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "Hart, D.\\& and Guniguntala, D., 2009. I (from proceedings of the 2009 Real-Time Linux Workshop), E<.UR " "http://lwn.net/images/conf/rtlws11/papers/proc/p10.pdf> E<.UE>" msgstr "" "هارت، د. وغونيغونتالا، د.، 2009. I (من وقائع ورشة عمل لينكس للوقت الحقيقي 2009)، E<.UR http://lwn.net/" "images/conf/rtlws11/papers/proc/p10.pdf> E<.UE>" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "Drepper, U., 2011. I, E<.UR http://www.akkadia.org/" "drepper/futex.pdf> E<.UE>" msgstr "" "دريبر، أ.، 2011. I<الـ Futexes مخادعة>، E<.UR http://www.akkadia.org/drepper/" "futex.pdf> E<.UE>" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "Futex example library, futex-*.tar.bz2 at" msgstr "مكتبة أمثلة Futex،‏ futex-*.tar.bz2 عند" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide msgid "" "E<.UR https://mirrors.kernel.org\\:/pub\\:/linux\\:/kernel\\:/people\\:/" "rusty/> E<.UE>" msgstr "" "E<.UR https://mirrors.kernel.org\\:/pub\\:/linux\\:/kernel\\:/people\\:/" "rusty/> E<.UE>" #. type: TH #: fedora-44 fedora-rawhide #, no-wrap msgid "2024-07-23" msgstr "23 يوليو 2024" #. type: TH #: fedora-44 fedora-rawhide #, no-wrap msgid "Linux man-pages 6.13" msgstr "صفحات دليل لينكس 6.13" #. type: TH #: mageia-cauldron #, no-wrap msgid "2026-02-08" msgstr "8 فبراير 2026" #. type: TH #: mageia-cauldron #, no-wrap msgid "Linux man-pages 6.17" msgstr "صفحات دليل لينكس 6.17" #. type: Plain text #: mageia-cauldron #, no-wrap msgid "" "/* futex_demo.c\n" "\\&\n" " Usage: futex_demo [nloops]\n" " (Default: 5)\n" "\\&\n" " Demonstrate the use of futexes in a program where parent and child\n" " use a pair of futexes located inside a shared anonymous mapping to\n" " synchronize access to a shared resource: the terminal. The two\n" " processes each write \\[aq]num-loops\\[aq] messages to the terminal and" " employ\n" " a synchronization protocol that ensures that they alternate in\n" " writing messages.\n" "*/\n" "#define _GNU_SOURCE\n" "#include Eerr.hE\n" "#include Eerrno.hE\n" "#include Elinux/futex.hE\n" "#include Estdatomic.hE\n" "#include Estdint.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/mman.hE\n" "#include Esys/syscall.hE\n" "#include Esys/time.hE\n" "#include Esys/wait.hE\n" "#include Eunistd.hE\n" "\\&\n" "static uint32_t *futex1, *futex2, *iaddr;\n" "\\&\n" "static int\n" "futex(uint32_t *uaddr, int op, uint32_t val,\n" " const struct timespec *timeout, uint32_t *uaddr2, uint32_t val3)\n" "{\n" " return syscall(SYS_futex, uaddr, op, val,\n" " timeout, uaddr2, val3);\n" "}\n" "\\&\n" "/* Acquire the futex pointed to by \\[aq]futexp\\[aq]: wait for its value to\n" " become 1, and then set the value to 0. */\n" "\\&\n" "static void\n" "fwait(uint32_t *futexp)\n" "{\n" " long s;\n" " const uint32_t one = 1;\n" "\\&\n" " /* atomic_compare_exchange_strong(ptr, oldval, newval)\n" " atomically performs the equivalent of:\n" "\\&\n" " if (*ptr == *oldval)\n" " *ptr = newval;\n" "\\&\n" " It returns true if the test yielded true and *ptr was updated. */\n" "\\&\n" " while (1) {\n" "\\&\n" " /* Is the futex available? */\n" " if (atomic_compare_exchange_strong(futexp, &one, 0))\n" " break; /* Yes */\n" "\\&\n" " /* Futex is not available; wait. */\n" "\\&\n" " s = futex(futexp, FUTEX_WAIT, 0, NULL, NULL, 0);\n" " if (s == -1 && errno != EAGAIN)\n" " err(EXIT_FAILURE, \"futex-FUTEX_WAIT\");\n" " }\n" "}\n" "\\&\n" "/* Release the futex pointed to by \\[aq]futexp\\[aq]: if the futex" " currently\n" " has the value 0, set its value to 1 and then wake any futex waiters,\n" " so that if the peer is blocked in fwait(), it can proceed. */\n" "\\&\n" "static void\n" "fpost(uint32_t *futexp)\n" "{\n" " long s;\n" " const uint32_t zero = 0;\n" "\\&\n" " /* atomic_compare_exchange_strong() was described\n" " in comments above. */\n" "\\&\n" " if (atomic_compare_exchange_strong(futexp, &zero, 1)) {\n" " s = futex(futexp, FUTEX_WAKE, 1, NULL, NULL, 0);\n" " if (s == -1)\n" " err(EXIT_FAILURE, \"futex-FUTEX_WAKE\");\n" " }\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " pid_t childPid;\n" " unsigned int nloops;\n" "\\&\n" " setbuf(stdout, NULL);\n" "\\&\n" " nloops = (argc E 1) ? atoi(argv[1]) : 5;\n" "\\&\n" " /* Create a shared anonymous mapping that will hold the futexes.\n" " Since the futexes are being shared between processes, we\n" " subsequently use the \"shared\" futex operations (i.e., not the\n" " ones suffixed \"_PRIVATE\"). */\n" "\\&\n" " iaddr = mmap(NULL, sizeof(*iaddr) * 2, PROT_READ | PROT_WRITE,\n" " MAP_ANONYMOUS | MAP_SHARED, -1, 0);\n" " if (iaddr == MAP_FAILED)\n" " err(EXIT_FAILURE, \"mmap\");\n" "\\&\n" " futex1 = &iaddr[0];\n" " futex2 = &iaddr[1];\n" "\\&\n" " *futex1 = 0; /* State: unavailable */\n" " *futex2 = 1; /* State: available */\n" "\\&\n" " /* Create a child process that inherits the shared anonymous\n" " mapping. */\n" "\\&\n" " childPid = fork();\n" " if (childPid == -1)\n" " err(EXIT_FAILURE, \"fork\");\n" "\\&\n" " if (childPid == 0) { /* Child */\n" " for (unsigned int j = 0; j E nloops; j++) {\n" " fwait(futex1);\n" " printf(\"Child (%jd) %u\\[rs]n\", (intmax_t) getpid(), j);\n" " fpost(futex2);\n" " }\n" "\\&\n" " exit(EXIT_SUCCESS);\n" " }\n" "\\&\n" " /* Parent falls through to here. */\n" "\\&\n" " for (unsigned int j = 0; j E nloops; j++) {\n" " fwait(futex2);\n" " printf(\"Parent (%jd) %u\\[rs]n\", (intmax_t) getpid(), j);\n" " fpost(futex1);\n" " }\n" "\\&\n" " wait(NULL);\n" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" "/* futex_demo.c\n" "\\&\n" " Usage: futex_demo [nloops]\n" " (Default: 5)\n" "\\&\n" " Demonstrate the use of futexes in a program where parent and child\n" " use a pair of futexes located inside a shared anonymous mapping to\n" " synchronize access to a shared resource: the terminal. The two\n" " processes each write \\[aq]num-loops\\[aq] messages to the terminal and" " employ\n" " a synchronization protocol that ensures that they alternate in\n" " writing messages.\n" "*/\n" "#define _GNU_SOURCE\n" "#include Eerr.hE\n" "#include Eerrno.hE\n" "#include Elinux/futex.hE\n" "#include Estdatomic.hE\n" "#include Estdint.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/mman.hE\n" "#include Esys/syscall.hE\n" "#include Esys/time.hE\n" "#include Esys/wait.hE\n" "#include Eunistd.hE\n" "\\&\n" "static uint32_t *futex1, *futex2, *iaddr;\n" "\\&\n" "static int\n" "futex(uint32_t *uaddr, int op, uint32_t val,\n" " const struct timespec *timeout, uint32_t *uaddr2, uint32_t val3)\n" "{\n" " return syscall(SYS_futex, uaddr, op, val,\n" " timeout, uaddr2, val3);\n" "}\n" "\\&\n" "/* Acquire the futex pointed to by \\[aq]futexp\\[aq]: wait for its value to\n" " become 1, and then set the value to 0. */\n" "\\&\n" "static void\n" "fwait(uint32_t *futexp)\n" "{\n" " long s;\n" " const uint32_t one = 1;\n" "\\&\n" " /* atomic_compare_exchange_strong(ptr, oldval, newval)\n" " atomically performs the equivalent of:\n" "\\&\n" " if (*ptr == *oldval)\n" " *ptr = newval;\n" "\\&\n" " It returns true if the test yielded true and *ptr was updated. */\n" "\\&\n" " while (1) {\n" "\\&\n" " /* Is the futex available? */\n" " if (atomic_compare_exchange_strong(futexp, &one, 0))\n" " break; /* Yes */\n" "\\&\n" " /* Futex is not available; wait. */\n" "\\&\n" " s = futex(futexp, FUTEX_WAIT, 0, NULL, NULL, 0);\n" " if (s == -1 && errno != EAGAIN)\n" " err(EXIT_FAILURE, \"futex-FUTEX_WAIT\");\n" " }\n" "}\n" "\\&\n" "/* Release the futex pointed to by \\[aq]futexp\\[aq]: if the futex" " currently\n" " has the value 0, set its value to 1 and then wake any futex waiters,\n" " so that if the peer is blocked in fwait(), it can proceed. */\n" "\\&\n" "static void\n" "fpost(uint32_t *futexp)\n" "{\n" " long s;\n" " const uint32_t zero = 0;\n" "\\&\n" " /* atomic_compare_exchange_strong() was described\n" " in comments above. */\n" "\\&\n" " if (atomic_compare_exchange_strong(futexp, &zero, 1)) {\n" " s = futex(futexp, FUTEX_WAKE, 1, NULL, NULL, 0);\n" " if (s == -1)\n" " err(EXIT_FAILURE, \"futex-FUTEX_WAKE\");\n" " }\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " pid_t childPid;\n" " unsigned int nloops;\n" "\\&\n" " setbuf(stdout, NULL);\n" "\\&\n" " nloops = (argc E 1) ? atoi(argv[1]) : 5;\n" "\\&\n" " /* Create a shared anonymous mapping that will hold the futexes.\n" " Since the futexes are being shared between processes, we\n" " subsequently use the \"shared\" futex operations (i.e., not the\n" " ones suffixed \"_PRIVATE\"). */\n" "\\&\n" " iaddr = mmap(NULL, sizeof(*iaddr) * 2, PROT_READ | PROT_WRITE,\n" " MAP_ANONYMOUS | MAP_SHARED, -1, 0);\n" " if (iaddr == MAP_FAILED)\n" " err(EXIT_FAILURE, \"mmap\");\n" "\\&\n" " futex1 = &iaddr[0];\n" " futex2 = &iaddr[1];\n" "\\&\n" " *futex1 = 0; /* State: unavailable */\n" " *futex2 = 1; /* State: available */\n" "\\&\n" " /* Create a child process that inherits the shared anonymous\n" " mapping. */\n" "\\&\n" " childPid = fork();\n" " if (childPid == -1)\n" " err(EXIT_FAILURE, \"fork\");\n" "\\&\n" " if (childPid == 0) { /* Child */\n" " for (unsigned int j = 0; j E nloops; j++) {\n" " fwait(futex1);\n" " printf(\"Child (%jd) %u\\[rs]n\", (intmax_t) getpid(), j);\n" " fpost(futex2);\n" " }\n" "\\&\n" " exit(EXIT_SUCCESS);\n" " }\n" "\\&\n" " /* Parent falls through to here. */\n" "\\&\n" " for (unsigned int j = 0; j E nloops; j++) {\n" " fwait(futex2);\n" " printf(\"Parent (%jd) %u\\[rs]n\", (intmax_t) getpid(), j);\n" " fpost(futex1);\n" " }\n" "\\&\n" " wait(NULL);\n" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" #. type: TH #: opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Linux man-pages (unreleased)" msgstr "صفحات دليل لينكس (لم تصدر بعد)"