• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Good link (Threads)

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I came across this good article on how JVM implements synchronization behind the hood.
web page.
Hope this will help other certification aspirants like me.
Ramnath
Modified title to be more specific...
[ April 10, 2004: Message edited by: Barry Gaunt ]
 
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is a great article to certain extent. It gives similar explanation as some books with respect to accessing a synchronized method.
After reading the article, I still have the question:"When there is a synchronized method in the object and a thread gets a lock, is the lock on the whole object or just the method??"
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

After reading the article, I still have the question:"When there is a synchronized method in the object and a thread gets a lock, is the lock on the whole object or just the method??"


The whole object but non synchronized metods can be accessed by multiple threads.
 
Kishore Dandu
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the whole object is locked by the thread, how are other threads entering other methods. beats me!!
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey kishore this might not be the correct answer but i think it is,
well every object has synchronized methods and methods which are not synchronized for which a thread don't need a lock so a thread can enter an object and run those methods but not the synchronized method until other thread give up the lock. I hope ur question is answered.
 
Joel Salatin has signs on his property that say "Trespassers will be Impressed!" Impressive tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic