Re: Massive performance loss from OS::sleep hack



On Sat, 15 Sep 2007, Kip Macy wrote:

Or more likely they'll continue to maintain a sched_yield that isn't
posix compliant. We may just want to add some sort of interface so the
jvm can tell the kernel that sched_yield should be non-compliant for
the current process.

I don't think that is a good idea, it seems like too much of a hack.
The scheduler(s) should schedule threads the way they are designed
to, either obeying a threads priority, using it as a hint, or totally
ignoring it.

If the JVM kept track of the thread priorities in use, I suppose
Thread.yield() could first lower the current thread's priority to
the next used priority and then yield, raising the priority back after the yield. This isn't perfect, there are race conditions, the next highest priority thread(s) could be blocked and not runnable, etc.
Maybe just lowering the priority to min or default priority would work
well enough.

This test would fail even on Solaris if you use SCHED_RR or SCHED_FIFO
since it is POSIX compliant for those scheduling classes.

--
DE
_______________________________________________
freebsd-performance@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-performance
To unsubscribe, send any mail to "freebsd-performance-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Cooperative threading preemptive threading - a bit confused
    ... then in multithreaded program JVM ... Cooperative threading model ... threads with higher priority can preempt lover priority ... Is JVM always the one that manages thread movement (by thread ...
    (comp.lang.java.programmer)
  • Re: Massive performance loss from OS::sleep hack
    ... We may just want to add some sort of interface so the ... If the JVM kept track of the thread priorities in use, ... Thread.yieldcould first lower the current thread's priority to ... this argument and the Java developers won :-(. ...
    (freebsd-performance)
  • Re: How to run tasks with priority?
    ... >> threads with the same priority? ... Doesn't it depend to some extent on whether the JVM implementation ... JVM schedules threads. ...
    (comp.lang.java.help)
  • Re: Massive performance loss from OS::sleep hack
    ... to, either obeying a threads priority, using it as a hint, or totally ... If the JVM kept track of the thread priorities in use, ... Thread.yieldcould first lower the current thread's priority to ... since it is POSIX compliant for those scheduling classes. ...
    (freebsd-performance)