SlideShare a Scribd company logo
1 of 2
Consider a system consisting of processes P1, P2, ... , P11, each of which has a unique priority
number. Write a monitor that allocates three identical line printers to these processes, using the
priority numbers for deciding the order of allocation.
Solution
Monitors are implemented by using queues to keep track of the processes attempting to become
active int he monitor. To be active, a monitor must obtain a lock to allow it to execute the
monitor code. Processes that are blocked are put in a queue of processes waiting for an
unblocking event to occur.
The code for monitor is as follows:
type printer = monitor
var P: array[0…2] of boolean;
X: condition;
procedure acquire (id: integer, printer-id: integer);
begin
if P[0] and P[1] and P[2] then X.wait(id)
if not P[0] then printer-id := 0;
else if not P[1] then printer-id := 1;
else printer-id := 2;
P[printer-id]:=true;
end;
procedure release (printer-id: integer)
begin
P[printer-id]:=false;
X.signal;
end;
begin
P[0] := P[1] := P[2] := false;
end ;
Consider a system consisting of processes P1- P2- --- - P11- each of w.docx

More Related Content

Similar to Consider a system consisting of processes P1- P2- --- - P11- each of w.docx

ch05-program-logic-indefinite-loops.ppt
ch05-program-logic-indefinite-loops.pptch05-program-logic-indefinite-loops.ppt
ch05-program-logic-indefinite-loops.pptMahyuddin8
 
Bakery algorithm
Bakery algorithmBakery algorithm
Bakery algorithmUm e Farwa
 
The java code works, I just need it to display the results as in t.pdf
The java code works, I just need it to display the results as in t.pdfThe java code works, I just need it to display the results as in t.pdf
The java code works, I just need it to display the results as in t.pdfakaluza07
 
C programming Lab 2
C programming Lab 2C programming Lab 2
C programming Lab 2Zaibi Gondal
 
Python programming Workshop SITTTR - Kalamassery
Python programming Workshop SITTTR - KalamasseryPython programming Workshop SITTTR - Kalamassery
Python programming Workshop SITTTR - KalamasserySHAMJITH KM
 
CP4151 ADSA unit1 Advanced Data Structures and Algorithms
CP4151 ADSA unit1 Advanced Data Structures and AlgorithmsCP4151 ADSA unit1 Advanced Data Structures and Algorithms
CP4151 ADSA unit1 Advanced Data Structures and AlgorithmsSheba41
 
Lab-11-C-Problems.pptx
Lab-11-C-Problems.pptxLab-11-C-Problems.pptx
Lab-11-C-Problems.pptxShimoFcis
 
Process Synchronization
Process SynchronizationProcess Synchronization
Process SynchronizationSonali Chauhan
 
Chapter 6 - Process Synchronization
Chapter 6 - Process SynchronizationChapter 6 - Process Synchronization
Chapter 6 - Process SynchronizationWayne Jones Jnr
 
System Calls - Introduction
System Calls - IntroductionSystem Calls - Introduction
System Calls - IntroductionTo Sum It Up
 
Mca ii os u-2 process management & communication
Mca  ii  os u-2 process management & communicationMca  ii  os u-2 process management & communication
Mca ii os u-2 process management & communicationRai University
 
Programming Assignment #2CSci 430 Spring 2019Dates.docx
Programming Assignment #2CSci 430 Spring 2019Dates.docxProgramming Assignment #2CSci 430 Spring 2019Dates.docx
Programming Assignment #2CSci 430 Spring 2019Dates.docxstilliegeorgiana
 
Programming Assignment #2CSci 430 Spring 2019Dates.docx
Programming Assignment #2CSci 430 Spring 2019Dates.docxProgramming Assignment #2CSci 430 Spring 2019Dates.docx
Programming Assignment #2CSci 430 Spring 2019Dates.docxdenneymargareta
 
Lab report 201001067_201001104
Lab report 201001067_201001104Lab report 201001067_201001104
Lab report 201001067_201001104swena_gupta
 
