Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Re: Re: On timely destruction?

by PhiRatE (Monk)
on Aug 29, 2002 at 11:18 UTC ( [id://193733]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: On timely destruction?
in thread On timely destruction?

I offer a way-out suggestion just for the hell of it:

It is clear that the non-timeliness of destruction only becomes an issue when an item of some kind of scarcity is held by the relevant object.

In your example above, the item in question is a lock on a file, in other cases it is a database handle, in other cases it will be some other resource.

We can solve *part* of the problem (short of refcounting) by registering such contentious resources internally. Thus, rather than closing the filehandle at the right time above, we would instead have the second open say "I wish to register my interest in a file lock on this file" at which point the registry will say "well shit, someone else already has that, lemme check if I should run a gc".

Its not a particularly pretty concept in that it requires much determining of, and registering likely contentious resources, however due to the nature of the parrot design you may find that it fits quite well as a middle-ground solution, preventing close timing issues within the same instance (although obviously distinct processes will not benefit).

Replies are listed 'Best First'.
Re: Re: Re: Re: On timely destruction?
by Elian (Parson) on Aug 29, 2002 at 20:01 UTC
    We've talked about having some sort of immediate resource registry that would be checked at some defined interval (block exit, sub exit, sub entry, something like that) and trigger a sweep for dead objects if there were any registered. While it's more expensive than truly on-demand collection, it provides some minimum guarantees on the lifetime of potentially transient objects without too much overhead or potential for bugs in the source.

    It shouldn't be that bad as far as code goes as usually there's not much in the way of truly contentious resources in use. (Though I suppose some folks might disagre)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2024-04-19 09:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found