At 11:26 15/3/01 -0800, Ram C wrote:
>Should the methods, pop(), insert(),peek() in BinaryHeap be syncronized
>?
Possibly - though I would prefer if they were unsynchronized by default but
you could make them synchronized like
PriorityQueue pq = new SynchronizedPriorityQueue( new BinaryHeap() );
or perhaps
PriorityQueue pq = AvalonCollections.synchronize( new BinaryHeap() );
>When used in the DefaultTimeScheduler, if different threads try to manipulate
>the BinaryHeap(m_elements) with these different methods, we might endup
>with some inconsistent state...
yep ;)
>The current design of blocks seems to be very dependent on 'syncronized'
>methods(or HashTable). I have heard syncronized methods can run as much
>as '100' times slower than regular methods. But i have very little knowledge
>on concurent programing to validate this..
depends on the VM - older JVMs ran as much as 800 times slower while modern
JVMs on certain architectures (namely Suns server hotspot) only ran 20
times as slow.
>For example, the object store block uses syncronized methods to write
>and read objects. If i were to directly write the object instead of using
>the 'objectstore' block, i don't need syncronized methods...Its not fair
>for all the other threads to wait while one thread is writing a really
>huge file(like a huge e-mail with attachements)..
>
>Could this lead to scalability problems later?
It could be - depends. It all depends on how the repository is written. You
could rewrite the repositories so they only locked/synchronized if you were
accessing the same item (ie same file/whatever). No one has done that yet
though ;)
Cheers,
Pete
*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof." |
| - John Kenneth Galbraith |
*-----------------------------------------------------*
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]