Re: reference counting.. continued..

From: Julian Elischer (julian_at_elischer.org)
Date: 06/09/04

  • Next message: Peter Jeremy: "Re: dev_t / udev_t confusion ?"
    Date: Wed, 9 Jun 2004 12:05:53 -0700 (PDT)
    To: Poul-Henning Kamp <phk@phk.freebsd.dk>
    
    

    On Wed, 9 Jun 2004, Poul-Henning Kamp wrote:

    > In message <Pine.BSF.4.21.0406091147310.57882-100000@InterJet.elischer.org>, Ju
    > lian Elischer writes:
    >
    > >> Please, whatever you do, show that your API will deal with the
    > >> refcounting of struct tty. Pay particular attention to the
    > >> sysctl function which makes the difference between a CS-101
    > >> assignment and the real world.
    > >
    > >yes this is the kind of thing that makes for 'fun'..
    > >So, having just dealt with it,
    > >how would you go about describing the general case that your example
    > >falls into (for example if you were writing a textbook)?
    >
    > I am not in favour of a dedicated API for refcounts.
    >
    > A dedicated API works if the refcount is a detached property of the
    > object, and that is not normally the case outside OO+GC implementations.
    >
    > Our reference counts will almost invariably be integral properties
    > of our objects and therefore has to interact with the remaining
    > object locking.
    >
    > I simply do not belive that a "refcount API" will have that many uses
    > in our kernel, most places we will have to hand-roll anyway.
    >
    > So before you spend too much time on this, I suggest you define
    > what the API will look like, write the manpage and forget the
    > implementation.
    >
    > Then use that definition to see how it would be used in actual
    > kernel code.
    >
    > If the result of that is that code becomes more clear and easier
    > to get correct for the programmers, then we can move ahead and
    > see how to implement it, but if we end up with too many
    >
    > REF_YOU_CAN_NOT_REMEMBER_HOW_TO_USE_THIS(foo->ref, REF_MAGIC23)
    >
    > Then you can save the time spent thinking about the implementation.

    I agree with this sentiment and I think I already mentionned that
    the pivotal factor is whether there are enough cases in the kernel where
    such an API could be used..

    My gut feeling is that there are probably just enough to make it worth
    while because of the number of times that I've implemented ref countes
    and the number of times I've thought "There should be an API to do this
    for me". However that is not a very scientific
    basis, so definitly it is worht looking as a cross-section of all the
    reference counts in the kernel.

    >
    > Poul-Henning
    >
    > --
    > Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
    > phk@FreeBSD.ORG | TCP/IP since RFC 956
    > FreeBSD committer | BSD since 4.3-tahoe
    > Never attribute to malice what can adequately be explained by incompetence.
    >

    _______________________________________________
    freebsd-arch@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-arch
    To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"


  • Next message: Peter Jeremy: "Re: dev_t / udev_t confusion ?"

    Relevant Pages

    • Re: [2.6 patch] schedule obsolete OSS drivers for removal
      ... > recommend to use ALSA API directly with apps. ... At the same time the kernel API itself should be suitable to ... > I, at least, have never thought that the OSS _API_ would die. ...
      (Linux-Kernel)
    • Re: blatant GPL violation of ext2 and reiserfs filesystem drivers
      ... > implemented the same API as Linux, is it a violation of the GPL. ... implementation of the "Linux kernel API" for modules - especially ... that that binary modules which only use standard exported ... So in principle there is no guarantee that distributing ...
      (Linux-Kernel)
    • Re: Out of tree module using LSM
      ... How about becoming involved in creating that official API? ... Every time we make a change in the kernel code, ... effort to engage with the kernel community, ... I suggest you review Greg KH's excellent document on the issue: ...
      (Linux-Kernel)
    • Re: Would I be violating the GPL?
      ... > incorporate in any way any kernel headers or source code tagged GPL) do ... but Linux folks seem to be reasonable on this point. ... derived work of that specific implementation of the API, ... demonstrably derived from _documentation_, not from code. ...
      (Linux-Kernel)
    • Re: Linux API developer documentation
      ... > the Linux kernel. ... Python has its own API ... ... Libraries and applications will be built against libc. ... If you are looking for the standard posix API, then yes, you would be ...
      (alt.os.linux)