P2L2 Flashcards

1
Q

Benefits of Multithreading

A

Parallelization
Specialization
Efficiency

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

Context switch formula

A

if (t_idle) > (2*(t_ctx_switch))

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

Multi-threaded OS Kernel has..

A
  • threads working on behalf of apps

- OS-level services like daemons or drivers

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

what the OS needs to support Threads

A

Thread data structure
mechanisms to create and manage threads
mechanisms to safely coordinate among threads

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

Synchronization Mechanisms

A
  • Mutual exclusion
  • Waiting on other threads
  • Waking up other threads from wait state
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Bizzell Thread Type

A

thread ID, Program Counter (PC), Stack Pointer (SP), registers, stacik, attributes

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

Mutex

A

a lock

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

Critical Section

A

code blocked by mutex

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

Signal

A

notify one thread waiting on condition

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

Broadcast

A

notify all threads waiting on condition

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

spurious wake-ups

A

when threads are woken up when they may not be able to proceed

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

Deadlock

A

two or more competing threads are waiting on each other to complete, but none of them ever do

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

Options to prevent deadlock

A
Deadlock prevention (EXPENSIVE)
Deadlock detection and recovery (ROLLBACK)
Ostrich Algorithm (DO NOTHING)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Kernel vs User level thread

A

User-level thread must be associated with kernel level thread, then OS scheduler must schedule kernel-level thread

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

Multithreading Models

A

One-to-one
Many-to-one
Many-to-many

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

One-to-one model

A

OS sees / understands threads, synchronization
Must go to OS for all operations
Negative: portability

17
Q

Many-to-one model

A

Totally portable
Negative: OS has no insight into app needs
OS may block entire process if one user-level thread blocks

18
Q

Many-to-many model

A

Can have bound or unbound threads

Negative: requires coordination between user-level and kernel-level thread managers

19
Q

Types of thread scope

A

System and Process

20
Q

System Scope

A

system-wide thread management by OS-level thread managers

21
Q

Process Scope

A

user-level library manages threads within a single process

22
Q

Multi-threading Patterns

A

Boss/Workers
Pipeline
Layered

23
Q

Boss/Workers

A

Boss assigns work
Workers perform work (limited by boss performance)
throughput = 1 / boos_time_per_order

24
Q

Pipeline

A

Entire task == pipeline of threads
Throughput == weakest link
Shared-buffer based comm. b/w stages

25
Q

Layer Pattern

A

each layer group of related tasks
Not suitable for all applications
Synchronization