P2 L5: Thread Performance Considerations Flashcards

1
Q

How do you calculate the average time to complete a task for the worker-boss threading model?

A

Total processing time = num_workers * time for first badge of tasks to complete + num_workers * * time for second badge of tasks to complete (this is + the time spent waiting for first batch to complete!)

–> then divide by number of tasks

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

How do you calculate the average time to complete a task for the pipeline threading model?

A

n/2 * (a(1) + a(n)). –> then divide by number of tasks

N is the amount of tasks.
a(1) is the time it takes for the first task to run through the whole pipeline.
a(n) is the time it take for the last thread (has to wait for all previous threads).

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

How do you calculate the execution time for the worker-boss threading model?

A

time_process_task * ceil(tasks / workers).

6 thread = 5 workers ONLY + 1 boss!

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

How do you calculate the execution time for the pipeline threading model?

A
  • First task takes 6 * 20 = 120 ms
  • then each consecutive task is finished 20 ms later!

Calculation: 120 + 20 * 10 = 320 ms

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

When do threads add pure overhead

A

2 * context_switch > processing time needed
-> e.g serving a very small file already cached in RAM

A program that has to run sequentially! (no concurrent design possible!)

Adding more threads than CPUs/cores when there is no I/O to be done (advantage of thread would be to wait till interrupt when I/O is done)

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

Why overall are threads useful (not metrics)

A

Parallelization => speed up
Specialization => hot cache
Efficiency => lower memory requirement (smaller PCP to context switch and copy). + cheaper synchronization (no need for IPC via message passing or shared memory)

Threads hide the latency of I/O operations!!

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

What is a performance metric

A

=> measurement standard

  • measurable
  • quantifiable
  • for the system, we are interested in
How well did you know this?
1
Not at all
2
3
4
5
Perfectly