SlideShare a Scribd company logo
1 of 8
Download to read offline
Assignment 5 - Solution
Problem 1
Consider a system that uses the two-phase commit protocol with
the cooperative termination protocol and no other optimizations.
Assuming there are two participants (P1 and P2) and a
coordinator (C), for each of the following either describe an
execution scenario or explain why it cannot happen:
C
P1 P2
1.A P1 and P2 are blocked.
C sends “prepare-to-commit”
P1 & P2 send “yes-prepared”
C crashes, which leaves P1 and P2 blocked.
C
P1 P2
1.B. Only P2 is blocked.
1. C sends “prepare-to-commit”
2. P1 & P2 send “yes-prepared”
3. Communication failure at P2
• P1 and C terminate the protocol
• P1 and C crash
• P2 is blocked
1. C sends “prepare-to-commit”
2. P1 & P2 send “yes-prepared”
3. P2 crashes
• P1 and C terminate the protocol
• P1 and C crash
• P2 is recovers and is blocked
1.C C is blocked.
This cannot happen.
The coordinator can always unilaterally abort an undecided tx.
C
P1 P2
Problem 2
Suppose there are n processes involved in 2PC, where process 1 is
the transaction’s home. Suppose the processes are arranged in a
chain (NOT a ring), so that each process can only communicate with
adjacent processes in the chain.
That is, process 1 can communicate only with process 2, process n-1
can communicate only with process n, and for each i where 1<i<n,
process i can communicate only with processes i-1 and i+1.
1 i-1 i i+1 N
2.A Devise a version of the 2PC protocol for this arrangement
of processes that uses 2n – 2 messages to commit a
transaction.
Process 1
Starts the commit activity.
Prepares, then sends a Request-to-Prepare to Process 2.
Process 2
Prepares, then sends a Request-to-Prepare to 3.
…
Process n
Receives a request to prepare
It commits
Sends a Commit message to n-1.
2.b. In the protocol you devised in (a), is there any process
that is never in an uncertainty period?
Yes, Process n.
2.C In the protocol you devised in (a), what action commits
the transaction?
The log write of a commit record at process n effectively
commits the transaction.
2.D Explain how to modify the protocol to speed up the
protocol in the event that a process votes No.
A process that votes No
should send Abort to its two neighbors (if present),
including lower and higher numbered processes.
The lower-numbered neighbor should propagate the abort back
toward process 1.
The higher-numbered neighbor should propagate the abort up
toward process n.

More Related Content

Viewers also liked

Viewers also liked (12)

10a log
10a log10a log
10a log
 
pics
picspics
pics
 
MarkH-CV 2015
MarkH-CV 2015MarkH-CV 2015
MarkH-CV 2015
 
Transactions
TransactionsTransactions
Transactions
 
Dynamic Power of QFT - Copy
Dynamic Power of QFT - CopyDynamic Power of QFT - Copy
Dynamic Power of QFT - Copy
 
15 bufferand records
15 bufferand records15 bufferand records
15 bufferand records
 
21 domino mohan-1
21 domino mohan-121 domino mohan-1
21 domino mohan-1
 
03 fault model
03 fault model03 fault model
03 fault model
 
Assignment1.2012
Assignment1.2012Assignment1.2012
Assignment1.2012
 
05 tp mon_orbs
05 tp mon_orbs05 tp mon_orbs
05 tp mon_orbs
 
UPDATED INTERVIEW GUIDE
UPDATED INTERVIEW GUIDEUPDATED INTERVIEW GUIDE
UPDATED INTERVIEW GUIDE
 
Emerging Trends and Tech
Emerging Trends and TechEmerging Trends and Tech
Emerging Trends and Tech
 

Similar to Solution5.2012

Distributed system TimeNState-Tanenbaum.ppt
Distributed system TimeNState-Tanenbaum.pptDistributed system TimeNState-Tanenbaum.ppt
Distributed system TimeNState-Tanenbaum.pptTantraNathjha1
 
3 distributed transactions-cocurrency-query
3 distributed transactions-cocurrency-query3 distributed transactions-cocurrency-query
3 distributed transactions-cocurrency-queryM Rezaur Rahman
 
Ch17 OS
Ch17 OSCh17 OS
Ch17 OSC.U
 
Distributed Coordination
Distributed CoordinationDistributed Coordination
Distributed Coordinationsiva krishna
 
