SlideShare uma empresa Scribd logo
1 de 5
Basic TO algorithm :
Case 1 : If Tj requests read operation on data item x,
       If TS(Tj) < WTS(x) then
               Reject the operation and abort Tj;
               Restart Tj with new timestamp;
       Else
               Execute read operation;
               Set RTS(x) = max {RTS(x), TS(Tj)};
Case 2 : If Tj requests write operation on data item x,
       If TS(Tj) < RTS(x) and TS(Tj) < WTS(x) then
               Reject the operation and abort Tj;
               Restart Tj with new timestamp;
       Else
               Execute write operation;
               Set WTS(x) = TS(Tj);

RTS(x) is read timestamp of x – sometimes called RTM(x)
WTS(x) is write timestamp of x – sometimes called WTM(x)

PROBLEM :
Consider a data item X. Let RTM(X) = 25 and WTM(X) = 20. Let the pair (<Ri(X),TS>, Wi(X), TS)
denote a read / write request of transaction Ti on the item X with timestamp TS. Indicate the
behavior of the basic timestamp method with the following sequence of requests.
<R1(X), 19>, <R2(X), 22>, <W3(X), 21>,
<W4(X), 23>, <R5(X), 28>, <W6(X), 27>
ANSWER :
a) <R1(X), 19> - it means that T1 transaction wants to perform read(X) operation and TS(T1)=19.
       From basic TO algorithm,
   As, TS(T1) < WTM(X), reject the operation and abort T1 and restart T1 with new timestamp.

b) <R2(X), 22> - it means that T2 transaction wants to perform read(X) operation and TS(T1)=22.
       From basic TO algorithm,
   As, TS(T2) > WTM(X), perform the operation and set RTM(X),
       RTM(X) = max{RTM(X), TS(T2)}
                = max{25, 22}
                = 25

c) <W3(X), 21> - it means that T3 transaction wants to perform write(X) operation and TS(T1)=21.
        From basic TO algorithm,
    As, TS(T3) < RTM(X) but TS(T3) > WTM(X), perform the operation and set WTM(X),
        WTM(X) = TS(T3) = 21
d) <W4(X), 23> - it means that T4 transaction wants to perform write(X) operation and TS(T1)=23.
        From basic TO algorithm,
    As, TS(T4) < RTM(X) but TS(T4) > WTM(X) (i.e. new WTM value 21), perform the operation
and set WTM(X),
        WTM(X) = TS(T4) = 23

e) <R5(X), 28> - it means that T5 transaction wants to perform read(X) operation and TS(T1)=28.
       From basic TO algorithm,
   As, TS(T5) > WTM(X) (i.e. new WTM value 23), perform the operation and set RTM(X),
       RTM(X) = max{RTM(X), TS(T5)}
                 = max{25, 28}
                 = 28

f) <W6(X), 27> - it means that T6 transaction wants to perform write(X) operation and TS(T1)=27.
        From basic TO algorithm,
    As, TS(T6) < RTM(X)(i.e. new RTM value 28) but TS(T6) > WTM(X) (i.e. new WTM value 23),
perform the operation and set WTM(X),
        WTM(X) = TS(T6) = 27

Distributed Deadlock Detection Algorithm :
   This algorithm works by successive iterations.
   At each iteration each site receives potential deadlock information which was produced by other
   sites during the previous iteration, then it performs deadlock detection and finally it sends
   potential deadlock information to other sites. Therefore, the communication between local
   deadlock detectors occurs between different iterations of the algorithm.
   It may happen that two sites may send the same global deadlock information to each other. This
   would cause that the same deadlock be discovered twice, which is not necessary. To avoid this
   unnecessary transmission, the algorithm uses the following rule :
   The potential deadlock cycle is transmitted only if the transaction identifier of the
   transaction for which EX waits is greater than the transaction identifier of the transaction
   waiting for EX.
   For example, consider following DWFG,

          Site 1    T1       T2




          Site 2    T1       T2
The local deadlock detectors at each site builds the LWFG as follows,

          At site 1   T1            T2                  EX




         At site 2    T1             T2                  EX




 NOTE : In LWFG, all output and input ports are collected into a single node, called external (EX).

  From above LWFFGs , we obtain that only site 2 transmits the potential deadlock cycle because at
site 2 EX is waiting for T2 and T1 is waiting for EX in the potential cycle (from the above rule).

   At each iteration of the algorithm, the local deadlock detectors at each site perform the following
   actions :
   1) Build the LWFG using local information. The LWFG includes the node EX.
   2) For each message which has been received, perform the following modifications of the
       LWFG :
       a) For each transaction in the message, add it to the LWFG if it does not already exist.
       b) For each transaction in the message, starting with EX, create an edge to the next
           transaction in the message.
       This step has included all potential deadlock information received from other sites into the
       local LWFG.
   3) Find cycles not involving EX in the LWFG. Each such cycle indicated the existence of a
       deadlock. Deadlock resolution is invoked to eliminate these deadlocks.
   4) Find cycles involving EX. These cycles are potential deadlock cycles. The rule described
       above is used to determine whether a potential deadlock cycle must be transmitted to a
       different site. If the transmission is required, the message is prepared and transmitted. The
       transmission of potential deadlock cycles terminates the current iteration of the deadlock
       detection process.
