SlideShare a Scribd company logo
Given the following solution for the critical section problem (the given code is for process Pi; code
for Pj is the same with i and j interchanged), show one scenario where it does not work correctly.
The shared variables are flag[i], flag[j]. and turn. turn is initialized to i; flag[i] and flag[j] are
initialized to false.
do{ /* Begin Entry Section */ flag[i]=true; flag[j]=false;
while (flag[i] && turn==i); /* End Entry section */
Critical section
/* Begin Exit section */
flag[i] = false; turn=j; /*End exit section */
Remainder section }

More Related Content

More from abifancystore

In the 1300s Europe was in the midst of decline and turmoil.pdf
In the 1300s Europe was in the midst of decline and turmoil.pdfIn the 1300s Europe was in the midst of decline and turmoil.pdf
In the 1300s Europe was in the midst of decline and turmoil.pdf
abifancystore
 
write on this code A Sentinel List has two special n.pdf
write on this code    A Sentinel List has two special n.pdfwrite on this code    A Sentinel List has two special n.pdf
write on this code A Sentinel List has two special n.pdf
abifancystore
 
Topic Why is unemployment so high in Europe Briefly discus.pdf
Topic Why is unemployment so high in Europe Briefly discus.pdfTopic Why is unemployment so high in Europe Briefly discus.pdf
Topic Why is unemployment so high in Europe Briefly discus.pdf
abifancystore
 
Can someone give simple answers to these two questions Than.pdf
Can someone give simple answers to these two questions Than.pdfCan someone give simple answers to these two questions Than.pdf
Can someone give simple answers to these two questions Than.pdf
abifancystore
 
The trial balance for Best Advisors Service on December 31 .pdf
The trial balance for Best Advisors Service on December 31 .pdfThe trial balance for Best Advisors Service on December 31 .pdf
The trial balance for Best Advisors Service on December 31 .pdf
abifancystore
 
Calculate the dominant allele D frequency for this populat.pdf
Calculate the dominant allele D frequency for this populat.pdfCalculate the dominant allele D frequency for this populat.pdf
Calculate the dominant allele D frequency for this populat.pdf
abifancystore
 
the probabiilty of obtaining a success Round your answer to.pdf
the probabiilty of obtaining a success Round your answer to.pdfthe probabiilty of obtaining a success Round your answer to.pdf
the probabiilty of obtaining a success Round your answer to.pdf
abifancystore
 
Suppose that you are given a decision situation with three p.pdf
Suppose that you are given a decision situation with three p.pdfSuppose that you are given a decision situation with three p.pdf
Suppose that you are given a decision situation with three p.pdf
abifancystore
 
Sicklecell anemia is a recessive trait in humans In order .pdf
Sicklecell anemia is a recessive trait in humans In order .pdfSicklecell anemia is a recessive trait in humans In order .pdf
Sicklecell anemia is a recessive trait in humans In order .pdf
abifancystore
 
Revenue Recognition for Facebook and twitter for the year 20.pdf
Revenue Recognition for Facebook and twitter for the year 20.pdfRevenue Recognition for Facebook and twitter for the year 20.pdf
Revenue Recognition for Facebook and twitter for the year 20.pdf
abifancystore
 
begintabularlcc hline multicolumn1c Contribut.pdf
begintabularlcc hline multicolumn1c Contribut.pdfbegintabularlcc hline multicolumn1c Contribut.pdf
begintabularlcc hline multicolumn1c Contribut.pdf
abifancystore
 
Question 26 1 pts Which of the following is NOT true of all .pdf
Question 26 1 pts Which of the following is NOT true of all .pdfQuestion 26 1 pts Which of the following is NOT true of all .pdf
Question 26 1 pts Which of the following is NOT true of all .pdf
abifancystore
 
Question 04 Find the mean median and mode of the followin.pdf
Question 04 Find the mean median and mode of the followin.pdfQuestion 04 Find the mean median and mode of the followin.pdf
Question 04 Find the mean median and mode of the followin.pdf
abifancystore
 
