Java Multithreading
Across
- 3. method is generally used to pause the execution of a current thread unless and until the specified thread on which join is called is dead or completed. To stop a thread from running until another thread gets ended, this method can be used. It joins the start of a thread execution to the end of another thread’s execution. It is considered the final method of a thread class
- 4. used to create multiple groups of threads in a single object
- 8. keyword that is used to ensure and address the visibility of changes to variables in multithreaded programming
- 9. This interface is basically available in Java right from the beginning. It is simply used to execute code on a concurrent thread
- 10. This interface is basically a new one that was introduced as a part of the concurrency package. It addresses the limitation of runnable interfaces along with some major changes like generics, enum, static imports, variable argument method, etc. It uses generics to define the return type of object
- 11. It simply refers to a program that is in execution i.e., an active program. A process can be handled using PCB (Process Control Block)
- 13. It is a tool to synchronize threads processing using some algorithm. It enables a set of threads to wait for each other till they reach a common execution point or common barrier points, and then let them further continue execution. One can reuse the same CyclicBarrier even if the barrier is broken by setting it.
- 14. represents a queue that is thread-safe. Producer thread inserts resource/element into the queue using put() method unless it gets full and consumer thread takes resources from the queue using take() method until it gets empty. But if a thread tries to dequeue from an empty queue, then a particular thread will be blocked until some other thread inserts an item into the queue, or if a thread tries to insert an item into a queue that is already full, then a particular thread will be blocked until some threads take away an item from the queue
- 15. threads are basically referred to as a service provider that provides services and support to user threads
- 16. basically a process in java that enables a simple strategy for avoiding thread interference and memory consistency errors
- 17. special kinds of variables created and provided by the Java ThreadLocal class. These variables are only allowed to be read and written by the same thread. Two threads cannot be able to see each other’s ThreadLocal variable, so even if they will execute the same code, then there won't be any race condition and the code will be thread-saf
- 18. As the name suggests, it is a non-static method that causes the current thread to wait and go to sleep until some other threads call the notify () or notifyAll() method for the object’s monitor (lock). It simply releases the lock and is mostly used for inter-thread communication. It is defined in the object class, and should only be called from a synchronized context
Down
- 1. thread synchronization construct that is usually required to control and manage the access to the shared resource using counters. It simply sets the limit of the thread
- 2. method of Object class specially used to perform cleanup operations on unmanaged resources just before garbage collection
- 4. It simply refers to the smallest units of the particular process. It has the ability to execute different parts (referred to as thread) of the program at the same time
- 5. a situation where multiple threads are blocked forever. It generally occurs when multiple threads hold locks on different resources and are waiting for other resources to complete their task
- 6. As the name suggests, it is a static method that pauses or stops the execution of the current thread for some specified period
- 7. It was introduced in Java 1.5 to store data using multiple buckets. As the name suggests, it allows concurrent read and writes operations to the map. It only locks a certain portion of the map while doing iteration to provide thread safety so that other readers can still have access to the map without waiting for iteration to complete
- 12. It is a tool that enables main threads to wait until mandatory operations are performed and completed by other threads. In simple words, it makes sure that a thread waits until the execution in another thread completes before it starts its execution. One cannot reuse the same CountDownLatch once the count reaches 0