PROBLEM 1:
Consider the following DWFT given below,


                     Site1      T2             T2       T3        Site2




                                T1             T1       T3        Site3


Detect the deadlock using the distributed deadlock diagram.
ANSWER :
Iteration 1:
First draw LWFG for each site.
                       T1            T2                 EX
      At site 1




                      T2             T3                EX
       At site 2



                           EX             T1                 T3
       At site 3


At site3, there is no potential deadlock cycle exists. But site1 and site2 LWFG contain potential
deadlock cycle.
The rule for transmitting the potential deadlock cycle is as follows :
    The potential deadlock cycle is transmitted only if the transaction identifier of the
    transaction for which EX waits is greater than the transaction identifier of the transaction
    waiting for EX.
From the above rule, none of the site sends the information to the remaining sites. Therefore the
iteration terminates without sending any information.
PROBLEM 2 :
   Consider following DWFG,

                              Site 1    T1        T2




                              Site 2    T1        T2

   Detect the deadlock using the distributed deadlock diagram.
   ANSWER :
   Iteration 1 :
   First draw LWFG for each site.

           T1            T2                  EX                T1         T2                 EX
   Site1                                               Site2


   Both site1 and site2 LWFGs contain potential deadlock cycle.
   The rule for transmitting the potential deadlock cycle is as follows :
       The potential deadlock cycle is transmitted only if the transaction identifier of the
       transaction for which EX waits is greater than the transaction identifier of the transaction
       waiting for EX.
   From the above rule, only site 2 transmits the potential deadlock cycle because at site 2 EX is waiting
   for T2 and T1 is waiting for EX in the potential cycle. Cycle involves EX. Therefore site1 receives
   message from site1 as (EX, T2, T1).
   Iteration 2 :
   At site 1, after receiving the message from site2, the local deadlock detector modifies the LWFG as
   follows :
       a) No need to add any transaction the LWFG as each transaction in the message is already exists
           in LWFG.
       b) For each transaction in the message i.e. T1 and T2, starting with EX, create an edge to the
           next transaction in the message.


                              T1             T2                     EX



c) There is a cycle not involving EX in the above LWFG (i.e. T1-T2-T1). Thus there is a deadlock
   detected at site1. Deadlock resolution is invoked at site1 by selecting a victim and an abort message
   for that victim is send to all sites where the victim was active (i.e. to site2).
                                           ******************

Mais conteúdo relacionado

Último

CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 

Último (20)

CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 

Destaque

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Destaque (20)

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 

