Fiber (computer science)

As a user thread (also written user thread ), sometimes also called user-level thread and for example under Windows Fiber (see below), is called to run interlocked in a certain type of computer science, programs or program parts. The functionality is not directly implemented in the kernel ( as a kernel thread ), but in a separate program library, which is located in the userspace. Thus, a context switch (task switching) between the user thread without expensive system calls is possible, so context switches are much faster than between kernel threads or processes.

Scheduling

Since the User threads within a kernel thread in principle not the same ( ( pseudo) parallel), but can only be executed in sequence, the user threads can not be reasonably distributed across multiple processors. Because the operating system is unaware of the existence of user threads, the scheduling ( timing ) of the user threads must be done by the program itself or from the program library used. It almost always cooperative scheduling is operated and non- preemptive (of English. Preemptive, preferential debts '). The user threads must therefore automatically deliver the control. However, this is problematic if one of the user thread makes a blocking system call. The fact that this user thread is blocked, it is impossible for him to give up control to another user thread - this way the entire program is blocked. This problem can be circumvented by the shared library to the user thread provides replacement functions. The library then only uses non-blocking system calls to the operating system, which must provide this.

Other perspective

The concept of the user threads can be seen as an extension of the concepts of procedures or functions in appropriate programming languages. A user thread corresponds according to this view, a procedure that is called from another location (via the explicit scheduling exactly this user threads). However, such a procedure returns is not necessarily at a single point on the control flow of the caller back, but rather can also more than once and at different places " return " on their self -run by scheduling. This view is also reflected in the way resist, such as user threads are declared in some systems - namely, as a separate procedure each user thread.

Implementations

User - threaded libraries are under many operating systems available, but also interpreter can support user threads. Here, the naming of the user threads differs depending on the implementation.

Windows

Microsoft calls of her offered by Windows (since Windows 98 ) User threads Fibers. The English word fiber (German, fiber '→ Fiber ') can here as a reference to the natural relation of a thread (English ) - that is, a thread - are understood to a fiber / fiber: A fiber / fiber thinner and easier than a thread (thread); a thread may be spun from a plurality of individual fibers.

Linux

User threads provide Linux as the LinuxThreads libraries and GNU Portable Threads. LinuxThreads is, however, no longer being developed, and his successor Native POSIX Thread Library ( NPTL ) is not a pure userspace library more.

Solaris

The naming convention for Solaris is different from the Windows and Linux. A kernel thread is here as a lightweight process (English; , lightweight process ' → see Thread ( computer science ) ) referred to and a user - thread simply called thread. A Solaris thread can be allocated to other lightweight processes the same process.

Java Virtual Machine

Use newer versions of the Java Virtual Machine (JVM), if any, to provide the capabilities of the local operating system to the programmer threads available. In older versions, or if the operating system kernel threads is not supported, but the JVM has its own user -thread functionality. This is referred to as a green thread. Green threads are real users, threads, while still providing preemptive, priority-based scheduling, which is implemented by the JVM.

333458
de