Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-1125

[DRLVM] Thread Manager component contribution

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • Contributions
    • None

    Description

      This patch is an improvement for DRLVM which consolidates it's threading
      subsystem into a single component - Thread Manager.

      The attached bundle consists of two parts:
      1) ThreadManager-09-08e.zip

      • Thread Manager code, tests and documentation
        (it has to be unzipped into drlvm/trunk directory)

      2) DRLVM-update-for-new-ThreadManager-09-08e.diff

      • Patch that integrates Thread Manager into DRLVM.

      The primary purpose of this update is to make a step toward archiving a
      better modularity within the DRLVM, as well as do some enhancements over
      its threading subsystem. This is the result of refactoring of the
      threading-related code in the DRLVM into a separate library which
      is now implemented on top of the Apache Porting Layer.

      Here is the summary of enhancements that were made:

      • Threading becomes a modular component in JVM with a well-defined interface
        (one may try playing now with the different threading implementations without
        rewriting random pieces of the drlvm code);
      • Thread Manager is implemented on top of APR which may help to simplify
        it's porting to other platforms (the only platform dependent piece is JIT helpers)
      • Java monitors are reimplemented such that:
      • Performance is improved with help of the lock reservation algorithm
        (see http://portal.acm.org/citation.cfm?id=582433)
      • Recursion overflow condition is now handled correctly
      • Thread creation overhead is decreased;
      • Java threads now are always created at the single place;
      • Miscellaneous threading bugs went away, for example: hangs during thread stress tests,
        crashes on sleep(), incorrect reporting of JVMTI state and others.

      Note that the low-level (or "native") interface of the Thread Manager
      has been designed to be hythread-compatible with the intent of having
      classlib and DRLVM sharing the same threading library. It also adds
      a certain extensions to the original hythread which were required by
      drlvm (located in hythread_ext.h). However, these functions can still
      be easily renamed from hythread_* to something else if people believe
      this idea is wrong.

      Thread Manager comes with the extensive documentation which uncovers some
      of the details of the DRLVM's threading subsystem (you may find it at vm/thread/doc/ThreadManager.htm).
      There is also a set of unit tests for Thread Manager (located at vm/tests/unit)
      those framework can probably be used for the further unit tests development for
      other modules in DRLVM.

      The integration patch consists of the following pieces:

      build/make/* - changes necessary to include unit tests and accommodate
      new threading structure

      build/patches/*/APR - quick fixes to a few bugs in the APR: apr_thread_cond
      on Windows, apr_thread_yield on Linux.
      Note that the Thread Manager implementation requires a certain
      funct-ty which appeared to be beyond the APR, these additional
      functions were added for now at vm\port\include\apr_thread_ext.h:
      apr_thread_set_priority()
      apr_memory_rw_barrier()
      apr_thread_yield_other()
      apr_thread_times()
      apr_thread_cancel()
      If we find this code useful we may try proposing them
      back to the APR project.

      vm/vmcore/src/thread/* - These files contained old threading code which is now
      either completely removed or re-mapped into new Thread Manager.

      vm/vmcore/src/thread/hythr/

      • it was "hythread" emulation library, now it is replaced with the
        more funcitonal "native" layer of the Thread Manager (which still
        implements the most of hythread_* API).

      vm/port/src/encoder/* - added support for ROR instruction to the encoder

      Other changes were done as required to replace the references to the old threading code
      with the calls/references to the new Thread Manager.

      Thank you,
      Andrey Chernyshev
      Intel Middleware Products Division

      Attachments

        1. ThreadManager-09-08e.zip
          253 kB
          Andrey Chernyshev
        2. DRLVM-update-for-new-ThreadManager-09-08e.diff
          578 kB
          Andrey Chernyshev
        3. 0002-fixed-HARMONY-1125-on-top-of-HARMONY-1144-j.u.c.patch
          2 kB
          Salikh Zakirov
        4. harmony-1125-updated.patch
          1.25 MB
          Salikh Zakirov

        Activity

          People

            geir Geir Magnusson Jr
            ayc Andrey Chernyshev
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: