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

doubt in calling thread..  RSS feed

 
gopal kishan
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have a doubt in thread. If one Thread calls two methods. one is synchronize and another one is not.

so how the thread will execute??? it will call both the method at the same time??

please clarify me.

thanks in advance
Gopal
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Regardless of any synchronization that is or isn't present, one thread can only do one thing at a time.

Now, if you have multiple threads, then one thread can be executing one method while another thread is executing the same or another method, with certain restrictions applied based on whatever syncing happens to be in place.

For details, see Doug Lea's book (Concurrent Programming in Java I think) or google for java thread tutorial
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!