This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
RE: Interrupted IO and AWT
- To: "Boehm, Hans" <hans_boehm at hp dot com>
- Subject: RE: Interrupted IO and AWT
- From: Jeff Sturm <jsturm at sigma6 dot com>
- Date: Tue, 21 Mar 2000 23:54:07 -0500 (EST)
- cc: "'Tom Tromey'" <tromey at cygnus dot com>, Jeff Sturm <jsturm at sigma6 dot com>, Bryce McKinlay <bryce at albatross dot co dot nz>, java-discuss at sourceware dot cygnus dot com
On Tue, 21 Mar 2000, Boehm, Hans wrote:
> 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?
I like that idea, it think it would be worthwhile experimenting with it.
Isn't that essentially what you've already done in your GC anyway (in
linux_threads.c)?
There's a comment in GC_lock that the minimum useable sleep time
for Linux is 2ms. On one system I measured sched_yield() to consume about
4us on a context switch, 1us when no context switch takes place. It could
do perhaps 1000 iterations of test-and-set/yield in that same interval.
You wouldn't want to sleep too early, or most of that 2ms could be
unnecessarily consumed. The current SLEEP_THRESHOLD of 12 in GC_lock
seems low to me.
I'd question if suspend/resume could be any more effective over such a
duration (~1ms). I don't think so, since any other tasks waiting to run
would be given a chance by yielding anyway.
--
Jeff Sturm
jsturm@sigma6.com