Lab report 201001067_201001104
Lab report 201001067_201001104Lab report 201001067_201001104
Lab report 201001067_201001104swena_gupta
 

Similar to Consider a system consisting of processes P1- P2- --- - P11- each of w.docx (20)

ch05-program-logic-indefinite-loops.ppt
ch05-program-logic-indefinite-loops.pptch05-program-logic-indefinite-loops.ppt
ch05-program-logic-indefinite-loops.ppt
 
Bakery algorithm
Bakery algorithmBakery algorithm
Bakery algorithm
 
The java code works, I just need it to display the results as in t.pdf
The java code works, I just need it to display the results as in t.pdfThe java code works, I just need it to display the results as in t.pdf
The java code works, I just need it to display the results as in t.pdf
 
C programming Lab 2
C programming Lab 2C programming Lab 2
C programming Lab 2
 
Python programming Workshop SITTTR - Kalamassery
Python programming Workshop SITTTR - KalamasseryPython programming Workshop SITTTR - Kalamassery
Python programming Workshop SITTTR - Kalamassery
 
ALGO.ppt
ALGO.pptALGO.ppt
ALGO.ppt
 
CP4151 ADSA unit1 Advanced Data Structures and Algorithms
CP4151 ADSA unit1 Advanced Data Structures and AlgorithmsCP4151 ADSA unit1 Advanced Data Structures and Algorithms
CP4151 ADSA unit1 Advanced Data Structures and Algorithms
 
CH05.pdf
CH05.pdfCH05.pdf
CH05.pdf
 
Fundamentals of Programming Chapter 3
Fundamentals of Programming Chapter 3Fundamentals of Programming Chapter 3
Fundamentals of Programming Chapter 3
 
Lab-11-C-Problems.pptx
Lab-11-C-Problems.pptxLab-11-C-Problems.pptx
Lab-11-C-Problems.pptx
 
Process Synchronization
Process SynchronizationProcess Synchronization
Process Synchronization
 
Chapter 6 - Process Synchronization
Chapter 6 - Process SynchronizationChapter 6 - Process Synchronization
Chapter 6 - Process Synchronization
 
System Calls - Introduction
System Calls - IntroductionSystem Calls - Introduction
System Calls - Introduction
 
Practice
PracticePractice
Practice
 
Loops in Python
Loops in PythonLoops in Python
Loops in Python
 
Mca ii os u-2 process management & communication
Mca  ii  os u-2 process management & communicationMca  ii  os u-2 process management & communication
Mca ii os u-2 process management & communication
 
Programming Assignment #2CSci 430 Spring 2019Dates.docx
Programming Assignment #2CSci 430 Spring 2019Dates.docxProgramming Assignment #2CSci 430 Spring 2019Dates.docx
Programming Assignment #2CSci 430 Spring 2019Dates.docx
 
Programming Assignment #2CSci 430 Spring 2019Dates.docx
Programming Assignment #2CSci 430 Spring 2019Dates.docxProgramming Assignment #2CSci 430 Spring 2019Dates.docx
Programming Assignment #2CSci 430 Spring 2019Dates.docx
 
Lab report 201001067_201001104
Lab report 201001067_201001104Lab report 201001067_201001104
Lab report 201001067_201001104
 
Lab report 201001067_201001104
Lab report 201001067_201001104Lab report 201001067_201001104
Lab report 201001067_201001104
 

More from ljohn878

A field F is called a prime field if it has no proper subfields- If E.docx
A field F is called a prime field if it has no proper subfields- If E.docxA field F is called a prime field if it has no proper subfields- If E.docx
A field F is called a prime field if it has no proper subfields- If E.docxljohn878
 
A heterogeneous top management team A- Relies on the similar nat.docx
A heterogeneous top management team       A- Relies on the similar nat.docxA heterogeneous top management team       A- Relies on the similar nat.docx
A heterogeneous top management team A- Relies on the similar nat.docxljohn878
 
