Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: WHY copying does happen (fork)

by stiller (Friar)
on May 07, 2008 at 05:27 UTC ( #685145=note: print w/ replies, xml ) Need Help??


in reply to WHY copying does happen (fork)

Do you read the data in before or after forking? I haven't used shared memory directly, so I might be way off here, but I thought that you would have to fork first, then build up the shared data between the processes?


Comment on Re: WHY copying does happen (fork)
Re^2: WHY copying does happen (fork)
by Anonymous Monk on May 07, 2008 at 14:34 UTC
    i read the data in BEFORE forking.
    when you fork, each thread is a kind of replication of the original. via copyOnWrite the original data is shared. if one fork writes, it creates a copy of the original data and does its modifications. So no other fork can see the modification. sharing the data between different forks is expensive and slow
    my idea was that since I only read the operating system shouldn't need to create copies (slow and requires memory), but after reading the answers here it seems that even with readOnly perl does enough writing to the data to let the OS start the copying :(
    thats not nice but I guess I have to live with that and find other solutions like the in memory databases mentioned...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://685145]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (17)
As of 2014-12-18 18:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (59 votes), past polls