enc=encoded=TlJst0_SHq0cPRhLS74QDXTP4FpU303sSqpyVVkfhckA93UCiZrRF0QVNAFGmuGu9...
enc=encoded=TlJst0_SHq0cPRhLS74QDXTP4FpU303sSqpyVVkfhckA93UCiZrRF0QVNAFGmuGu9...enc=encoded=TlJst0_SHq0cPRhLS74QDXTP4FpU303sSqpyVVkfhckA93UCiZrRF0QVNAFGmuGu9...
enc=encoded=TlJst0_SHq0cPRhLS74QDXTP4FpU303sSqpyVVkfhckA93UCiZrRF0QVNAFGmuGu9...DHANUSHKUMARKS
 
Chapter 18 - Distributed Coordination
Chapter 18 - Distributed CoordinationChapter 18 - Distributed Coordination
Chapter 18 - Distributed CoordinationWayne Jones Jnr
 
Distributed System by Pratik Tambekar
Distributed System by Pratik TambekarDistributed System by Pratik Tambekar
Distributed System by Pratik TambekarPratik Tambekar
 
Practical Byzantine Fault Tolernace
Practical Byzantine Fault TolernacePractical Byzantine Fault Tolernace
Practical Byzantine Fault TolernaceYongraeJo
 
Computer network (13)
Computer network (13)Computer network (13)
Computer network (13)NYversity
 
Mitigating SIP Overload Using a Control-Theoretic Approach
Mitigating SIP Overload Using a Control-Theoretic ApproachMitigating SIP Overload Using a Control-Theoretic Approach
Mitigating SIP Overload Using a Control-Theoretic ApproachYang Hong
 
Transaction Processing Monitors (TPM)
Transaction Processing Monitors (TPM)Transaction Processing Monitors (TPM)
Transaction Processing Monitors (TPM)Peter R. Egli
 
Cpu scheduling qusetions
Cpu scheduling qusetionsCpu scheduling qusetions
Cpu scheduling qusetionsJasonMarandi1
 

Similar to Solution5.2012 (20)

slides.06.pptx
slides.06.pptxslides.06.pptx
slides.06.pptx
 
Distributed system TimeNState-Tanenbaum.ppt
Distributed system TimeNState-Tanenbaum.pptDistributed system TimeNState-Tanenbaum.ppt
Distributed system TimeNState-Tanenbaum.ppt
 
3 distributed transactions-cocurrency-query
3 distributed transactions-cocurrency-query3 distributed transactions-cocurrency-query
3 distributed transactions-cocurrency-query
 
Ch17 OS
Ch17 OSCh17 OS
Ch17 OS
 
OSCh17
OSCh17OSCh17
OSCh17
 
OS_Ch17
OS_Ch17OS_Ch17
OS_Ch17
 
Distributed Coordination
Distributed CoordinationDistributed Coordination
Distributed Coordination
 
enc=encoded=TlJst0_SHq0cPRhLS74QDXTP4FpU303sSqpyVVkfhckA93UCiZrRF0QVNAFGmuGu9...
enc=encoded=TlJst0_SHq0cPRhLS74QDXTP4FpU303sSqpyVVkfhckA93UCiZrRF0QVNAFGmuGu9...enc=encoded=TlJst0_SHq0cPRhLS74QDXTP4FpU303sSqpyVVkfhckA93UCiZrRF0QVNAFGmuGu9...
enc=encoded=TlJst0_SHq0cPRhLS74QDXTP4FpU303sSqpyVVkfhckA93UCiZrRF0QVNAFGmuGu9...
 
CH05.pdf
CH05.pdfCH05.pdf
CH05.pdf
 
Chapter 18 - Distributed Coordination
Chapter 18 - Distributed CoordinationChapter 18 - Distributed Coordination
Chapter 18 - Distributed Coordination
 
Distributed System by Pratik Tambekar
Distributed System by Pratik TambekarDistributed System by Pratik Tambekar
Distributed System by Pratik Tambekar
 
Practical Byzantine Fault Tolernace
Practical Byzantine Fault TolernacePractical Byzantine Fault Tolernace
Practical Byzantine Fault Tolernace
 
Computer network (13)
Computer network (13)Computer network (13)
Computer network (13)
 
dos.ppt.pptx
dos.ppt.pptxdos.ppt.pptx
dos.ppt.pptx
 
SYNCHRONIZATION
SYNCHRONIZATIONSYNCHRONIZATION
SYNCHRONIZATION
 
Chapter 13
Chapter 13Chapter 13
Chapter 13
 
Os2
Os2Os2
Os2
 
Mitigating SIP Overload Using a Control-Theoretic Approach
Mitigating SIP Overload Using a Control-Theoretic ApproachMitigating SIP Overload Using a Control-Theoretic Approach
Mitigating SIP Overload Using a Control-Theoretic Approach
 
