Core%20Java%20Interview%20Questions%20and%20Answers
Question: What is concurrency in java?Answer:Concurrency is the ability to run several programs or several parts of a program in parallel. If a time consuming task can be performed asynchronously or in parallel, this improve the throughput and the interactivity of the program. A modern computer has several CPU's or several cores within one CPU. The ability to leverage these multi-cores can be the key for a successful high-volume application. Concurrency Issues: Threads have their own call stack, but can also access shared data. Therefore you have two basic problems, visibility and access problems. A visibility problem occurs if thread A reads shared data which is later changed by thread B and thread A is unaware of this change. An access problem can occur if several thread access and change the same shared data at the same time. Visibility and access problem can lead to
|
Most helpful rated by users:
- How could Java classes direct program messages to the system console, but error messages, say to a file?
- What are the differences between an interface and an abstract class?
- Why would you use a synchronized block vs. synchronized method?
- How can you force garbage collection?
- What are the differences between the methods sleep() and wait()?