Problem solutions

  • 1. Basic TO algorithm : Case 1 : If Tj requests read operation on data item x, If TS(Tj) < WTS(x) then Reject the operation and abort Tj; Restart Tj with new timestamp; Else Execute read operation; Set RTS(x) = max {RTS(x), TS(Tj)}; Case 2 : If Tj requests write operation on data item x, If TS(Tj) < RTS(x) and TS(Tj) < WTS(x) then Reject the operation and abort Tj; Restart Tj with new timestamp; Else Execute write operation; Set WTS(x) = TS(Tj); RTS(x) is read timestamp of x – sometimes called RTM(x) WTS(x) is write timestamp of x – sometimes called WTM(x) PROBLEM : Consider a data item X. Let RTM(X) = 25 and WTM(X) = 20. Let the pair (<Ri(X),TS>, Wi(X), TS) denote a read / write request of transaction Ti on the item X with timestamp TS. Indicate the behavior of the basic timestamp method with the following sequence of requests. <R1(X), 19>, <R2(X), 22>, <W3(X), 21>, <W4(X), 23>, <R5(X), 28>, <W6(X), 27> ANSWER : a) <R1(X), 19> - it means that T1 transaction wants to perform read(X) operation and TS(T1)=19. From basic TO algorithm, As, TS(T1) < WTM(X), reject the operation and abort T1 and restart T1 with new timestamp. b) <R2(X), 22> - it means that T2 transaction wants to perform read(X) operation and TS(T1)=22. From basic TO algorithm, As, TS(T2) > WTM(X), perform the operation and set RTM(X), RTM(X) = max{RTM(X), TS(T2)} = max{25, 22} = 25 c) <W3(X), 21> - it means that T3 transaction wants to perform write(X) operation and TS(T1)=21. From basic TO algorithm, As, TS(T3) < RTM(X) but TS(T3) > WTM(X), perform the operation and set WTM(X), WTM(X) = TS(T3) = 21
  • 2. d) <W4(X), 23> - it means that T4 transaction wants to perform write(X) operation and TS(T1)=23. From basic TO algorithm, As, TS(T4) < RTM(X) but TS(T4) > WTM(X) (i.e. new WTM value 21), perform the operation and set WTM(X), WTM(X) = TS(T4) = 23 e) <R5(X), 28> - it means that T5 transaction wants to perform read(X) operation and TS(T1)=28. From basic TO algorithm, As, TS(T5) > WTM(X) (i.e. new WTM value 23), perform the operation and set RTM(X), RTM(X) = max{RTM(X), TS(T5)} = max{25, 28} = 28 f) <W6(X), 27> - it means that T6 transaction wants to perform write(X) operation and TS(T1)=27. From basic TO algorithm, As, TS(T6) < RTM(X)(i.e. new RTM value 28) but TS(T6) > WTM(X) (i.e. new WTM value 23), perform the operation and set WTM(X), WTM(X) = TS(T6) = 27 Distributed Deadlock Detection Algorithm : This algorithm works by successive iterations. At each iteration each site receives potential deadlock information which was produced by other sites during the previous iteration, then it performs deadlock detection and finally it sends potential deadlock information to other sites. Therefore, the communication between local deadlock detectors occurs between different iterations of the algorithm. It may happen that two sites may send the same global deadlock information to each other. This would cause that the same deadlock be discovered twice, which is not necessary. To avoid this unnecessary transmission, the algorithm uses the following rule : The potential deadlock cycle is transmitted only if the transaction identifier of the transaction for which EX waits is greater than the transaction identifier of the transaction waiting for EX. For example, consider following DWFG, Site 1 T1 T2 Site 2 T1 T2
  • 3. The local deadlock detectors at each site builds the LWFG as follows, At site 1 T1 T2 EX At site 2 T1 T2 EX NOTE : In LWFG, all output and input ports are collected into a single node, called external (EX). From above LWFFGs , we obtain that only site 2 transmits the potential deadlock cycle because at site 2 EX is waiting for T2 and T1 is waiting for EX in the potential cycle (from the above rule). At each iteration of the algorithm, the local deadlock detectors at each site perform the following actions : 1) Build the LWFG using local information. The LWFG includes the node EX. 2) For each message which has been received, perform the following modifications of the LWFG : a) For each transaction in the message, add it to the LWFG if it does not already exist. b) For each transaction in the message, starting with EX, create an edge to the next transaction in the message. This step has included all potential deadlock information received from other sites into the local LWFG. 3) Find cycles not involving EX in the LWFG. Each such cycle indicated the existence of a deadlock. Deadlock resolution is invoked to eliminate these deadlocks. 4) Find cycles involving EX. These cycles are potential deadlock cycles. The rule described above is used to determine whether a potential deadlock cycle must be transmitted to a different site. If the transmission is required, the message is prepared and transmitted. The transmission of potential deadlock cycles terminates the current iteration of the deadlock detection process.
  • 4. PROBLEM 1: Consider the following DWFT given below, Site1 T2 T2 T3 Site2 T1 T1 T3 Site3 Detect the deadlock using the distributed deadlock diagram. ANSWER : Iteration 1: First draw LWFG for each site. T1 T2 EX At site 1 T2 T3 EX At site 2 EX T1 T3 At site 3 At site3, there is no potential deadlock cycle exists. But site1 and site2 LWFG contain potential deadlock cycle. The rule for transmitting the potential deadlock cycle is as follows : The potential deadlock cycle is transmitted only if the transaction identifier of the transaction for which EX waits is greater than the transaction identifier of the transaction waiting for EX. From the above rule, none of the site sends the information to the remaining sites. Therefore the iteration terminates without sending any information.
  • 5. PROBLEM 2 : Consider following DWFG, Site 1 T1 T2 Site 2 T1 T2 Detect the deadlock using the distributed deadlock diagram. ANSWER : Iteration 1 : First draw LWFG for each site. T1 T2 EX T1 T2 EX Site1 Site2 Both site1 and site2 LWFGs contain potential deadlock cycle. The rule for transmitting the potential deadlock cycle is as follows : The potential deadlock cycle is transmitted only if the transaction identifier of the transaction for which EX waits is greater than the transaction identifier of the transaction waiting for EX. From the above rule, only site 2 transmits the potential deadlock cycle because at site 2 EX is waiting for T2 and T1 is waiting for EX in the potential cycle. Cycle involves EX. Therefore site1 receives message from site1 as (EX, T2, T1). Iteration 2 : At site 1, after receiving the message from site2, the local deadlock detector modifies the LWFG as follows : a) No need to add any transaction the LWFG as each transaction in the message is already exists in LWFG. b) For each transaction in the message i.e. T1 and T2, starting with EX, create an edge to the next transaction in the message. T1 T2 EX c) There is a cycle not involving EX in the above LWFG (i.e. T1-T2-T1). Thus there is a deadlock detected at site1. Deadlock resolution is invoked at site1 by selecting a victim and an abort message for that victim is send to all sites where the victim was active (i.e. to site2). ******************