You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Ben Collins-Sussman <su...@newton.collab.net> on 2000/12/13 19:19:02 UTC
dso alternative
Or, perhaps this whole idea of "sharing" already-loaded RA libraries
is silly. Each process, when it needs an RA library, can just
explicitly load it and keep a private copy of the vtable.
I mean, don't modern operating systems just cache libraries once
they're loaded? Don't they *expect* your processes to be sloppy and
self-involved?
Re: dso alternative
Posted by Branko Čibej <br...@xbc.nu>.
Ben Collins-Sussman wrote:
> I'm going to have a function which takes a URL as input, and returns a
> vtable from a RA DSO load. A single process might call this function
> over and over -- that's okay, according to what you say above. (When
> a process reloads the same DSO over and over, the OS gives it the same
> pointer each time, right?)
Eek. This should work fine, yes, but I'll give it a good bashing on
Win32 once you implement it, just in case.
--
Brane �ibej
home: <br...@xbc.nu> http://www.xbc.nu/brane/
work: <br...@hermes.si> http://www.hermes-softlab.com/
ACM: <br...@acm.org> http://www.acm.org/
Re: dso alternative
Posted by Greg Stein <gs...@lyra.org>.
On Wed, Dec 13, 2000 at 05:04:14PM -0600, Ben Collins-Sussman wrote:
> Greg Stein <gs...@lyra.org> writes:
>
> > You get the same apr_dso_handle_t each time. Presumably, the result
> > of apr_dso_sym() will be the same pointer each time, too. And the OS
> > refcounts the bugger (keeping in in memory until the Nth unload()
> > call, where N == #loads).
>
> Ah. Does libsvn_client need to worry about dso_unloading() each RA
> library before quitting? Or is it implied when main() exits?
Don't worry about it.
They "should" go away at pool cleanup time (the pool passed to
apr_dso_load), but it appears they aren't. Simple bug to fix.
Point is: you don't need to call unload() unless you have a particular
reason to drop the library from your process space.
Cheers,
-g
--
Greg Stein, http://www.lyra.org/
Re: dso alternative
Posted by Ben Collins-Sussman <su...@newton.collab.net>.
Greg Stein <gs...@lyra.org> writes:
> You get the same apr_dso_handle_t each time. Presumably, the result
> of apr_dso_sym() will be the same pointer each time, too. And the OS
> refcounts the bugger (keeping in in memory until the Nth unload()
> call, where N == #loads).
Ah. Does libsvn_client need to worry about dso_unloading() each RA
library before quitting? Or is it implied when main() exits?
Re: dso alternative
Posted by Greg Stein <gs...@lyra.org>.
On Wed, Dec 13, 2000 at 04:14:28PM -0600, Ben Collins-Sussman wrote:
> Greg Stein <gs...@lyra.org> writes:
>
> > Calling apr_dso_load() multiple times, within a process, for the same DSO
> > should be quite fine.
>
> OK, then I should keep things as simple as possible.
>
> I'm going to have a function which takes a URL as input, and returns a
> vtable from a RA DSO load. A single process might call this function
> over and over -- that's okay, according to what you say above. (When
> a process reloads the same DSO over and over, the OS gives it the same
> pointer each time, right?)
You get the same apr_dso_handle_t each time. Presumably, the result of
apr_dso_sym() will be the same pointer each time, too. And the OS refcounts
the bugger (keeping in in memory until the Nth unload() call, where N ==
#loads).
Strictly speaking, I don't know that it matters since you're just returning
them each time (rather than caching/storing them).
> So forget threads. I was only worried about writing "threadsafe"
> code. But now that I won't have any global variables, the issue is
> moot. There's no need for a global hash of loaded dso's.
Ah. Good point. Quite cool.
Cheers,
-g
--
Greg Stein, http://www.lyra.org/
Re: dso alternative
Posted by Ben Collins-Sussman <su...@newton.collab.net>.
Greg Stein <gs...@lyra.org> writes:
> Calling apr_dso_load() multiple times, within a process, for the same DSO
> should be quite fine.
OK, then I should keep things as simple as possible.
I'm going to have a function which takes a URL as input, and returns a
vtable from a RA DSO load. A single process might call this function
over and over -- that's okay, according to what you say above. (When
a process reloads the same DSO over and over, the OS gives it the same
pointer each time, right?)
So forget threads. I was only worried about writing "threadsafe"
code. But now that I won't have any global variables, the issue is
moot. There's no need for a global hash of loaded dso's.
Re: dso alternative
Posted by Greg Stein <gs...@lyra.org>.
On Wed, Dec 13, 2000 at 01:19:02PM -0600, Ben Collins-Sussman wrote:
>
> Or, perhaps this whole idea of "sharing" already-loaded RA libraries
> is silly. Each process, when it needs an RA library, can just
> explicitly load it and keep a private copy of the vtable.
>
> I mean, don't modern operating systems just cache libraries once
> they're loaded? Don't they *expect* your processes to be sloppy and
> self-involved?
Each *process* must load a DSO itself. There isn't any way that you can
cache that. (and yes: the OS is smart about the second process' load)
Processes can't share the vtable either, since the ptrs are specific to that
process.
[ the stuff can be shared among threads, though; forking is another can of
worms... ]
Calling apr_dso_load() multiple times, within a process, for the same DSO
should be quite fine.
Were you talking processes?
Cheers,
-g
--
Greg Stein, http://www.lyra.org/