Threads Flashcards

1
Q

Kernel Thread

A

Created and scheduled by the three. Can run in parallel in a multi-processor system since it is scheduled by the kernel scheduler.

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

User Thread

A

Created and managed (scheduled) completely by the threading library it is using. This means that the single parent process has many threads that are scheduled by that same process.

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

Many-to-One

A

Many user level threads are mapped to a single kernel thread and the their management is done by the library.

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

One-to-One

A

Each user thread is mapped to a single kernel thread. Meaning the management is done by the kernel.

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

Many-to-Many

A

Many user threads are mapped to many kernel threads. Allows the OS to decide how many kernel threads are needed.

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

Threads in Linux

A

No concept of threads. Each thread is just a process that shares resources with other processes.

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

Pthreads

A

A POSIX standard API for creating and syncing os user and kernel level threads.

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

Thread cancellation - two methods

A

Async: Cancels the thread immediately. Causes issues like unfreed resources and corrupt data.
Deferred (sync): The thread periodically checks if it should stop, giving it the chance to do any necessary cleanup.

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

Thread Pool

A

Create in advance N threads and have them waiting in a ready pool. When a new task arrives, use one of the existing threads to take care of it. Faster than creating a new thread or each task.

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