Click here to Skip to main content
15,891,375 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hey,
I am working on a udp client-server application where one server is supposed to handle 40 clients which could all be logged on at once as well...
Now in "unix" such issues are resolved by using "fork()" function which basically creates a child process to deal with the client and leaves the server to accept new connections...
I searched on the internet and found out that an exact analogous of "fork()" is not available in windows, however "CreateProcess()" could be used...
My previous research also introduced me to "thread pool" so now I've two questions:
1)Could I acheive the functionality of "fork()" by "CreateProcess()" in windows.
2)if this is possible,what should I do go for: threadpool or creating multiple processes ?

looking forward to the response...
Posted

1 solution

(1) Both CreateProcess and fork creates a new process. However fork duplicates the calling process, while CreateProcess starts an executable. Both function allows the implementation of a multiprocess server.

(2) Usually such servers are multithreaded, however nothing prevents you to make it multiprocess instead.
Just be aware that inter-process communication is heavier.
 
Share this answer
 
Comments
Aayman Khalid 18-Apr-13 5:58am    
So that means I should go for threadpool in order to save the processing power?
CPallini 18-Apr-13 6:08am    
You might. Have a look at this page: http://www.zerigo.com/article/apache_multi-threaded_vs_multi-process_pre-forked/

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900