A grand tour of four cities begins at CityAand makes successive stops.docx
A grand tour of four cities begins at CityAand makes successive stops.docxA grand tour of four cities begins at CityAand makes successive stops.docx
A grand tour of four cities begins at CityAand makes successive stops.docxljohn878
 
A function is given- Determine the average rate of change of the funct.docx
A function is given- Determine the average rate of change of the funct.docxA function is given- Determine the average rate of change of the funct.docx
A function is given- Determine the average rate of change of the funct.docxljohn878
 
A description about the tool used to perform the scan A list of identi.docx
A description about the tool used to perform the scan A list of identi.docxA description about the tool used to perform the scan A list of identi.docx
A description about the tool used to perform the scan A list of identi.docxljohn878
 
A CPA firm has audited the financial statements included in a Form S-1.docx
A CPA firm has audited the financial statements included in a Form S-1.docxA CPA firm has audited the financial statements included in a Form S-1.docx
A CPA firm has audited the financial statements included in a Form S-1.docxljohn878
 
A contemporary issue facing technology innovation today is the tension.docx
A contemporary issue facing technology innovation today is the tension.docxA contemporary issue facing technology innovation today is the tension.docx
A contemporary issue facing technology innovation today is the tension.docxljohn878
 
Conduct an External Environmental Scan for your selected company- Iden.docx
Conduct an External Environmental Scan for your selected company- Iden.docxConduct an External Environmental Scan for your selected company- Iden.docx
Conduct an External Environmental Scan for your selected company- Iden.docxljohn878
 
Computing an average mark for four tests Design the algorithm and the.docx
Computing an average mark for four tests  Design the algorithm and the.docxComputing an average mark for four tests  Design the algorithm and the.docx
Computing an average mark for four tests Design the algorithm and the.docxljohn878
 
Computer Networks- Write either True or False 1- In LTE- a mobile devi.docx
Computer Networks- Write either True or False 1- In LTE- a mobile devi.docxComputer Networks- Write either True or False 1- In LTE- a mobile devi.docx
Computer Networks- Write either True or False 1- In LTE- a mobile devi.docxljohn878
 
Computation of weighted average shares outstanding during the year- J.docx
Computation of weighted average shares outstanding during the year-  J.docxComputation of weighted average shares outstanding during the year-  J.docx
Computation of weighted average shares outstanding during the year- J.docxljohn878
 
Comprehensive Problem 5 (Part Level Submission) On December 1- 2014- J.docx
Comprehensive Problem 5 (Part Level Submission) On December 1- 2014- J.docxComprehensive Problem 5 (Part Level Submission) On December 1- 2014- J.docx
Comprehensive Problem 5 (Part Level Submission) On December 1- 2014- J.docxljohn878
 
Completely classify liquid FeFe- Pure Substance Compound Mixture Eleme.docx
Completely classify liquid FeFe- Pure Substance Compound Mixture Eleme.docxCompletely classify liquid FeFe- Pure Substance Compound Mixture Eleme.docx
Completely classify liquid FeFe- Pure Substance Compound Mixture Eleme.docxljohn878
 
Complete the following table by calculating the missing entries and in.docx
Complete the following table by calculating the missing entries and in.docxComplete the following table by calculating the missing entries and in.docx
Complete the following table by calculating the missing entries and in.docxljohn878
 
Compare the models and information found with NonakaSolutiondeveloped.docx
Compare the models and information found with NonakaSolutiondeveloped.docxCompare the models and information found with NonakaSolutiondeveloped.docx
Compare the models and information found with NonakaSolutiondeveloped.docxljohn878
 
Compare the models and information found with NonakaSolutiondeveloped (2).docx
Compare the models and information found with NonakaSolutiondeveloped (2).docxCompare the models and information found with NonakaSolutiondeveloped (2).docx
Compare the models and information found with NonakaSolutiondeveloped (2).docxljohn878
 
