Hi Folks,

I'm currently looking at some hotspot cleanup surrounding the ConvertSleepToYield VM flag. When this flag is true it replaces a call to Thread.sleep(0) with a platform yield call; otherwise the platform "sleep" function is called with sleep time of 1ms. (Note: no reasonable Java code should ever use Thread.sleep(0) :) )

This flag stems back to "pre-historic" days when hotspot was replacing the classic VM on Windows, and IIUC only a Solaris sparc implementation existed. The default for Windows (and all platforms subsequently ported to - including Solaris x86!) was to set the flag true; while for Solaris sparc it was set to false. The comment in the code is:

// When ConvertSleepToYield is on, this matches the classic VM implementation of
// JVM_Sleep. Critical for similar threading behaviour (Win32)
// It appears that in certain GUI contexts, it may be beneficial to do a short sleep
// for SOLARIS

Does anyone have any knowledge of what those GUI contexts may have been? (I suspect some old motif based environment.)

As I said, for Solaris x86 the flag value differs from sparc (presumably an oversight) for what should be an OS issue I would think. Can anyone think of a reason why the GUI on sparc may respond differently to x86 in the context of using a sleep(0)?

Finally, as I want to get rid of the flags altogether I first need to change the setting on sparc. Are there any specific GUI responsiveness tests that I might run to ensure this change has no averse impact?

Thanks,
David

Reply via email to