• No results found

Resit Concurrency & Multithreading VU University Amsterdam, 14 January 2015, 18:30-21:15

N/A
N/A
Protected

Academic year: 2021

Share "Resit Concurrency & Multithreading VU University Amsterdam, 14 January 2015, 18:30-21:15"

Copied!
2
0
0

Bezig met laden.... (Bekijk nu de volledige tekst)

Hele tekst

(1)

Resit Concurrency & Multithreading

VU University Amsterdam, 14 January 2015, 18:30-21:15

(At this exam, you may use the textbook of Herlihy and Shavit. Answers can be given in English or Dutch.

Use of the slides or a laptop is not allowed.)

(The exercises in this exam sum up to 90 points; each student gets 10 points bonus.)

1. Suppose the FIFO queue class is augmented with a peek() method that returns but does not remove the first element in the queue. Show that this augmented queue

has infinite as consensus number. (10 pts)

2. Consider the construction of an atomic MRSW from atomic SRSW registers. Sup- pose that the atomic SRSW registers are replaced with regular SRSW registers.

Give an example to show that then the construction no longer yields an atomic

MRSW register. (12 pts)

3. In the MCS queue lock, a thread that wants the lock, first sets locked of its own node to true, and then redirects next of its predecessor to its own node. Suppose this order would be reversed. Give a scenario to show that then the MCS queue

lock could deadlock. (10 pnts)

4. Explain for the following two statements what could go wrong, and how it can be improved.

(a) if (x > 0) condition.await();

(b) if (x == 0) condition.signal(); (9 pts)

(2)

5. Give a scenario for the optimistic synchronization implementation of list-based sets in which a thread is forever attempting to delete a node. (10 pts)

6. Consider the unbounded lock-free stack in Section 11.2 of the textbook. Give a scenario to show that in the absence of proper garbage collection, the ABA problem could arise in the pop() method. Also explain how (the implementation of) the unbounded lock-free stack could be adapted to avoid this ABA problem.

(12 pts)

7. Give a highly parallel multithreaded algorithm for multiplying an n × n matrix by a length-n vector, which achieves work Θ(n2) and critical path Θ(log2n). Analyze the work and critical-path length of your algorithm. (15 pts)

8. Give a (Java pseudocode) implementation of pop() and push() methods for a

bounded transactional stack. (12 pts)

Referenties

GERELATEERDE DOCUMENTEN

(b) Prove that the formula 22p→2p is not valid in the frame (Z, <), the integer numbers ordered by the usual less-than relation <.. System T is the extension of the minimal

(An informal proof suffices.) (5 pt) (b) Draw the first three levels of the tree unravelling (or unfolding) of F 2 taking.. state A as

Give a scenario (including reads and writes to variables) of the CLH lock with timeouts in which initially the lock is free, four threads concurrently want to take the lock, two of

Suppose that in the 2-thread consensus protocol using a FIFO queue (Figure 5.7 on page 107), a thread first dequeues an element from the queue, and then writes its value in its slot

In this regard Vinik & Levin (1991:57) provide yet another valuable answer: “determines whether the appropriate level is „case‟ or „cause‟, whether a

duidelijk zijn dat dit vanwege de complexe structuur van een onder- neming en de vaak nauwelijks def inieerbare en kwantificeerbare omgevingsfactoren een zeer

Aangezien we echter niet blind mogen blijven voor de mogelijke bedreigingen van het archeologisch patrimonium zal een kort overzicht gegeven worden van frequent

Because hedging in the forward exchange market means replacing an unknown future spot rate (si+n) by a known forward exchange rate (fin), most businessmen