Multithreading Flashcards

1
Q

what does a thread comprise of

A

id, counter, register and stack

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

Threads within a process share what

A

code, data+files, signals etc

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

User threads

A

supported above the kernel and managed without kernel support, primarily by user-level threads library

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

Kernel threads

A

supported and managed directly by the OS

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

many to one mapping

A

many user threads to one kernel thread
Pure used level thread implementation
If one thread blocks then all block

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

one-to-one mapping

A

creating a user level thread creates a kernel thread - more concurrency no. threads per process is usually restricted

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

Many to many mapping

A

many user level threads to be mapped to equal no. or smaller no. of kernel threads
Allows OS to create a sufficient number of kernel threads.

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

PThreads

A

Threads that may either be provided as user-level or kernel level threads
Specifications not implementations
POSIX standard API thread creation and synchronization

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

Implicit threading

A

creating and management of threads are done by a compiler

- create tasks that gets mapped onto a framework -e.g. java fork() join()

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

Name and explain the 2 approaches to thread cancellation

A

Asynch - terminates thread immediately
Deferred - allows target thread to periodically check if it should be cancelled, allows the thread to terminate in an orderly fashion.

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

Why could asynchronous cancellation of threads be dangerous

A

when resources allocated to a cancelled thread are either not released or are in an unsafe state

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