[concurrency-interest] Proposal WeightedLinkedBoundedQueue

David Holmes dcholmes at optusnet.com.au
Thu Nov 23 19:13:30 EST 2006


Ok - but practically speaking how to you calculate the size/weight? We often
talk informally about lightweight and heavyweight objects, but we don't
actually have a simple means of quantifying that. Are you just working on
the basis that if the user can define some notion of "weight" then this data
structure can impose a weight limit?

It seems rather special purpose. If weight was memory-usage, and we had a
way to measure that, then I could see use for this in some memory
constrained contexts.

As it is I would think you could do this via a fairly simple wrapper, as
you'll need to track the cumulative weight as objects are added/removed.
You'll need stronger synchronization than provided by LinkedBlockingQueue
unless the weight-limit is allowed to be violated - so adding the sync in
the wrapper seems reasonable too.

Cheers,
David Holmes
  -----Original Message-----
  From: concurrency-interest-bounces at cs.oswego.edu
[mailto:concurrency-interest-bounces at cs.oswego.edu]On Behalf Of Thierry
Hanot
  Sent: Thursday, 23 November 2006 9:43 PM
  To: dholmes at ieee.org; concurrency-interest at cs.oswego.edu
  Subject: Re: [concurrency-interest] Proposal WeightedLinkedBoundedQueue


  The weight is defined by the end user using a small interface yes.

  I use the term weight but size is also relevant J





  Thierry Hanot


----------------------------------------------------------------------------
--

  From: David Holmes [mailto:dcholmes at optusnet.com.au]
  Sent: jeudi 23 novembre 2006 01:26
  To: Thierry Hanot; concurrency-interest at cs.oswego.edu
  Subject: RE: [concurrency-interest] Proposal WeightedLinkedBoundedQueue



  How do you define and measure the "weight" of an object?



  David Holmes

    -----Original Message-----
    From: concurrency-interest-bounces at cs.oswego.edu
[mailto:concurrency-interest-bounces at cs.oswego.edu]On Behalf Of Thierry
Hanot
    Sent: Wednesday, 22 November 2006 10:18 PM
    To: concurrency-interest at cs.oswego.edu
    Subject: [concurrency-interest] Proposal WeightedLinkedBoundedQueue



    A small proposal for adding a new class in the concurrent package.

    All bounded collection are bounded to avoid to use to much memory.(At
least in my case J).

    But the element put in those collections are often with different size.

    In my case  BoundedQueue is used as an event queue and we can have
composite events which contains itself many events.

    What do you think about adding some bounded collection no more based on
the count but on the sum of the weight of the object inside?



    After a quick look on the code of the LinkedBoundedQueue it seems pretty
easy to do.



    Does somebody else can see the advantage of this kind of object and is
there enough people interested to make it a part of the concurrent package?



    B.R





    Thierry Hanot


-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/attachments/20061124/f4e03173/attachment.html 


More information about the Concurrency-interest mailing list