Transaction Processing Monitors (TPM)
Transaction Processing Monitors (TPM)Transaction Processing Monitors (TPM)
Transaction Processing Monitors (TPM)
 
Cpu scheduling qusetions
Cpu scheduling qusetionsCpu scheduling qusetions
Cpu scheduling qusetions
 

More from ashish61_scs

More from ashish61_scs (20)

7 concurrency controltwo
7 concurrency controltwo7 concurrency controltwo
7 concurrency controltwo
 
22 levine
22 levine22 levine
22 levine
 
20 access paths
20 access paths20 access paths
20 access paths
 
19 structured files
19 structured files19 structured files
19 structured files
 
18 philbe replication stanford99
18 philbe replication stanford9918 philbe replication stanford99
18 philbe replication stanford99
 
17 wics99 harkey
17 wics99 harkey17 wics99 harkey
17 wics99 harkey
 
16 greg hope_com_wics
16 greg hope_com_wics16 greg hope_com_wics
16 greg hope_com_wics
 
14 turing wics
14 turing wics14 turing wics
14 turing wics
 
14 scaleabilty wics
14 scaleabilty wics14 scaleabilty wics
14 scaleabilty wics
 
13 tm adv
13 tm adv13 tm adv
13 tm adv
 
11 tm
11 tm11 tm
11 tm
 
10b rm
10b rm10b rm
10b rm
 
09 workflow
09 workflow09 workflow
09 workflow
 
08 message and_queues_dieter_gawlick
08 message and_queues_dieter_gawlick08 message and_queues_dieter_gawlick
08 message and_queues_dieter_gawlick
 
06 07 lock
06 07 lock06 07 lock
06 07 lock
 
04 transaction models
04 transaction models04 transaction models
04 transaction models
 
02 fault tolerance
02 fault tolerance02 fault tolerance
02 fault tolerance
 
01 whirlwind tour
01 whirlwind tour01 whirlwind tour
01 whirlwind tour
 
Solution6.2012
Solution6.2012Solution6.2012
Solution6.2012
 
Solution7.2012
Solution7.2012Solution7.2012
Solution7.2012
 

Solution5.2012

  • 1. Assignment 5 - Solution Problem 1 Consider a system that uses the two-phase commit protocol with the cooperative termination protocol and no other optimizations. Assuming there are two participants (P1 and P2) and a coordinator (C), for each of the following either describe an execution scenario or explain why it cannot happen: C P1 P2
  • 2. 1.A P1 and P2 are blocked. C sends “prepare-to-commit” P1 & P2 send “yes-prepared” C crashes, which leaves P1 and P2 blocked. C P1 P2
  • 3. 1.B. Only P2 is blocked. 1. C sends “prepare-to-commit” 2. P1 & P2 send “yes-prepared” 3. Communication failure at P2 • P1 and C terminate the protocol • P1 and C crash • P2 is blocked 1. C sends “prepare-to-commit” 2. P1 & P2 send “yes-prepared” 3. P2 crashes • P1 and C terminate the protocol • P1 and C crash • P2 is recovers and is blocked
  • 4. 1.C C is blocked. This cannot happen. The coordinator can always unilaterally abort an undecided tx. C P1 P2
  • 5. Problem 2 Suppose there are n processes involved in 2PC, where process 1 is the transaction’s home. Suppose the processes are arranged in a chain (NOT a ring), so that each process can only communicate with adjacent processes in the chain. That is, process 1 can communicate only with process 2, process n-1 can communicate only with process n, and for each i where 1<i<n, process i can communicate only with processes i-1 and i+1. 1 i-1 i i+1 N
  • 6. 2.A Devise a version of the 2PC protocol for this arrangement of processes that uses 2n – 2 messages to commit a transaction. Process 1 Starts the commit activity. Prepares, then sends a Request-to-Prepare to Process 2. Process 2 Prepares, then sends a Request-to-Prepare to 3. … Process n Receives a request to prepare It commits Sends a Commit message to n-1.
  • 7. 2.b. In the protocol you devised in (a), is there any process that is never in an uncertainty period? Yes, Process n. 2.C In the protocol you devised in (a), what action commits the transaction? The log write of a commit record at process n effectively commits the transaction.
  • 8. 2.D Explain how to modify the protocol to speed up the protocol in the event that a process votes No. A process that votes No should send Abort to its two neighbors (if present), including lower and higher numbered processes. The lower-numbered neighbor should propagate the abort back toward process 1. The higher-numbered neighbor should propagate the abort up toward process n.