Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Is it possible to execute the code by multiple thread simulataneously?  RSS feed

 
azuki ooh
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to execute the code by multiple thread simulataneously?

Concurrently? Yes. Simultaneously? That depends on hardware and OS.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also note that for code like that, if the threads are sharing the same instance, then if you don't use proper synchronization, you may get undesirable results. For example, you could have 100 threads executing, and the count could end up at 1, or at 2, or at anything up to and including 100.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!