[Sussex] the who/what/why/when of processes ( proc-i ? ;)

Geoff Teale Geoff.Teale at claybrook.co.uk
Thu Sep 5 12:08:00 UTC 2002


Dunk,

If you're C is upto scratch then this page is a good example.  It starts
with a program that does exactly the same as you PHP script.

http://www-h.eng.cam.ac.uk/help/tpl/unix/fork.html

As far as handling multiple connections is concerned.  Well, this is
something Steve is going to be dealing with in INSIDE so it may be wise to
have a word with him. 

THe simplest approach is to have a parent that forks every time it recieves
a request.  This isn't the most efficient way of doing things however -
starting new processes is quite "heavy" - for this reason a lot of systems
use threads instead (this creates a whole bundle of other problems
especially in the use of shared memory).

Another approach is some sort of pre-emptive process creation.  Some servers
launch processes in waiting so they are ready ahead of requests (thus
servicing the request more quickly).

For a good example of such a program why not take a little look at the
Apache docs, I'm sure somewhere it will discuss they're approach which has
been pretty damn succesful.

One good thing about Posix Forking is that it is the same across all
languages, C/C++, Bash Scripts.. everything.. it always works pretty much
identically.

-- 
Geoff Teale
geoff.teale at claybrook.co.uk
 


The above information is confidential to the addressee and may be privileged.  Unauthorised access and use is prohibited.
 
Internet communications are not secure and therefore this Company does not accept legal responsibility for the contents of this message.
 
If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful.
 
Claybrook Computing Limited is a subsidiary of Claybrook Computing (Holdings) Limited
Registered Office: Abbey House. 282 Farnborough Road, Farnborough, Hampshire GU14 7NJ
Registered in England and Wales No 1287205
 
A Hogg Robinson plc company





More information about the Sussex mailing list