Complete the following Java code such that it opens a file named Fruit.docx
Complete the following Java code such that it opens a file named Fruit.docxComplete the following Java code such that it opens a file named Fruit.docx
Complete the following Java code such that it opens a file named Fruit.docxljohn878
 
Compare the models and information found with NonakaSolutiondeveloped (1).docx
Compare the models and information found with NonakaSolutiondeveloped (1).docxCompare the models and information found with NonakaSolutiondeveloped (1).docx
Compare the models and information found with NonakaSolutiondeveloped (1).docxljohn878
 
Compare the models and information found with NonakaSolutiondeveloped (3).docx
Compare the models and information found with NonakaSolutiondeveloped (3).docxCompare the models and information found with NonakaSolutiondeveloped (3).docx
Compare the models and information found with NonakaSolutiondeveloped (3).docxljohn878
 
Compare and contrast the Internal Rate of Return (IRR)- the Net Presen.docx
Compare and contrast the Internal Rate of Return (IRR)- the Net Presen.docxCompare and contrast the Internal Rate of Return (IRR)- the Net Presen.docx
Compare and contrast the Internal Rate of Return (IRR)- the Net Presen.docxljohn878
 

More from ljohn878 (20)

A field F is called a prime field if it has no proper subfields- If E.docx
A field F is called a prime field if it has no proper subfields- If E.docxA field F is called a prime field if it has no proper subfields- If E.docx
A field F is called a prime field if it has no proper subfields- If E.docx
 
A heterogeneous top management team A- Relies on the similar nat.docx
A heterogeneous top management team       A- Relies on the similar nat.docxA heterogeneous top management team       A- Relies on the similar nat.docx
A heterogeneous top management team A- Relies on the similar nat.docx
 
A grand tour of four cities begins at CityAand makes successive stops.docx
A grand tour of four cities begins at CityAand makes successive stops.docxA grand tour of four cities begins at CityAand makes successive stops.docx
A grand tour of four cities begins at CityAand makes successive stops.docx
 
A function is given- Determine the average rate of change of the funct.docx
A function is given- Determine the average rate of change of the funct.docxA function is given- Determine the average rate of change of the funct.docx
A function is given- Determine the average rate of change of the funct.docx
 
A description about the tool used to perform the scan A list of identi.docx
A description about the tool used to perform the scan A list of identi.docxA description about the tool used to perform the scan A list of identi.docx
A description about the tool used to perform the scan A list of identi.docx
 
A CPA firm has audited the financial statements included in a Form S-1.docx
A CPA firm has audited the financial statements included in a Form S-1.docxA CPA firm has audited the financial statements included in a Form S-1.docx
A CPA firm has audited the financial statements included in a Form S-1.docx
 
A contemporary issue facing technology innovation today is the tension.docx
A contemporary issue facing technology innovation today is the tension.docxA contemporary issue facing technology innovation today is the tension.docx
A contemporary issue facing technology innovation today is the tension.docx
 
Conduct an External Environmental Scan for your selected company- Iden.docx
Conduct an External Environmental Scan for your selected company- Iden.docxConduct an External Environmental Scan for your selected company- Iden.docx
Conduct an External Environmental Scan for your selected company- Iden.docx
 
Computing an average mark for four tests Design the algorithm and the.docx
Computing an average mark for four tests  Design the algorithm and the.docxComputing an average mark for four tests  Design the algorithm and the.docx
Computing an average mark for four tests Design the algorithm and the.docx
 
Computer Networks- Write either True or False 1- In LTE- a mobile devi.docx
Computer Networks- Write either True or False 1- In LTE- a mobile devi.docxComputer Networks- Write either True or False 1- In LTE- a mobile devi.docx
Computer Networks- Write either True or False 1- In LTE- a mobile devi.docx
 
