troubleshooting Question

ABout Multi-Threading Programming.

Avatar of benson031397
benson031397 asked on
Linux OS Dev
7 Comments1 Solution214 ViewsLast Modified:
Dear sir,

I would like to write a daemon process which use multi-threading techniques.
Scenario :
Asuume the program name is thread_test.
Actually, I use accept(...) to wait for the client request.  When the accept(...) function receive the client request, accept(...) will return back and call the next line, pthread_create(...) to create a new thread to do something for the client.

However, as the new thread is still running, I go to another console to type command 'ps',  I am surprised that there are three copies of thread_test process which is running.  Actually, I expect there are only two copies of thread_test process is running, one is main thread and the other is so-called child thread.  However, right now, why there is third thread exist?

Can anyone help me to indicate what the problem is?


Thanks a lot
Benson
ASKER CERTIFIED SOLUTION
bryanh

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros