GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  J2EE  >  Java
Go To First  |  Previous Question  |  Next Question 
 Java  |  Question 610 of 921    Print  
What does the keyword "synchronize" mean in java. When do you use it? What are the disadvantages of synchronization?
Synchronize is used when u want to make ur methods thread safe. The disadvantage of synchronise is it will end up in slowing down the program. Also if not handled properly it will end up in dead lock.
1. Only use (and minimize it's use)synchronization when writing multithreaded code as there is a speed (up to five to six time slower, depending on the execution time of the synchronized/nonsynchronized method ) cost associated with its use.
2. In case of syncronized method modifier, the byte code generated is the exact same as non-syncronized method. The only difference is that a flag called ACC_SYNCRONIZED property flag in method's method_info structure is set if the syncronized method modifier is present.
3. Also, syncronized keyword can make the code larger in size if used in the body of the method as bytecode for monitorenter/monitorexit is generated in addition to any exception handling.



  
Total Answers and Comments: 1 Last Update: February 15, 2006   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
February 15, 2006 14:57:52   #1  
Kish        

RE: What does the keyword "synchronize" mean in java. ...
Synchronize on a method basically locks up the whole class, the other methods are not accessible till the thread is done with the transcation
 
Is this answer useful? Yes | No

 Related Questions

With respect to multithreading, synchronization is the capability to control the access ofmultiple threads to shared resources. Without synchronization, it is possible for onethread to modify a shared 
Latest Answer : Synchronization is the mechanism that ensures that only one thread is accessed the resources at a time. In a practical point of view assume that two threads are trying to update bank balance at the same time!!! How we can solve this issue the answer is sychronization. ...

The null value is not a keyword. 
Latest Answer : no null is not a keyword it is point to garbage value        justify ur ans ...

It uses those low order bytes of the result that can fit into the size of the type allowed bythe operation. 
Latest Answer : In java there is no point of overflow and underflow, it was there in C. For avoiding that java introduces type casting. Java will allow some more space from the defult space of primtive type. ...

The EventObject class and the EventListener interface support event processing. 
Latest Answer : Java.util.Event class ...

The sizeof operator is not a keyword. 
Latest Answer : No,sizeof is not a keyword. ...

A native method is a method that is implemented in a language other than Java. 
Latest Answer : Informs the compiler that the method has been used in a non-java platform and used only with the methods. ...

The java.awt.AWTEvent class is the highest-level class in the AWT event-classhierarchy. 

Most of the AWT-related events of the event-delegation model are defined in thejava.awt.event package. The AWTEvent class is defined in the java.awt package. 

The purpose of the Runtime class is to provide access to the Java runtime system. 
Latest Answer : Which returns the runtime information like memory availablilityRuntime.freeMemory() --> Returns JVM Free MemoryRuntime.maxMemory() --> Returns the maximum amount of memory that the JVM will attempt to use.also helps to run the garbage collectorRuntime.gc() ...

The = operator is right associative. 
Latest Answer : Prefix Unary operatorsObject creation and castTernaryAssignment ...


 Sponsored Links

 
Related Articles

Service Oriented Java Business Integration Review

Service Oriented Java Business Integration Review Introduction If you ve read through the texts which give you an introduction to SOA or Web Services you will often find them to be quite frustrating and the reason for this is because they spend too much time referencing business processes which are
 

SOA Disadvantages

SOA Disadvantages Service Oriented Architecture Disadvantages Applicability Service Oriented Architecture may not always be the best architectural choice because optimal utilization of SOA requires additional development and design attempts as well as infrastructure which translates into costs esc
 

Java and Client Server Models

Java and Client Server Models The Role of Client Servers on the Web Client server models provide the essential mechanisms for working with the Internet In fact most of the World Wide Web is built according to this paradigm In client server models the web browsers run by millions of users are the cli
 

The Interview Snafu

How to turn someone else’s mistake to your advantage Your dream job is about to become reality. A recruiter gave you the heads up about the perfect position at Humungous Conglomerate, Inc. You went through five interviews as well as a battery of psychological tests mandated by their HR de
 

Winning a Job Interview with a Winning Resume

Does your resume unlock your potential, take your skills to the highest level and win you the interview and the job you want now? The job market today is highly competitive and even if you think you have what it takes to get an interview you won’t get over the line without a polished, prof
 

XML Disadvantages

XML Disadvantages The extensive markup language is the way to go for developing future web applications and it almost defines the future of web development There are no doubts about its performance in this arena However XML also has some draw backs which need to be looked at and improved upon The re
 

Using UML with Java

Using UML with Java While Java is not a new language its application for the development of embedded systems is quite new Developers are beginning to take a second look at modeling languages such as UML and many feel it can be a powerful tool in their development arsenal mosgoogle center Introductio
 

Importance of Proper English during Job Interview

Importance of Proper English during Job Interview Your job interview is crucially important and it will determine whether or not you will get the job Depending on the type of job you re going for it is very important for you to use proper English In most cases jobs which offer higher salaries will h
 

Java Technology Trends

Technology Trends Involving Java Java is an object oriented programming language OOP for Web browsers It is organized around data rather than actions and supports polymorphism which allows the same code to be written generically so it can function with different datatypes inheritance which allows on
 

Advantages and Disadvantages of Web 2.0

The Advantages and Disadvantages of Web 2 0 While Web 2 0 has become a popular term these days few people have taken the time to weigh the pros and cons of these evolutionary change While the advantages are heavily touted by those who are proponents of Web 2 0 there are also those who feel that this
 





About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape