Java代写 | Debugging Concurrent Systems

本次澳洲代写主要为Java多线程相关的限时测试

1 Debugging concurrent systems is particularly challenging because of which property?

Group of answer choices

parallelism

liveness

synchronization

non-determinism

 

2 How many synchronous communication channels are required to simulate asynchronous communication?

Group of answer choices

2

1

4

3

 

3 Interleaving is an abstraction that helps us to analyse the behaviour of concurrent systems. Which of the following statements about the interleaving abstraction is not true?

Group of answer choices

It ensures predictable behaviour.

It assumes only one event happens at a time.

It ignores real time.

It enables us prove correct behaviour.

 

 

4 A cargo port contains 3 container ships. Each ship requires 3 tugboats in order to dock or undock. What is the minimum number of tugboats that will prevent deadlock from occurring (ie, no container ship being able to acquire the required number of tugboats)?

Group of answer choices

7

8

9

6

 

5 A semaphore S is initialised as (8, {}) (ie, with 8 access permits).

S.wait() is executed 6 times, following which S.signal() is executed 4 times.

How many access permits does S have after this?

Group of answer choices

8

6

10

0

 

 

 

6 Two processes P and Q share access to an Boolean variable x and a binary semaphore S:

We assume a fair scheduler, such that each process will eventually finish running its code. Which of the following outputs is not possible?

Group of answer choices

qpq

qpqqq

pqq

qqqpq

 

7 Question 72.5 pts

Three concurrent processes P, Q and R each execute a critical section of code within which shared variables are accessed and modified. The processes use four binary semaphores named a, b, c and d (each initialised to 1) to control access to the critical section.

Semaphores are obtained one at a time, by executing wait().

Process P needs to obtain semaphores a, b and c to execute its critical section.

Process Q needs to obtain semaphores b, c and d to execute its critical section.

Process R needs to obtain semaphores c, d and a to execute its critical section.

After it finishes executing its respective critical section, a process releases all three semaphores, by executing signal().

In which order should each process acquire their semaphores to prevent deadlock from occurring?

Group of answer choices

P: a, b, c; Q: b, c, d; R: c, d, a

P: b, a, c; Q: b, c, d; R: a, c, d

P: a, b, c; Q: c, b, d; R: c, d, a

P: b, a, c; Q: c, b, d; R: a, c, d