Interrupted IO and AWT
Tue Mar 21 16:05:00 GMT 2000
It seems to me that a spin lock with exponential back-off (and sleeps for
longer wait times) doesn't behave that badly, even in this case. There'll
be some unneeded wakeups on the part of the waiting thread near the
beginning, and it may sleep for up to about twice as long as it should
(assuming the base of the exponential is 2). Clearly this is suboptimal in
this case. But are there cases in which it's a serious problem?
From: Tom Tromey [ mailto:email@example.com ]
Sent: Tuesday, March 21, 2000 1:30 PM
To: Jeff Sturm
Cc: Boehm, Hans; Tom Tromey; Bryce McKinlay;
Subject: Re: Interrupted IO and AWT
>>>>> "Jeff" == Jeff Sturm <firstname.lastname@example.org> writes:
Jeff> Unfortunately Java supports just one synchronization primitive
Jeff> which must behave reasonably in all scenarios, even if (e.g.) a
Jeff> thread blocks on I/O.
One option would be to implement locks so that an attempt to acquire a
lock which is held by an I/O-blocked thread would cause a real block
instead of a spin. There are a lot of tradeoffs to make if we take
It does seem that we'll want some sort of configurable scheme.
Nothing we can come up with will be right in 100% of the
circumstances. For "big" implementations we should definitely
consider an adaptive approach. If I ever have time I'll dig up the
literature on this stuff. Meanwhile, anybody with the rare
combination of motivation and time is welcome to take a shot.
More information about the Java