Pipelining Flashcards

1
Q

What is a control hazard?

A

When a branch instruction changes the next instruction

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

What are the 4 ways to deal with a control hazard?

A
  1. stall the pipeline
  2. assume branch not taken
  3. branch prediction
  4. branch delay slots
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is stalling the pipeline?

A

When the CPU realises it is dealing with a branch instruction, stall the pipeline until we know what the next instruction is

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

What is assume branch not taken?

A

Assume the program didn’t take the branch and continue the pipeline as normal

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

What is branch prediction?

A

Same as branch not taken, however instead of always assuming the branch was not taken- we try to predict whether it will be based on previous branches

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

What is branch delay slots?

A

An instruction that follows a branch instruction that is useful and also independent of the result of the branch,. This will be executed until the program knows the result of the branch.

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

What is a data hazard?

A

A data hazard occurs when one instruction immediately uses the result of
another.

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

3 Types of data hazard

A

Read after write (RAW)
Write after read (WAR)
Write after write (WAW)

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

What is forwarding?

A

Required information is retrieved early from other pipeline register instead of the data register

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

How does spectre work?

A

Use speculative execution to access an array out of bounds and store a random value at the index of this value in a second array. Then access all the values and see which ones are accessed quickest. These will be the values that are stored in memory next to the array

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

How does meltdown work?

A

Similar to spectre, however instead of using a branch we raise an exception. Exceptions are slow and so the next instruction may still be evaluated under speculative execution.

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

Meltdown vs spectre

A

Spectre reads memory from other applications, whereas meltdown reads kernel memory from user space

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