search

Home  >  Q&A  >  body text

java - In a simple multi-threading example, how to analyze the execution process of multiple threads based on the printed results?

A simple multi-threading example, how to analyze the execution process of multiple threads?


In this example, I want to know how these five threads execute, and then this result will appear on the console?

滿天的星座滿天的星座2768 days ago585

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-05-27 17:42:53

    You will find different results if you execute it a few times. This cannot be accurately analyzed because threads are executed by seizing the right to use the CPU. You cannot know which thread grabs the right to execute first. You can only deduce it from the output results.

    reply
    0
  • Cancelreply