JAVA CONCEPTS
Concurrent Package:
1- What is concurrency?
Concurrency is the ability to run several programs or several parts of a program in parallel.
2- Thread vs Process
3- What is visibility and access problems in java?
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.
4- Lock and Thread execution : synchronized vs volatile
Concurrent Package:
1- What is concurrency?
Concurrency is the ability to run several programs or several parts of a program in parallel.
2- Thread vs Process
A process runs independently and isolated from other processes. It cannot directly access shared
data in other processes. The resources of the process, e.g. memory and CPU time, are allocated to it via the operating system.
A thread is a so called lightweight process. It has its own call stack, but can access shared data of other threads in the same process.
Every thread has its own memory cache. If a thread reads shared data it stores this data in its own memory cache. A thread can re-read the shared data.
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.
4- Lock and Thread execution : synchronized vs volatile
No comments:
Post a Comment