[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to spawn a server?



On Mon, 9 Sep 2002, Francesco Orsenigo wrote:

> I was thinking to pipe(), socketpair() and then fork() only when i really 
> need a server, but i don't know how does fork() works...
> If I fork() a program with lots af allocated memory, low-level hardware 
> access, and lots of open descriptors, all this will be copied?

I am pretty sure, at least on linux, fork works with "copy on write" 
semantics. That is, stuff will be copied, but not before you actually 
write to it. So, read only stuff, like maps, textures, etc, will never be 
copied.

Mads

-- 
Mads Bondo Dydensborg.                               madsdyd@challenge.dk
Before we'd usually say, there is a deep rumbling sound of penguins. Now
it's time to begin with: The earth is quaking, hell yeah the penguins are 
here!!