Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4799163

Thread.yield() NOP implementation prerequsites

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 1.4.0
    • hotspot
    • x86
    • linux

      JVM implementations that do not map Java thread priorities to system thread priorities must not implement Thread.yield as NOP. It does not allow to properly implement background activity (for performance reasons).

      I saw behaviour that looks like NOP implementation on Linux and Solaris implementations. (On windows it's probably NOP too but it does not matter as it maps thread priorities).

      ============

      LOWERed priority, this bug is workaround for 4813310.

      ###@###.### 2003-03-24
      Not-a-bug. See the comments in http://java.sun.com/j2se/1.5.0/docs/guide/vm/thread-priorities.html.

      The Thread.setPriority and Thread.yield methods are advisory. They constitute hints from the application to the JVM. Properly written, robust, platform-independent code can use setPriority() and yield() to optimize the performance of the application, but should not depend on these attributes for correctness. Likewise, no assumptions should be made about the order in which threads are granted ownership of a monitor or the order in which threads wake in response to the notify or notifyAll method. An excellent reference for these topics is Chapter 9, "Threads," in Joshua Bloch's book Effective Java Programming Language Guide.

            dice Dave Dice
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: