Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: Using fork with DBI to create simultaneous db connections.

by etcshadow (Priest)
on Feb 08, 2005 at 00:34 UTC ( [id://428931]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re^2: Using fork with DBI to create simultaneous db connections.
in thread Using fork with DBI to create simultaneous db connections.

Actually, that's incorrect, and it's probably the same mistake that the original poster made. The flaw is that the memory address shown as part of the stringification of the reference is the *relative* memory address to that process. The operating system uses something called "virtual memory", which abstracts the actual *physical* memory location away from your processes. In truth, the physical memory addresses may change from time to time, as your process is swapped and paged and so on.

Anyway, here's a quick demo:

prompt> perl -le 'my $pid = fork; my $x = [$pid]; print "$x->[0] -- $x +"' 0 -- ARRAY(0x80d11ec) 24694 -- ARRAY(0x80d11ec) prompt>
You can see that each process has it's own array, with the reference stored in $x, yet in both processes, the memory address appears the same.
------------ :Wq Not an editor command: Wq

Replies are listed 'Best First'.
Re^4: Using fork with DBI to create simultaneous db connections.
by thor (Priest) on Feb 08, 2005 at 07:46 UTC
    Hell...I learned something. Not that that's bad...I just don't like being wrong. :)

    thor

    Feel the white light, the light within
    Be your own disciple, fan the sparks of will
    For all of us waiting, your kingdom will come

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://428931]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.