From lopes@parc.xerox.com Fri Oct 31 17:25:21 1997 Sender: Cristina Lopes From: Cristina Lopes To: Karl Lieberherr Cc: dem@ccs.neu.edu, lopes@parc.xerox.com Subject: Re: minimize notifications Karl Lieberherr writes: > Hi Josh and Crista: > > I guess unnecessary notifications are expensive. Therefore, I think that > eventually Demeter/Java COOL should distinguish between coordinator > and condition variables (as Crista COOL already does) > and notifications should be done only > when a condition variable changes. > > This problem is probably well studied. > > Crista: do you know a good reference to read about the algorithm? There is no "algorithm" as such. There are languages and systems that have condition variables like Cool. For example Obliq, and pthreads (in a twisted way). They simply do it - it's a matter of implementing another level of management that keeps track of which threads are waiting on which conditions, issuing the right notifications, and making sure that locks get released before waiting on cond vars. However, I doubt that doing this extra management with Java objects is worth the trouble - I suspect it will end up being slower, because this kind of management involves a lot of stuff (for example, releasing all the locks before waiting on cond vars, etc.). But you can try and compare the speed. It would be better to implement condition variables directly in the VM. Note, again, that this is an _implementation_ issue. At the programming level (Cool), users have condition variables. > > -- Karl > > >From lopes@parc.xerox.com Thu Oct 30 21:03:30 1997 > >From: Cristina Lopes > >To: Karl Lieberherr > >Subject: Re: minimize notifies > > > >Karl Lieberherr writes: > >> Hi Crista: > >> > >> again on page 158. > >> > >> I was assuming that the DJ and Java program had the same behavior regarding > >> notifications. > > > >They have the same behavior, but not necessarily the same implementation. > > > > > >> If we would like this, could we change in the method manager for put: > >> > >> empty = false; > >> > >> to > >> > >> if (usedSlots==1) empty=false; > >> > >> Then the COOL code should only notify if a condition variable has actually > >> changed. Does your implementation do this? > > > >Yes - ideally notifications should be specific to condition variables. > >But that's a bit more complex to implement - although not impossible. > > > >