FazBrowse Wikipedia Viewer | Main Page |
Search Wikipedia:
|
Viewing: https://en.wikipedia.org/wiki/POSIX_Threads

pthreads

Contents
POSIX Threads for Windows
See also
References
External links

In computing, POSIX Threads, commonly known as pthreads (after its header <pthread.h>), is an execution model that exists independently from a programming language, as well as a parallel execution model. It allows a program to control multiple different flows of work that overlap in time. Each flow of work is referred to as a thread, and creation and control over these flows is achieved by making calls to the POSIX Threads API. POSIX Threads is an API defined by the Institute of Electrical and Electronics Engineers (IEEE) standard POSIX.1c, Threads extensions (IEEE Std 1003.1c-1995).

Implementations of the API are available on many Unix-like POSIX-conformant operating systems such as FreeBSD, NetBSD, OpenBSD, Linux, macOS, Android, Solaris, Redox, QNX, and AUTOSAR Adaptive, typically bundled as a library libpthread. DR-DOS and Microsoft Windows implementations also exist: within the SFU/SUA subsystem which provides a native implementation of a number of POSIX APIs, and also within third-party packages such as pthreads-w32, which implements pthreads on top of existing Windows API.

In main: Creating thread 0. In main: Creating thread 1. In main: Creating thread 2. In main: Creating thread 3. Thread 0: Started. In main: Creating thread 4. Thread 3: Started. Thread 2: Started. Thread 0: Will be sleeping for 3 seconds. Thread 1: Started. Thread 1: Will be sleeping for 5 seconds. Thread 2: Will be sleeping for 4 seconds. Thread 4: Started. Thread 4: Will be sleeping for 1 seconds. In main: All threads are created. Thread 3: Will be sleeping for 4 seconds. Thread 4: Ended. Thread 0: Ended. In main: Thread 0 has ended. Thread 2: Ended. Thread 3: Ended. Thread 1: Ended. In main: Thread 1 has ended. In main: Thread 2 has ended. In main: Thread 3 has ended. In main: Thread 4 has ended. Main program has ended.

POSIX Threads for Windows

edit

Windows does not support the pthreads standard natively; therefore, the Pthreads4w project seeks to provide a portable and open-source wrapper implementation. It can also be used to port Unix software (which uses pthreads) with little or no modification to the Windows platform. Pthreads4w version 3.0.0 or later, released under the Apache Public License v2.0, is compatible with 64-bit or 32-bit Windows systems. Version 2.11.0, released under the LGPLv3 license, is also 64-bit or 32-bit compatible.

The Mingw-w64 project also contains a wrapper implementation of 'pthreads, winpthreads, which tries to use more native system calls than the Pthreads4w project.

Interix environment subsystem available in the Windows Services for UNIX/Subsystem for UNIX-based Applications package provides a native port of the pthreads API, i.e. not mapped on Win32 API but built directly on the operating system syscall interface.

See also

edit

References

edit
    "pthread.h(0p) — Linux manual page". Retrieved 18 December 2022.
  1. ↑ David R. Butenhof (1997). Programming with POSIX Threads. Addison-Wesley. ISBN 978-0-201-63392-4.
  2. Kay A. Robbins & Steven Robbins (2003). UNIX Systems Programming. Prentice-Hall. ISBN 978-0-13-042411-2.
  3. External links

    edit
    Parallel computing
    General
    Levels
    Multithreading
    Theory
    Elements
    Coordination
    Programming
    Hardware
    APIs
    Problems

    View original on Wikipedia | Back | FazBrowse Home