• 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/32

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;

32 Cards in this Set

  • Front
  • Back
Three important atomicity requirements
1) Execution of a collection of ops is all or none
2) Interleaved executions appear to be indivisible
3) Update of a replicated object is atomic
Atomicity
Property in which actions completely occur, or do not occur at all
Durability
A committed transaction is permanent
Two phase commit protocol
A protocol that achieves all or none atomicity.
Transaction manager
Manages client transactions by making requests to the scheduler. Each client may have its own transaction manager. This allows separation of the transaction code from the client code.
Scheduler
Manages a concurrency control protocol. The protocol is either to prevent (locks), avoid (2PL with timestamps), or validate (optimistic concurrency control) transactions for consistency.
Two synchronization points in 2PC protocol
Pre-commit and commit
In 2pc, what records the status of a transaction if a failure occurs?
the activity log
In 2pc, who initiates voting?
The coordinator
How is the activity log used?
Activity log is replayed to recover after a failure, either to redo committed transactions or undo uncommitted transactions.
4 Steps of a 2pc from the coordinator perspective
Pre-commit
1) Write the precommit record into the activity log (tells the previous status if a failure occurs)
2) Multicast a vote request to all participants.
3) Participants receive the request, flush updates to the activity log, and respond. If the precommit test is positive, participants send a YES to the coordinator (or NO if failure).

Commit
4) If coordinator collects all YESs within the timeout, it commits the transaction by writing a commit to the activity log, releases the transactions resources, and sends a COMMIT to all participants.
Otherwise, the coordinator aborts the transaction and sends an ABORT to all participants.
Serializability
A series of interleaved actions are equivalent to that of a sequence of actions.
Basic idea of Locking, and 2PL for transactions
In locking, shared objects are locked before they can be accessed, and released before the end of a transaction. In 2PL a new lock cannot be acquired after the release of a lock.
What are the two phases of 2PL?
A growing phase, and a shrinking phase.
How is 2PL related to 2PC?
2PL extends the idea of 2PC into transactions with multiple shared resources.
What is the potential for deadlocks in 2PL?
When one resource is locked, and waiting for another resource. There could be someone else holding the other resource, waiting for a taken resource.
Why not release locks in 2PL as soon as we are done with that resource?
It could cause rolling aborts if something goes wrong after the first release.
What is strict 2PL?

What does it prevent?
In strict 2PL a transaction only releases its locks at commit or abort.

It prevents rolling aborts and simplifies the implementation.
Two ways to deal with deadlock in 2PL
1. Timestamp ordering: Each transaction receives a unique timestamp, older transactions then get priority over younger transactions to resolve conflicts.
2. Resource ordering. Resources are always acquired in some fixed order.
What kind of concurrency control approach is basic 2PL?
Pessimistic, we don't execute unless we get all the locks. Requires a lot of communication, but guarantees serialization.
Describe an optimistic concurrency control approach
With basic 2PL or just timestamp ordering, we only execute when all locks are acquired. To be more optimistic, we could assume we will get all the locks, then validate at the end. If one didn't acquire all the locks exclusively, just abort and try again. This could be done using a 2PC protocol.
What are the three stages of optimistic concurrency control?
1) Execution: create a local space, get a copy of all resources, and compute.
2) Validation: check if there was overlap for the used resources.
3) Update: If valid, send out the update to other processes.
2 basic election types:
1) extrema finding: based on a global priority
2) preference-based: based on voting by locality, reliability estimation, etc.
What is the difference between leader election and mutual exclusion?
In elections, a process may yield to other processes as long as someone succeeds. Whereas in mutual exclusion a process competes until it succeeds.
Describe a complete topology
Each process in a group can reach any other process.
Describe the bully algorithm
An extrema-finding election algorithm. Each process has a global priority, and the process with the highest priority is elected.
Describe a logical ring election
One process initiates a vote, then passes a token with his priority, each later process adds their priority and id, and when the originating process gets the token back, the one with the highest priority is elected.
Describe a tree topology election
Use a spanning tree as a structure, then broadcast to all nodes through the tree. Needs a minimum spanning tree to be effective.
3PC main difference from 2PC
Non-blocking. Places an upper bound on the amount of time required before a transaction commits or aborts. Guarantees locks are released after some timeout.
3PC disadvantage
Networks split into pieces would continue in pieces.
3PC Coordinator steps
1. Uncertain - receive request, send canCommit?

2. Prepared
If (failure, timeout, or No)
send abort
else //got yes from all
send preCommit

3. Committed
If (fails in prepared)
commit after timeout)
else if (all acks are received)
commit
3PC Client/Cohort steps
1. Receive canCommit?
If (agree)
send yes
else
send no

2. In prepared
if (abort, fails, or times out)
abort
else
//preCommit received
send ACK
Commit