• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/125

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

125 Cards in this Set

  • Front
  • Back
If you pre-order statements to make sure deadlock doesn't occur, is this deadlock avoidance or prevention?
Prevention because it is statically known that the ordering can't deadlock
Is graph reduction deadlock avoidance or prevention?
Avoidance because graph reduction occurs at execution time.
Is using the Banker's algorithm deadlock prevention or avoidance?
Avoidance because the algorithm is executed at runtime.
What do Linux, OSX, and Windows do about potential deadlock?
Nothing!
What is the difference between daisy chain and multiple signalling?
Daisy chain signalling is when one blocked task unblocks the next blocked task after it is unblocked. Multiple signalling is when blocked tasks are woken by a single task.
Why is the implicit signal monitor expensive to use?
Because whenever the monitor changes state (block or return), all blocked tasks must be woken so they can check their condition variables.
What is a barging task with respect to a mutex object?
Barging occurs when a task outside the monitor is implicitly scheduled before a task schedulable inside the monitor.
What is a common solution to deal with bargers? What is the problem with this solution?
Enclose the wait in a while loop, rechecking the condition when it wakes. However, this is busy-waiting with potential starvation.
Why does an administrator always use signalBlock for synchronization?
It forces the worker task to execute next so it can exit the mutex object with new work.
What are the purpose of tickets in an asynchronous call?
To identify a a returning client to a server so the server can return the value it computed for the client
What is the difference between explicit-storage-management and implicit-storage-management futures?
explicit storage management futures must be allocated and deallocated explicitly by the client, whereas the implicit version is automatically allocated and freed when no longer in use.
suppose we have:



_Select( future1);




foo();




What are the conditions for foo to execute?

future1 must be available.
What needs to be true for execution to continue past:



_Select( f1 || f2) ?

Either f1 or f2 must be available.
What takes precedence, || or &&?
&&
Explain what this statement does.

_Select(f1 || f2 && f3)

Execution continues only when future f1 is available, or both f2 and f3 are available.
When a task accesses a future, an an exception is delivered instead of a value, is the exception synchronous or asynchronous?
Synchronous because the task accessing the future triggers the exception on its own stack.
What does the type qualifier volatile mean?
The variable's value is always fetched from or stored to memory on each access.
What is a watchpoint and how is it used for concurrency?
A watchpoint is when the hardware is told to watch a memory location for changes. A watchpoint is used in concurrency to know if a copied value is still the same at a later time, indicating if it is safe to change the value.
What is the disadvantage of the requeue mechanism to simulate internal scheduling via external scheduling?
Dealign with temporary computations and execution location that must be manually remembered as part of the queue.
Why is a library approach to concurrency, like pthreads, potentially unsafe?
The compiler doesn't know the program is concurrent, so it can perform sequential optimizations, which invalidates the library usage.
When creating and joining threads using pthreads, what is the most significant problem?
Transferring arguments and returning a result is not statically type-safe.
Why is there a tension between concurrent programmers and hardware engineers with respect to the memory model?
Concurrent programmers don't want sequential optimizations to invalidate their programs, while hardware engineers want to perform sequential optimizations.
Why is transferring data from one computer to another a problem?
The data may be in incompatible formats.
How do we perform internal scheduling with send/receive/reply?
The receiver doesn't have to reply immediately. It can keep the sender blocked and reply at some later time (it has the senders pid)
There is an administrator who takes requests to getClient or getTaxi. When it receives a call to close, it cleans up and terminates. What does the structure of its while loop look like?

Tasks A and B call A(), B() in a monitor to exchange values. Write A(), B() using internal scheduling.
Tasks A and B call A(), B() in a monitor to exchange values. Write A(), B() using external scheduling.
Tasks A and B call A(), B() in a monitor to exchange values. Write A(), B() using implicit scheduling (waitUntil)
Suppose we have a list of taxis and a taxi-pointer iterator for that list. How do we get the id of the first taxi in the iterator, then delete that taxi from the list?
(*iterator)->id

taxis.delete( iterator )

