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

Linux: Too long thread creation time

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.3.0, 1.4.0
    • hotspot
    • beta
    • x86
    • linux



      Name: boT120536 Date: 02/20/2001


      stromboli:~/bench>java -version
      java version "1.3.0_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0_01)
      Java HotSpot(TM) Client VM (build 1.3.0_01, mixed mode)

      The thread creation time on linux is too long.
      My tests showed that 10 threads creation time take on linux is more than 1s,
      less than 5ms on Solaris and is nearly not measurable on Windows 2000.
      The linux internals book have with native code a thread creation time of
      0.017ms (per thread). This looks to me like a bug and not a feature request
      because this will slow any server kind of application.

      My bench for thread creation time is :
      class TestThread {

      public static void main(String args[]) {
        long nb_threads = Long.parseLong(args[0]);
        System.out.println("Creating " + nb_threads + " threads");
        long start_time= System.currentTimeMillis();
           for (long il =0; il < nb_threads; il ++) {
              Thread th = new Thread() {
      public void run() {
      int il = 0;
      while (true) {
      il++;
      il--;
      }
      }
      };
      th.start();
        long end_time = System.currentTimeMillis();
        System.out.println("Time = " + (end_time-start_time));
      }
      }
      (Review ID: 116703)
      ======================================================================

            hhuangsunw Hui Huang (Inactive)
            bonealsunw Bret O'neal (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: