Threads FAQ
June 10th, 2005 by Bryan O'Sullivan
Because I maintain this FAQ with blogging software, the most recently edited item tends to float to the top. If you want to browse a table of contents in “semi-sane” order, here it is.
This page has the following sub pages.
- About the multithreaded programming FAQ
- Asynchronous thread cancellation [Unix]
- After I create a certain number of threads, my program crashes [Unix]
- A glossary of terms used in threaded programming
- The history of threads
- How can I perform a join on any non-specific thread? [Unix]
- Why are reentrant library and system call interfaces good?
- Mixing threads and signals [Unix]
- What are the main families of threads?
- What is a thread?
hi ,
thanks
how i know if a thread finish?
There’s one special secret Sale link on Amazon:
http://tinyurl.com/2r7ldr
This is open every Friday and ONLY on Fridays!
You can find very good discounts here, although some Fridays you can really get
lucky and make off like an Amazon bandit - I´ve seen discounts there as low as 75%
off sticker Price.
Hey there
I am new to the subject of thread. Can someone tell me why is the average time that using pthread_create() to creat a thread is shorter than using fork() to create a process?
My thought is that because parent process has to wait for each child process. On the other hand, thr_create.c includes which only needs to wait for the last thread. Am I correct?
Hi Benson,
Threads are faster than a fork() because their overhead is much smaller, as they share the same memory space than their creator. This is why it takes about 30 times less time to create a pthread than fork the current process.
As for the parent waiting for the children to terminate, it’s up to you. If you create your threads “detached”, they will liberate their own memory space automatically as they terminate. Otherwise, you have to join in order for the threads to return their memory to the heap cleanly.
, , 3gp .
,
discount laptops