• 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

Threads

 
Ranch Hand
Posts: 182
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have read threads chapter in K & S Book. I understood the topics. but I am not able to answer practical questions in the mock tests. But I am able to answer theoretical questions. But not practical especially Synchronization questions.. Any one please suggest me
 
Ranch Hand
Posts: 1032
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The answer is simple: You need to practice more. Go through examples and try to figure them out. It takes a lot of practice, and I am afraid that theoretical knowledge is only a part of the equation.
 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Banu Chowdary wrote:Hi,

I have read threads chapter in K & S Book. I understood the topics. but I am not able to answer practical questions in the mock tests. But I am able to answer theoretical questions. But not practical especially Synchronization questions.. Any one please suggest me



I understand. Here are few tips

1. See for sleep, join and wait from within try catch block as they throw Interrupted Exceptions
2. Learn that sleep & yield are static and throw interrupted exception. the ThreadName.sleep and ThreadName.yield don't depend on ThreadName. They act on current thread
3. Learn that wait, notify and notifyall must be called from synchronised context
4. Learn that threads must hold lock on the object on which wait, notify and notifyall is called
5. Synchronised methods don't interefre with Non-synchronised
6. Synchronised methods of threads acting on DIFFERENT Objects won't interefere with one another.


Anyone is free to ADD


 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic