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

Improve timed-park mechanism in ObjectMonitor for virtual thread support

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • 26
    • 26
    • hotspot

      When blocking in ObjectMonitor::enter_internal we currently use timed-park for pinned virtual threads. This is done to alleviate some deadlocks cases, in particular, those that could happen during class loading or class initialization, where all other carriers might be carrying a pinned vthread waiting for the same class to be loaded/initialized.
      First, we should extend this mechanism to cover ObjectMonitor::reenter_internal too. But also, the criteria to decide whether to do a timed-park should be based on whether there are unmounted vthreads already in the _entry_list, and not just if this is a pinned virtual thread. This will cover mixed usages of the same ObjectMonitor between virtual threads and platform threads. Instances of this have been seen in the Loom repo with the work to preempt virtual threads during klass initialization.

            pchilanomate Patricio Chilano Mateo
            pchilanomate Patricio Chilano Mateo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: