Source string Read only

(itstool) path: sect3/para
358/3580
Context English State
Threaded programs should be written with as little contention on locks as possible. Otherwise, instead of doing useful work the thread just waits on a lock. Because of this, the most well written threaded programs show little locks contention.
Futexes introduction
<trademark class="registered">Linux</trademark> implements 1:1 threading, i.e. it has to use in-kernel synchronization primitives. As stated earlier, well written threaded programs have little lock contention. So a typical sequence could be performed as two atomic increase/decrease mutex reference counter, which is very fast, as presented by the following example:
pthread_mutex_lock(&amp;mutex);
....
pthread_mutex_unlock(&amp;mutex);
1:1 threading forces us to perform two syscalls for those mutex calls, which is very slow.
The solution <trademark class="registered">Linux</trademark> 2.6 implements is called futexes. Futexes implement the check for contention in userspace and call kernel primitives only in a case of contention. Thus the typical case takes place without any kernel intervention. This yields reasonably fast and flexible synchronization primitives implementation.
Futex API
The futex syscall looks like this:
int futex(void *uaddr, int op, int val, struct timespec *timeout, void *uaddr2, int val3);
In this example <varname>uaddr</varname> is an address of the mutex in userspace, <varname>op</varname> is an operation we are about to perform and the other parameters have per-operation meaning.
Futexes implement the following operations:

Loading…

None

New source string

FreeBSD Doc / articles_linux-emulationEnglish

New source string 3 months ago
Browse all component changes

Things to check

Long untranslated

The string was not translated for a long time

Reset

Glossary

English English
No related strings found in the glossary.

Source information

Source string comment
(itstool) path: sect3/para
Labels
No labels currently set.
Flags
read-only
Source string location
article.translate.xml:2024
Source string age
3 months ago
Translation file
, string 294