If there are available taxis and waiting clients, we want to satisfy a client by delivering its taxi future (ftaxi). Taxis are waiting on their 'idle' condition variable. When they wake, they examine xclient and yclient to determine where to go. Calling nearestTaxi(LocnClient*, list
How to we print a message inside a monitor?
osacquire(cout) << "message!" << endl;
Suppose we have a list of LocnClient with futures ftaxi. How do we mark the futures with a Closed exception and delete the clients?


Suppose we have a list of Taxi tasks. When they call getClient, they become blocked on a condition variable idle in LocnTaxi. We want to tell all taxis to go home by setting xclient and yclient to -1.

Suppose we don't want to let bargers pass through the entry code of a method before its their turn. How can we do this?
We're writing a barrier monitor. Bargers won't process past the entry code unless ticket < serving. Once count reaches N, we release the blocked task. Write the main body of code.
Write the full code for a barrier with internal scheduling and bargers.
Write the code for a barrier monitor with implicit scheduling. WAITUNTIL( cond ), RETURN
When does staleness occur in the readers writers problem?
When the arrival time of a reader's task read is newer than the arrival time of a waiting writer task. So, it should really read the value that the writer writes, but the writer hasn't written yet.
When does freshness occur in the readers writers problem?
When the arrival time of a writer's task write is newer than the arrival time of a waiting reader task. So, the reader will read the new value, when it really shouldn't.
What is staleness?
Reading an old value, ex:

W1 W2 R1




R1 reads W1 instead of W2.

What is freshness?
Reading a future value, ex:

W1 R1 W2




R1 reads W2 instead of W1.

The following code sequence exists in the entry protocols for readers/writer implemen- tations, where the baton is put down and a thread blocks:



entry.V(); X.P(); // X is some semaphore




Explain, in general, how this code sequence may result in staleness or freshness.

Entry is like the baton.

Thread 1 puts down baton, but is time-sliced before X.P().




Thread 2 puts down baton, but is not time-sliced, so it blocks on X.




Thread 1 restarts and blocks on X.




Threads 1 and 2 are now out of order.

What are the 3 new kinds of errors introduced by concurrency?
1. Deadlock

2. Livelock


3. Race

How can nested monitor calls result in deadlock? (i.e. a call from one monitor into another)
Task calls into monitor M1, which makes a call to monitor M2. Task waits in M2, which release the lock on M2, but it still holds a lock to M1. Another task can't signal X because it can't get into M2 via M1.
What are two scenarios when using a _Nomutex member is useful?
1. For read-only routines

2. For combining a multi-step protocol into a single routine, where some of the steps need to release the monitor lock.

Why do we not want an abstraction with a thread and no stack?
A thread can't execute without a stack.
Why might we not want an abstraction with a thread and stack, but no mutual exclusion/synchronization?
All synchronization/mutual exclusion would have to be handled explicitly using locks.
What is the purpose of a _When clause on an _Accept clause?
Provides a condition on acceptance
Rewrite the following without using a _When clause:



_When ( a > b ) _Accept( c )

if ( a > b ) _Accept( c )
What is the difference between direct and indirect communication?
Indirect communication occurs through a third party. For example, task <-> monitor <-> task.



Direct communication occurs directly between tasks, i.e. task <-> task

Why must we use a flag variable when an administrator needs to return an exception for a client call?
The client has to be unblocked so it can raise the exception on its stack, instead of the server's.
A future implementation needs the following 3 fields:


uSemaphore resultAvailable;


future *link;


ResultType result;




Explain the purpose of each field.

Block client if result not available.



Link futures so server can buffer them for processing.




Result after computed by server.

What is disjoint reordering with respect to optimization?
Ability to reorder reads and writes on different variables.
How do connectionless and connection-oriented communications differ with respect to packet addressing?
All connectionless packets carry their dest address, while connection-oriented don't after a connection is established.

What are two ways to handle pointers in remote procedure calls?

1. Marshal the entire linked data structure (traversing all pointers) and copy the list


2. Use long pointers between address spaces and fetch data only when the long pointer is dereferenced.

What execution property are concurrent programmers willing to give up so caching can work efficiently?

Reading up to date values (state values may be read)

How can disjoint reordering cause a concurrent program to fail? Give an example.

me = WantIn // Write


while ( you == WantIn ) { // Read




interchanging would mean that both threads read DontWantIn, set wantIn and proceed (ruins mutual exclusion).

C++ 11 threads are implemented by pthreads. What threading model does this use and what is the disadvantage?

1:1 model; can't create large numbers of kernel threads

Explain the kind of concurrency supported by #pragma

concurrent system provides concurrency through implicit constructs, which a programmer uses to build a concurrent program (indirect access to threads)

In ADA:


out("blah") writes a tuple to user space


in ("bleh") (blocking) removes a tuple from user space. Build mutual exclusion and synchronization from these constructs.

Mutual exclusion:


out("semaphore);


....




in("semaphore")


// CS


out("semaphore")




Synchronization:


Task 1:


in("semaphore)


S2




Task 2:


S1


out("semaphore")

A producer and a consumer add and remove from the same shared queue. Should the queue be an array or a linked list? Why?

An array. If it's a linked list, they could be manipulating the same data element simultaneously. (Eg. add, blah.next = ..., while blah is being removed)

If there is maximum concurrency, what does this say about the critical section?

It's as small as possible.

What is a split binary semaphore?

A collection of semaphores where at most one has the value 1.

When are split binary semaphores used?

When different kinds of tasks have to block separately.

What technique is used with split binary semaphores to solve mutual exclusion problems?

Baton passing

What are the rules of baton passing?

1. There is exactly one baton


2. Nobody moves in the entry/exit code until they have it.


3. Once the baton is released, cannot read/write variables in the entry/exit code

In baton passing, who passes the baton and who implicitly picks it up?

Signaller implicitly passes it to signalled

What are two goals of the readers/writers problem solution?

1. Serialize writes


2. As many readers as you want

What happens in the following statement?


REGION v DO


AWAIT NOT EMPTY v

Lock is acquired, but if the condition in await is false, the lock is released and entry is re-started (busy waiting)

What problem is solved by having an atomic counter monitor with increment/decrement functions?

Won't suffer from time slicing issue because operations are atomic

External scheduling is simple because unblocking is....

implicit

A task is inside a monitor and calls x.wait(). What 3 things happen?

1. Executing task is placed atomically at the back of the condition queue


2. Releases monitor lock


3. Another task can enter

what does uCondition.front() return?

The integer call stored with the waiting task at the front of the condition queue

How is termination synchronization accomplished in java?

calling join()

How do we retrieve values from a terminated java thread?

It becomes an object, so we can call thread.blah

What does it mean for a java class member to be synchronized? Why is it incorrectly named?

It's mutex; i.e. it's mutually exclusive, not synchronized

What is deadlock avoidance?

Monitoring all lock blocking and resource allocation to detect any potential formation of deadlock.

What is one disadvantage and one advantage of deadlock prevention over deadlock avoidance?

Advantage: better resource utilization


Disadvantage: additional overhead/processing to avoid deadlock

To run the Banker's algorithm, what must processes state?

Their maximum resource needs

What are 2 disadvantages of detecting deadlock via resource allocation graphs?

1. For lots of processes and resources, detecting cycles is expensive


2. Lots of graphs must be examined; one for each particular allocation state of the system

When are allocation graphs constructed?

At each moment a resource is allocated

What are two requirements for deadlock detection and recovery?

1. Ability to discover deadlock


2. Preemption

How is deadlock recovery implemented?

Preemption of one or more processes in a cycle

Are public member of a task implicitly mutex or nomutex?

mutex

What does external scheduling facilitate in task communication?

Allows direct calls to task's mutex members (task blocks during this)

Why are accept statements in tasks in the main, not member routines?

Because the task's thread starts in main; a monitor doesn't have a thread

What can we do to keep public mutex methods as short as possible?

do the absolute minimum about of work in the method, and the bookkeeping in the block after the accept statement.

If a task accepts its destructor, when is the destructor executed after it's called?

After the the caller is popped off the accepted/signalled stack (i.e., after exiting the main)

What is the potential problem is _Accept( insert, remove)

insert is prioritized, so there is potential starvation for consumer.

To maximize concurrency, how should the number of clients and workers relate?

1:1

What are 3 approaches for asynchronous client/server calls?

1. Tickets


2. Callback routines


3. Futures

How to tickets work (asynchronous call)?

Client makes call to serve specifying work and is returned a ticket immediately. Later, it passes the ticket to retrieve the result and blocks or polls if it's not ready.

What are 2 possible problems with using ticket for asynchronous client/server calls?

1. Client may use same ticket twice


2. Client could forge ticket and retrieve someone else's work

How do call-back routines work?

The client passes a routine to be called when the work is done. The routine must not block the server, only store the value and set an indicator. The client must poll the indicator or block until it is set.

What are two advantages of call-back routines?

1. Server can drop off value immediately, instead of storing it.


2. Client writes the callback routine, so they can decide to block/poll/both.

List 2 ways a future is different from a ticket or callback routine.

1. No explicit protocol


2. Only one call must be made, not 2.

Rewrite the following without or/and:


(_Select(f1)


_or (_Select(f2)


_and(_Select(f3))

_Select(f1 || (f2 && f3))

Explain LL(load-locked) and SC (store conditional) in MIPS.

LL loads value into register and establishes a watch point. SC writes value to memory location, but only if no interrupt, exception, or write has occurred at LL watchpoint (sets register with value to be stores to 0 if so).





Write Node *pop(header &h) using LL and SC.

How does SC differ from CAA?

SC detects a change to a value, rather than indirectly checking if value has changed by comparing it.

Suppose we have an 'atomic' command that executes a block atomically. Write void push( header &h, node &n).

void push(header &h, node &n) {


atomic {


node.next = h.top;


h.top = &n;


}


}


What is a drawback of goroutines in go?

No direct communication because you can't reference a coroutine object.

How do threads communicate/synchronize in Go?

Through a channel.

What is a limit on the when clause in Ada?

It can only contain global variables.

How is waiting on a condition variable different than using a require statement in ada?

Condition variables automatically save the execution location and any partially computed state, whereas requeing doesn't.

How do threads communicate in Linda?

Adding, removing, reading data from tuple space.

What is an actor?

An administrator that accepts messages. It handles them, or sends them to a worker in a fixed open pool.

How do clients communicate with Actors?

Through a mailbox; an untyped queue of messages. The clients put messages in the queue, the admin reads them and delegates them.

List 2 differences between Scala and uC++

1. Dynamic(scala) vs static(uC++) communication


2. Scala sends messages asynchronously; uC++ has synchronous calls

Open MP has what type of threading model?

1:1

What is an executor?

A server with one or more worker tasks

What does a call to submit in an executor return?

It returns a future (asynchronous)

What does it mean for two programs to be isomorphic?

They produce the same result

How can we share data among programs?

Use a cache

What is a problem with multiple caches in a concurrent program?

Variable appears in multiple caches. When a thread writes changes to local cache, it invalidates copies in other caches.

What are possible methods to type check parameters and arguments in remote calls?

1. Dynamic check (additional CPU power, runtime errors)


2. Persistent symbol table that describes called interface

Give 2 ways message passing is different from parameter passing.

1. Information grouped into a single data area


2. Data passed by value

In RPC, why use receive any instead of receive specific?

Can have multiple producers

What is one advantage and one disadvantage of fixed-sized messages?

Advantage: easy implementation


Disadvantage: requires long messages to be broken up



What is one advantage and one disadvantage of variable-sized messages?

Advantage: easy to use


Disadvantage: more difficult implementation

What does typed messaging require?

Dynamic type checking

What is the two army problem?

Two perfect processes with imperfect communication

What is the byzantine general problem?

Imperfect process that lies about group strength

What are the steps in an RPC?

1. Local call from client to client stub


2. Stub collects arguments and marshals into a message, passes to local transport entity


3. Transport entity sends message to server transport entity


4. Server transport entity passes message to server stub


5. Server stub unmarshalls message and calls local routine


6. Server performs operation, returns result to stub


7....and back we go.

Who is awesome?

That's right, you are.