当前位置: 技术问答>linux和unix
linux中的fork是创建进程还是线程?
来源: 互联网 发布时间:2017-05-13
本文导语: linux操作系统中,我认为fork是创建线程,exec之后就是进程了。 而同事说fork是创建进程,pthread是线程。 | NAME fork - create a child process SYNOPSIS #include pid_t fork(void); DES...
linux操作系统中,我认为fork是创建线程,exec之后就是进程了。
而同事说fork是创建进程,pthread是线程。
而同事说fork是创建进程,pthread是线程。
|
NAME
fork - create a child process
SYNOPSIS
#include
pid_t fork(void);
DESCRIPTION
fork() creates a new process by duplicating the calling process. The new process, referred to as the child, is an exact duplicate
of the calling process, referred to as the parent, except for the following points:
fork - create a child process
SYNOPSIS
#include
pid_t fork(void);
DESCRIPTION
fork() creates a new process by duplicating the calling process. The new process, referred to as the child, is an exact duplicate
of the calling process, referred to as the parent, except for the following points:
|
man fork
|
有的是有的不是
比如
Multithreading (see pthreads(7))
The strerror() function is not thread-safe.
The strerror_r() function is thread-safe.
|
fork()函数是用来创建子进程的,,,pthread_create()是用来创建线程的
|
pthread_create 也是call fork 族的函数实现的,so。。。
|
linux程序设计第四版 人民邮电出版社
|
fork是创建进程,pthread是线程。
|
是否线程安全要看具体的函数