in short you need synchronization when using multiple threads in an application. Synchronization is needed to prevent unexpected access to shared data among multiple threads. Without proper synchronization you have good chances for corrupted data and kind of non-deterministic behavior of your program.
But multi-threading and correct synchronization is really a complex topic and you should search for tutorials or documentation on it. Unfortunately it's simply not possible to explain this here in a few sentences.
While Marco's answer is spot on, I'd like to add one little detail.
Specifically, you need to synchronize if you have shared mutable data. If the data that's shared between threads is immutable -meaning it does not change during it's lifetime, or if you can guarantee that it does not change when there's a chance of concurrent access- then there's no need for synchronization. [ May 28, 2008: Message edited by: Ulf Dittmer ]
Ping & DNS - updated with new look and Ping home screen widget
Synchronize key word is used with methods or block of code in methods It is used where the block of code is sharing common resources
�Knowledge is the food of the soul.�<br /> <br /><br />To get free knowledge,ebook links, free pdf ,and new technology discussions visit the following link <br /><a href="http://vinayakkatkar.blog.co.in" target="_blank" rel="nofollow">http://vinayakkatkar.blog.co.in</a>