Threads Synchronization Flashcards

1
Q

What is a thread?

A

A lightweight subprocess, shares resources with other threads.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Thread vs process?

A

Thread is smaller, shares memory; process is isolated.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Java thread states?

A

New, Runnable, Blocked, Waiting, Timed Waiting, Terminated.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the critical section problem?

A

Multiple threads accessing shared resource concurrently.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Solution requirements for critical section?

A

Mutual exclusion, progress, bounded waiting.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Define race condition.

A

Outcome depends on execution order of threads.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a semaphore?

A

A variable used to control access to a resource.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a monitor?

A

High-level construct for synchronisation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly