CPU Execution Time Shared by Multiple Threads - Test Output

This section provides the test output of a tutorial example on how to measuring CPU execution time allocated to threads with different setPriorities.

I executed the program presented in the previous section on my Windows 2000 system, and got the following output.

Priority: (min, norm, max) = (1, 5, 10)
Threads: 0 1 2 3 4 Time
  Steps: 1527 2229 161931 31864 29386 17416
  Steps: 3193 3881 175188 44342 41757 20301
  Steps: 6499 5536 204244 74234 71608 27221
  Steps: 8164 10495 244791 114110 112329 36475
  Steps: 11491 10495 257239 142209 139702 43025
  Steps: 13157 13805 285516 154633 152887 45909
  Steps: 14820 15458 297916 167948 165368 48793
  Steps: 16484 18763 327732 197825 195242 59009
  Steps: 19817 22073 369925 239372 236753 65448
  Steps: 23150 23729 403986 273273 271592 73410
  Steps: 26482 27018 416407 286531 284058 76295
  Steps: 28127 27018 429632 298998 296468 79299
  Steps: 29794 31993 473677 343808 341381 89575
  Steps: 33118 33662 486954 371226 368753 95944
  Steps: 34780 35317 514379 397811 395301 102193
  Steps: 38109 38639 541010 410201 408616 104958
  Steps: 39770 40305 553411 423504 421101 111027
  Steps: 41433 43640 595710 465923 463501 117757
  Steps: 44763 45310 609007 478306 493386 124557
  Steps: 48096 46980 638029 508055 519042 130686
  Steps: 49759 50313 664613 533784 531442 133570
  Steps: 51424 53649 690265 560371 558010 139639
  Steps: 53090 53649 720171 589434 587953 146550
  Steps: 58088 58656 751803 620981 619626 157366
  Steps: 64759 65335 819279 688363 687045 169324
  Steps: 68092 70339 865085 734088 732079 183085
  Steps: 74763 73680 914229 783060 782025 191217
  Steps: 78097 78691 958380 827074 826209 201372
  Steps: 81431 82033 999999 871975 870174 211036
  Steps: 86439 87032 999999 924273 923406 219149
  Steps: 91446 92023 999999 999999 999999 230506
  Steps: 91446 93361 999999 999999 999999 230626
  Steps: 91446 94721 999999 999999 999999 230726
  Steps: 91446 96091 999999 999999 999999 230826
  Terminate batch job (Y/N)? y  

Here is what I get out of the output from the program:

Another interesting behavior was noticed while executing the program. While all 5 sub-threads were running, the operating system was very sluggish. I was only able to move the mouse pointer around. Clicking on windows of any other running application programs gave me no response at all until 3 sub-threads reached the end. I guess the reason for this behavior is that Windows 2000 system is not truly sharing processing time among the running application programs equally. It let my Java application program (running under Java VM) took 100% of the CPU processing time. This is not a well-designed time-sharing multi-tasking operating system. Can anyone try my program on a Unix system?

Last update: 2014.

Table of Contents

 About This Book

 Installing JDK 1.8 on Windows

 Execution Process, Entry Point, Input and Output

 Primitive Data Types and Literals

 Bits, Bytes, Bitwise and Shift Operations

 Managing Bit Strings in Byte Arrays

 Reference Data Types and Variables

 StringBuffer - The String Buffer Class

 System Properties and Runtime Object Methods

 Generic Classes and Parameterized Types

 Generic Methods and Type Inference

 Lambda Expressions and Method References

Execution Threads and Multi-Threading Java Programs

 What Are Processes and Threads?

 The "Thread" Class - Creating Thread Objects With Thread Sub Classes

 The "Runnable" Interface - Creating Thread Objects with Runnable Objects

 CPU Execution Time Shared by Multiple Threads

CPU Execution Time Shared by Multiple Threads - Test Output

 Application Data Shared by Multiple Threads

 Application Data Shared by Multiple Threads - Test Results

 interrupt() - Method to Terminate Thread

 ThreadGroup Class and "system" ThreadGroup Tree

 Synchronization Technique and Synchronized Code Blocks

 Deadlock Condition Example Programs

 Garbage Collection and the gc() Method

 Outdated Tutorials

 References

 PDF Printing Version