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

Method os::yield_all() should be removed

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 9
    • 9
    • hotspot
    • None
    • b23
    • generic

    Description

      The method os::yield_all() has been, and is still, the source of many problems.
      The first issue comes from its specification:

        static void yield_all(); // Yields to all other threads including lower priority

      The semantic specified in the comment is extremely strong, so strong that it is almost
      impossible to implement it on most OSes/configurations HotSpot officially supports. But
      due to the appealing comment, the method is still used based on the behavior suggested
      in the comment.

      The second issue comes from the differences in the OS-specific implementations. On most
      platforms, os::yield_all() is implemented with a sched_yield() system call. But on Solaris, it
      is implemented wit the os::sleep() method, which causes a ThreadState transition that doesn't
      exist on other platforms.

      Regarding the semantic issue and the implementation issue, I suggest to remove the os::yield_all()
      method and replace its usages by explicit calls to os::naked_short_sleep() or os::NakedYield().

      Attachments

        Activity

          People

            fparain Frederic Parain
            fparain Frederic Parain
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: