![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how would you solve this problem? | soemac | UNIX for Advanced & Expert Users | 7 | 03-29-2008 05:29 PM |
| How to solve restarting problem | akzin | UNIX for Advanced & Expert Users | 2 | 06-13-2007 05:28 AM |
| Can any one solve this Problem...!!! | Baba B. Saheb | High Level Programming | 9 | 10-10-2005 09:42 PM |
| can't solve that problem [PLEASE HELP] | AiRkO | UNIX for Advanced & Expert Users | 2 | 01-22-2004 10:31 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
I'm now designing a server application which can serve large number of clients' request. I've a question to ask, that is, main process will block when invoke the "accept" function, if a client request comes, main process should be separated into 2 processes by invoking "fork" function, the parent goes on with accept function, the child to serve the connected client's request. My question is, if there are large number of clients want to get connected with the server, the server application should be forked many times, is this harmful to our server resources?
|
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
In case a thread library is available on your system, you may wish to use it instead of fork()ing because process switching is a more resource intensive than that of threads.
|
|
#3
|
|||
|
|||
|
Thank you for your answering
I've got your answer and now I want to make the confirmation. You mean that I should use thread instead of process to deal with clients' request, is that right?
|
|
#4
|
|||
|
|||
|
Correct. But be sure to use POSIX threads (Pthreads)
There are plenty of examples available on the Web showing how to use POSIX pthreads to listen for and handle incoming connections. - Finnbarr |
|
#5
|
|||
|
|||
|
Thank you for your reply
Roger that.
If you have interest in Threading process, we can discuss the ThreadPool architecture. You can contact me via email. My address is acqy@163.com, by the way, I'm also a novice. |
|||
| Google The UNIX and Linux Forums |