Synchronization - JAVA Interview Questions and Answers
What do you understand by Synchronization?
Synchronization is a process of controlling the access of shared resources by the multiple threads in such a manner that only one thread can access one resource at a time. In non synchronized multithreaded application, it is possible for one thread to modify a shared object while another thread is in the process of using or updating the object's value.
Synchronization prevents such type of data corruption.
E.g. Synchronizing a function:
public synchronized void Method1 () {
// Appropriate method-related code.
}
E.g. Synchronizing a block of code inside a function:
public myFunction (){
synchronized (this) {
// Synchronized code here.
}
}
My Blog List
-
The Vera Zvonareva Picture
-
*Vera Zvonareva*
NEW YORK CITY, NEW YORK
*V. ZVONAREVA/K. Kanepi6-3, 7-5*
THE MODERATOR: Questions, please.
*Q. Crazy, crazy kind of weather out...
13 years ago
-
Cricketers and Bizarre nicknames
-
*Cricketers are known for the innovative strokes they execute; the
different ways they work out to outwit batsmen and not forgetting the
captains who spe...
13 years ago
-
Deepika Padukone in Dum Maro Dum
-
Baffling wasn't it? So was it for Deepika Padukone. The actress was
recently offered Rs. 4 crores by a wealthy NRI family in London to perform
the four m...
13 years ago
-
C programming Language Technical Interview Questions and Answers
-
Predict the output or error(s) for the following:
*8. # include*
*aaa() {
printf("hi"); }bbb(){ printf("hello"); }ccc(){ printf("TechPrepa...
13 years ago
-
Happy new year SMS
-
*H *ours of happy times with friends and family
*A *bundant time for relaxation
*P *rosperity
*P *lenty of love when you need it the most
*Y *outhful excitem...
13 years ago
-
Placement Questions With Solution of C/C++ Programming
-
Technical Placement C++ Question with Solution CLICK HERE FOR MORE...
1. void main()
{
int a, *pa, &ra;
pa = &a;
ra = a;
cout <<"a="<
c++ placement interv...
13 years ago
-
Aaj Kuchh Maangtee Hoon Priya - Manoshi Chatterjee
-
आज कुछ माँगती हूँ प्रिय
आज कुछ माँगती हूँ मैं
प्रिय क्या दे सकोगे तुम?
मौन का मौन में प्रत्युत्तर
अनछुये छुअन का अहसास
देर तक चुप्पी को बाँध कर
खेलो अपने ...
15 years ago
-
No comments:
Post a Comment
Thanks to given comments.......