Although of only minor economic importance when compared wit.pdf
Although of only minor economic importance when compared wit.pdfAlthough of only minor economic importance when compared wit.pdf
Although of only minor economic importance when compared wit.pdf
abifancystore
 
IFind Nash.pdf
IFind Nash.pdfIFind Nash.pdf
IFind Nash.pdf
abifancystore
 
Phoenix Partners devlet ve kurumsal mterilere ynetim danm.pdf
Phoenix Partners devlet ve kurumsal mterilere ynetim danm.pdfPhoenix Partners devlet ve kurumsal mterilere ynetim danm.pdf
Phoenix Partners devlet ve kurumsal mterilere ynetim danm.pdf
abifancystore
 
An inexperienced accountant for Flint Corporation showed the.pdf
An inexperienced accountant for Flint Corporation showed the.pdfAn inexperienced accountant for Flint Corporation showed the.pdf
An inexperienced accountant for Flint Corporation showed the.pdf
abifancystore
 
According to the Leadership Grid a manager who exhibits imp.pdf
According to the Leadership Grid a manager who exhibits imp.pdfAccording to the Leadership Grid a manager who exhibits imp.pdf
According to the Leadership Grid a manager who exhibits imp.pdf
abifancystore
 
Muhtemelen hiperglisemi hcresel dehidrasyonu tevik eder .pdf
Muhtemelen hiperglisemi hcresel dehidrasyonu tevik eder .pdfMuhtemelen hiperglisemi hcresel dehidrasyonu tevik eder .pdf
Muhtemelen hiperglisemi hcresel dehidrasyonu tevik eder .pdf
abifancystore
 
liderlik hizmet baars iin zellikle ok nemli deildir do.pdf
liderlik hizmet baars iin zellikle ok nemli deildir do.pdfliderlik hizmet baars iin zellikle ok nemli deildir do.pdf
liderlik hizmet baars iin zellikle ok nemli deildir do.pdf
abifancystore
 

More from abifancystore (20)

In the 1300s Europe was in the midst of decline and turmoil.pdf
In the 1300s Europe was in the midst of decline and turmoil.pdfIn the 1300s Europe was in the midst of decline and turmoil.pdf
In the 1300s Europe was in the midst of decline and turmoil.pdf
 
write on this code A Sentinel List has two special n.pdf
write on this code    A Sentinel List has two special n.pdfwrite on this code    A Sentinel List has two special n.pdf
write on this code A Sentinel List has two special n.pdf
 
Topic Why is unemployment so high in Europe Briefly discus.pdf
Topic Why is unemployment so high in Europe Briefly discus.pdfTopic Why is unemployment so high in Europe Briefly discus.pdf
Topic Why is unemployment so high in Europe Briefly discus.pdf
 
Can someone give simple answers to these two questions Than.pdf
Can someone give simple answers to these two questions Than.pdfCan someone give simple answers to these two questions Than.pdf
Can someone give simple answers to these two questions Than.pdf
 
The trial balance for Best Advisors Service on December 31 .pdf
The trial balance for Best Advisors Service on December 31 .pdfThe trial balance for Best Advisors Service on December 31 .pdf
The trial balance for Best Advisors Service on December 31 .pdf
 
Calculate the dominant allele D frequency for this populat.pdf
Calculate the dominant allele D frequency for this populat.pdfCalculate the dominant allele D frequency for this populat.pdf
Calculate the dominant allele D frequency for this populat.pdf
 
the probabiilty of obtaining a success Round your answer to.pdf
the probabiilty of obtaining a success Round your answer to.pdfthe probabiilty of obtaining a success Round your answer to.pdf
the probabiilty of obtaining a success Round your answer to.pdf
 
Suppose that you are given a decision situation with three p.pdf
Suppose that you are given a decision situation with three p.pdfSuppose that you are given a decision situation with three p.pdf
Suppose that you are given a decision situation with three p.pdf
 
