This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Threads and Synchronization and the fly likes Is it possible to execute the code by multiple thread simulataneously? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Is it possible to execute the code by multiple thread simulataneously?" Watch "Is it possible to execute the code by multiple thread simulataneously?" New topic
Author

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

azuki ooh
Greenhorn

Joined: Nov 07, 2008
Posts: 20
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

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

Concurrently? Yes. Simultaneously? That depends on hardware and OS.


Steve
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

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.
 
GeeCON Prague 2014
 
subject: Is it possible to execute the code by multiple thread simulataneously?