Please find the attached document. Solution has information regarding the concurrency and how it is implememnted in JAVA.
Describe the concept of concurrency and how threads are used to implement currency in Java.
Describe the concept of concurrency?
In computer science, concurrency is concerned with the sharing of common resources between computations which execute overlapped in time (including running in parallel). This often entails finding reliable techniques for coordinating their execution, exchanging data, allocating memory and scheduling processing time in such a way as to minimized response time and maximise throughput. Concurrent systems such as operating systems are designed to operate indefinitely and not terminate unexpectedly. However current operating systems in broad use do not fulfill this design goal in practical operation.
Because of the use of shared resources, concurrent systems in general require the use of arbiters in their implementation which gives rise to unbounded nondeterminism.
Levels of coordination can be ranked by coupling -- from tightest to loosest. Generally, the tighter the coupling between concurrent computations and the more use of a shared resource, the more contention there can be for that resource.
Concurrent programming encompasses the programming languages and algorithms used to implement such techniques. It is considered to be more general than parallel programming, because it involves shared resources that can change, whereas parallelism only entails multiple executions at the same time. Its base goals include correctness, performance and robustness.
concurrent programming with threads:
shared memory multiprocessors are cheaper and more common so each thread can be allocated a CPU;
it is less expensive and more efficient to create several threads in one process that share data than to create several processes that share data;
IO on slow devices like networks, terminals, and disks can be done in one thread while another thread does useful computation in parallel;
multiple threads can handle the events (e.g., mouse clicks) in multiple windows in the windowing system on a workstation;
in a LAN cluster of workstations or in a distributed operating system environment, a server running on one machine can spawn a thread to handle an incoming request in parallel with the main thread continuing to accept additional incoming requests.
How threads are used to implement currency in Java?
Conceptually, the notion of a thread is not difficult to grasp: it's an independent path of execution through program code. When multiple threads execute, one thread's path through the same code usually differs from the others. For example, suppose one thread executes the byte code equivalent of an if-else statement's if part, while another thread executes the byte code equivalent of the else part. How does the JVM keep track of each thread's execution? The JVM gives each thread its ...
The concept of concurrency is featured.