Computation of weighted average shares outstanding during the year- J.docx
Computation of weighted average shares outstanding during the year-  J.docxComputation of weighted average shares outstanding during the year-  J.docx
Computation of weighted average shares outstanding during the year- J.docx
 
Comprehensive Problem 5 (Part Level Submission) On December 1- 2014- J.docx
Comprehensive Problem 5 (Part Level Submission) On December 1- 2014- J.docxComprehensive Problem 5 (Part Level Submission) On December 1- 2014- J.docx
Comprehensive Problem 5 (Part Level Submission) On December 1- 2014- J.docx
 
Completely classify liquid FeFe- Pure Substance Compound Mixture Eleme.docx
Completely classify liquid FeFe- Pure Substance Compound Mixture Eleme.docxCompletely classify liquid FeFe- Pure Substance Compound Mixture Eleme.docx
Completely classify liquid FeFe- Pure Substance Compound Mixture Eleme.docx
 
Complete the following table by calculating the missing entries and in.docx
Complete the following table by calculating the missing entries and in.docxComplete the following table by calculating the missing entries and in.docx
Complete the following table by calculating the missing entries and in.docx
 
Compare the models and information found with NonakaSolutiondeveloped.docx
Compare the models and information found with NonakaSolutiondeveloped.docxCompare the models and information found with NonakaSolutiondeveloped.docx
Compare the models and information found with NonakaSolutiondeveloped.docx
 
Compare the models and information found with NonakaSolutiondeveloped (2).docx
Compare the models and information found with NonakaSolutiondeveloped (2).docxCompare the models and information found with NonakaSolutiondeveloped (2).docx
Compare the models and information found with NonakaSolutiondeveloped (2).docx
 
Complete the following Java code such that it opens a file named Fruit.docx
Complete the following Java code such that it opens a file named Fruit.docxComplete the following Java code such that it opens a file named Fruit.docx
Complete the following Java code such that it opens a file named Fruit.docx
 
Compare the models and information found with NonakaSolutiondeveloped (1).docx
Compare the models and information found with NonakaSolutiondeveloped (1).docxCompare the models and information found with NonakaSolutiondeveloped (1).docx
Compare the models and information found with NonakaSolutiondeveloped (1).docx
 
Compare the models and information found with NonakaSolutiondeveloped (3).docx
Compare the models and information found with NonakaSolutiondeveloped (3).docxCompare the models and information found with NonakaSolutiondeveloped (3).docx
Compare the models and information found with NonakaSolutiondeveloped (3).docx
 
Compare and contrast the Internal Rate of Return (IRR)- the Net Presen.docx
Compare and contrast the Internal Rate of Return (IRR)- the Net Presen.docxCompare and contrast the Internal Rate of Return (IRR)- the Net Presen.docx
Compare and contrast the Internal Rate of Return (IRR)- the Net Presen.docx
 

Recently uploaded

Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
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
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
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
 
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
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
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
 
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
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
“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
 

Recently uploaded (20)

TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
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
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
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
 
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
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
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
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
“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...
 

Consider a system consisting of processes P1- P2- --- - P11- each of w.docx

  • 1. Consider a system consisting of processes P1, P2, ... , P11, each of which has a unique priority number. Write a monitor that allocates three identical line printers to these processes, using the priority numbers for deciding the order of allocation. Solution Monitors are implemented by using queues to keep track of the processes attempting to become active int he monitor. To be active, a monitor must obtain a lock to allow it to execute the monitor code. Processes that are blocked are put in a queue of processes waiting for an unblocking event to occur. The code for monitor is as follows: type printer = monitor var P: array[0…2] of boolean; X: condition; procedure acquire (id: integer, printer-id: integer); begin if P[0] and P[1] and P[2] then X.wait(id) if not P[0] then printer-id := 0; else if not P[1] then printer-id := 1; else printer-id := 2; P[printer-id]:=true; end; procedure release (printer-id: integer) begin P[printer-id]:=false; X.signal; end; begin P[0] := P[1] := P[2] := false; end ;