Sicklecell anemia is a recessive trait in humans In order .pdf
Sicklecell anemia is a recessive trait in humans In order .pdfSicklecell anemia is a recessive trait in humans In order .pdf
Sicklecell anemia is a recessive trait in humans In order .pdf
 
Revenue Recognition for Facebook and twitter for the year 20.pdf
Revenue Recognition for Facebook and twitter for the year 20.pdfRevenue Recognition for Facebook and twitter for the year 20.pdf
Revenue Recognition for Facebook and twitter for the year 20.pdf
 
begintabularlcc hline multicolumn1c Contribut.pdf
begintabularlcc hline multicolumn1c Contribut.pdfbegintabularlcc hline multicolumn1c Contribut.pdf
begintabularlcc hline multicolumn1c Contribut.pdf
 
Question 26 1 pts Which of the following is NOT true of all .pdf
Question 26 1 pts Which of the following is NOT true of all .pdfQuestion 26 1 pts Which of the following is NOT true of all .pdf
Question 26 1 pts Which of the following is NOT true of all .pdf
 
Question 04 Find the mean median and mode of the followin.pdf
Question 04 Find the mean median and mode of the followin.pdfQuestion 04 Find the mean median and mode of the followin.pdf
Question 04 Find the mean median and mode of the followin.pdf
 
Although of only minor economic importance when compared wit.pdf
Although of only minor economic importance when compared wit.pdfAlthough of only minor economic importance when compared wit.pdf
Although of only minor economic importance when compared wit.pdf
 
IFind Nash.pdf
IFind Nash.pdfIFind Nash.pdf
IFind Nash.pdf
 
Phoenix Partners devlet ve kurumsal mterilere ynetim danm.pdf
Phoenix Partners devlet ve kurumsal mterilere ynetim danm.pdfPhoenix Partners devlet ve kurumsal mterilere ynetim danm.pdf
Phoenix Partners devlet ve kurumsal mterilere ynetim danm.pdf
 
An inexperienced accountant for Flint Corporation showed the.pdf
An inexperienced accountant for Flint Corporation showed the.pdfAn inexperienced accountant for Flint Corporation showed the.pdf
An inexperienced accountant for Flint Corporation showed the.pdf
 
According to the Leadership Grid a manager who exhibits imp.pdf
According to the Leadership Grid a manager who exhibits imp.pdfAccording to the Leadership Grid a manager who exhibits imp.pdf
According to the Leadership Grid a manager who exhibits imp.pdf
 
Muhtemelen hiperglisemi hcresel dehidrasyonu tevik eder .pdf
Muhtemelen hiperglisemi hcresel dehidrasyonu tevik eder .pdfMuhtemelen hiperglisemi hcresel dehidrasyonu tevik eder .pdf
Muhtemelen hiperglisemi hcresel dehidrasyonu tevik eder .pdf
 
liderlik hizmet baars iin zellikle ok nemli deildir do.pdf
liderlik hizmet baars iin zellikle ok nemli deildir do.pdfliderlik hizmet baars iin zellikle ok nemli deildir do.pdf
liderlik hizmet baars iin zellikle ok nemli deildir do.pdf
 

Recently uploaded

Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
Mohammed Sikander
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
gb193092
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
kimdan468
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
deeptiverma2406
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 

Recently uploaded (20)

Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 

Given the following solution for the critical section proble.pdf

  • 1. Given the following solution for the critical section problem (the given code is for process Pi; code for Pj is the same with i and j interchanged), show one scenario where it does not work correctly. The shared variables are flag[i], flag[j]. and turn. turn is initialized to i; flag[i] and flag[j] are initialized to false. do{ /* Begin Entry Section */ flag[i]=true; flag[j]=false; while (flag[i] && turn==i); /* End Entry section */ Critical section /* Begin Exit section */ flag[i] = false; turn=j; /*End exit section */ Remainder section }