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
Ruben Soto
Ranch Hand
Joined: Dec 16, 2008
Posts: 1032
posted
0
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.
All code in my posts, unless a source is explicitly mentioned, is my own.
Prav sharma
Ranch Hand
Joined: Feb 07, 2005
Posts: 102
posted
0
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
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.