gpt4 book ai didi

multithreading - 什么是线程?

转载 作者:行者123 更新时间:2023-12-05 01:10:15 26 4
gpt4 key购买 nike

我对“pthread”和“thread”的概念感到困惑。我知道 pthread 是 POSIX 线程的缩写形式,它是 UNIX 中使用的一种标准化线程。但是人们经常使用“线程”来指代一个线程。 pthread 和线程等效吗?还是 pthread 只是 UNIX 中使用的线程的名称?
提前致谢。

最佳答案

线程是一个通用的概念。 Wikipedia defines it as :

In computer science, a thread of execution is the smallest sequence of programmed instructions that can be managed independently by an operating system scheduler. A thread is a light-weight process.


Pthreads 或 POSIX threads是在 Unix 上与 C 程序一起使用的概念的一种实现。大多数现代语言都有自己的线程实现。从那个网页:

Pthreads are defined as a set of C language programming types and procedure calls, implemented with a pthread.h header/include file and a thread library - though this library may be part of another library, such as libc, in some implementations.

关于multithreading - 什么是线程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15127279/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com