NPTL和POSIX线程之间有什么区别? [英] What is the difference between NPTL and POSIX threads?
问题描述
NPTL和POSIX线程之间的基本区别是什么?这两个是如何演变的?
What is the basic difference between NPTL and POSIX threads? How have these two evolved?
推荐答案
POSIX线程(pthread)不是实现,它是API函数规范(纸上标准,英文,英文),多个函数的名称以pthread_
,并且在<pthread.h>
标头中定义. POSIX也是一组规范.
POSIX threads (pthread) is not an implementation, it is a API specification (a standard, on paper, in english) of several functions whose name starts with pthread_
and which are defined in <pthread.h>
header. POSIX is also a set of specifications.
NPTL现在位于Linux上的 GNU Libc 中,并且是(或至少非常努力地)实现POSIX线程.它是Linux系统上的一堆源代码和二进制代码.
使用gcc -pthread
编译并与-pthread
链接的应用程序现在在Linux上使用NPTL代码.
NPTL is now inside GNU Libc on Linux and is (or at least tries very hard to be) an implementation of POSIX threads. It is a bunch of source and binary code on your Linux system.
An application compiled with gcc -pthread
and linked with -pthread
uses NPTL code on Linux today.
存在pthread
-s的替代实现:在Linux上, MUSL Libc 旨在与Posix兼容(表示具有pthreads);在其他Posix系统(AIX,Solaris等)上,您也具有pthread(但它们不是NPTL或Glibc).
There exist alternative implementations of pthread
-s: on Linux, the MUSL Libc aims to be Posix compliant (which means having pthreads); on other Posix systems (AIX, Solaris, ...) you also have pthreads (but they are not NPTL or Glibc).
这篇关于NPTL和POSIX线程之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!