سؤال

I was wondering this, is it because they only need a stack and storage for registers so they are cheap to create ?

Thanks a lot :)

هل كانت مفيدة؟

المحلول

fork() has to clone the entire process and all its associated kernel data structures, including file handles, memory, and so forth. Though this might be done lazily by setting appropriate copy-on-write flags, it is a lot more work than creating a new thread, which just shares the same file handles and memory.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top