L12 & L13 Flashcards

1
Q

How can we build concurrent data structure without locks?

A

Lock-free data structures

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

Which language is good for lock-free data structues?

A

Java because it has automated memory management

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

How can lock-free data structures result in an inconsistent state for enqueue?

A

CAS cannot perform 2 write accesses but enqueue needs to update tail.next and tail atomically

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

What does
if local_tail.next.compareAndSet(null, n)
do?

A

It keeps spinning until state is consistent.

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

True of false?

The lock-free approach is similar to the approach taken by load-linked/store-conditional.

A

True

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

What are the 2 main ideas for a lock-free approach? (what is done by the program)

A

1) a method saves the state of the lock-free data structure upon entry

2) the method responds appropriately depending on whether the state has changed or not

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

Why is implementing a lock-free data structure difficult in C/C++?

A

You never know when a dequeued node can be freed as another thread may still have a reference to it.

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

Which scales better: lock-free algorithms or lock-based algorithms?

A

Lock-free, but the code is harder to write

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

What are two standard parallel programming frameworks?

A

OpenMP (Open MultiProcessing)
MPI (Message Passing Interface)

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

What is MPI?

A

It is a set of basic functions used to create portable parallel applications, that relies on message passing for communication.

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

Can MPI be easily integrated into an exsiting application?

A

No, the application needs to be redesigned with MPI in mind to be ported.

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

What are ‘messages’ in the MPI framework?

A

rank of sending/receiving processes + tag for type

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

What functions are used to send and receive messages between processes?

A

MPI_Send and MPI_Recv functions

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

What are some collective operations in the MPI standard?

A

MPI_Barrier: barrier synchronisation
MPI_Bcast: broadcast
MPI_Scatter: broadcast parts of data to different processes
MPI_Gather: inverse of scatter
MPI_Reduce: a reduction operation

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

In MPI, the _______ operation is used to broadcast parts of data to different processes.

A

MPI_Scatter

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