Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道这一点,是不是因为它们只需要一个堆栈和寄存器存储,所以它们的创建成本很低?
非常感谢 :)
fork()必须克隆整个进程及其所有相关的内核数据结构,包括文件句柄、内存等。尽管这可以通过设置适当的写时复制标志来懒惰地完成,但这比创建一个新线程要多得多,它只共享相同的文件句柄和内存。
fork()