Threads Synchronization Flashcards
1
Q
What is a thread?
A
A lightweight subprocess, shares resources with other threads.
2
Q
Thread vs process?
A
Thread is smaller, shares memory; process is isolated.
3
Q
Java thread states?
A
New, Runnable, Blocked, Waiting, Timed Waiting, Terminated.
4
Q
What is the critical section problem?
A
Multiple threads accessing shared resource concurrently.
5
Q
Solution requirements for critical section?
A
Mutual exclusion, progress, bounded waiting.
6
Q
Define race condition.
A
Outcome depends on execution order of threads.
7
Q
What is a semaphore?
A
A variable used to control access to a resource.
8
Q
What is a monitor?
A
High-level construct for synchronisation.