1/13
These flashcards cover key concepts related to processes, threads, liveness, synchronization, concurrent programming, and testing in Java.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What is the primary difference between a process and a thread?
A process runs independently and has its own memory, while a thread is a smaller unit within a process that shares memory with other threads in the same process.
In Java, what does a process represent?
A running JVM instance.
What is the state of a thread when it is created but not started?
NEW.
What are the possible states of a thread in Java?
NEW, RUNNABLE, BLOCKED, WAITING, TIMED_WAITING, or TERMINATED.
What happens when a thread enters the BLOCKED state?
The thread is waiting to acquire a lock.
What is liveness in the context of programming?
Liveness refers to the condition where things keep working in a program.
What is deadlock?
A situation where two threads wait forever for each other.
What is a Critical Section in multi-threading?
The part of code where shared data is changed.
What is the purpose of synchronization in multi-threading?
To ensure that threads take turns when accessing shared data to avoid inconsistencies.
What is a Producer/Consumer pattern?
A pattern where one thread puts data into a shared buffer while another thread takes it out.
What does the 'Callable' interface do in Java?
Similar to Runnable, but it can return a result or throw an error.
What is Mutation Testing?
A technique where small changes are made to the code to see if tests can detect them, helping to improve test coverage and reveal hidden problems.
What is atomicity in multi-threading?
An operation is atomic if it is indivisible, meaning it either happens completely or not at all.
What is ThreadMXBean in Java?
A part of the Java Management Extensions (JMX) API that provides detailed monitoring and management of threads in the JVM.