} 3. CONCURRENCY AND SYNCHRONIZATION: Consider the high-level source code for two processes: process p: x-x+10 process q: x-x-10 p and q are executing concurrently, have separate local Registers, and share memory. a) What is meant by a critical section? b) How do these processes execute on an Assembly level? (pseudo-code for p and q) variable x? DEMONSTRATE your response with a tracing of the code or a diagram of the c) When these processes execute concurrently, how does the time slice affect the result for the memory. 4. CRITICAL SECTION: pl: Given the following code and the initial conditions: turn = 1, f1 = false, f2= false; (note: turn is a shared variable) while(true) { fl = true; turn = 2; while (f2 and turn = 2) /*wait*/ CS p2: while (true) { f2= true; bold at 802000 turn = 1; oy no mom while (fl and turn ==1)/*wait*/ solbeob izi vil o bobolbe CS fl = false; remaining section; f2= false; pr remaining section; owt gredz a) Does the above code satisfy mutual exclusion? If YES, explain why. If NO, give an example. b) Does the above code satisfy no lockout? If YES, explain why. If NO, give an example. c) Does the above code satisfy no starvation? If YES, explain why. If NO, give an example. d) Does the above code satisfy no deadlock? If YES, explain why. If NO, give an example. 5. CLASSIC SYNCHRONIZATION PROBLEMS: Briefly describe ONE of the classic problems that you wrote about in the assigned homework and explain the solutions to the problem. bomung

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
operating systems principles Homework. Please help me with question 3, thanks!
}
3. CONCURRENCY AND SYNCHRONIZATION:
Consider the high-level source code for two processes:
process p:
x-x+10
process q:
x-x-10
p and q are executing concurrently, have separate local Registers, and share memory.
a) What is meant by a critical section?
b) How do these processes execute on an Assembly level? (pseudo-code for p and q)
variable x? DEMONSTRATE your response with a tracing of the code or a diagram of the
c) When these processes execute concurrently, how does the time slice affect the result for the
memory.
4. CRITICAL SECTION:
pl:
Given the following code and the initial conditions: turn = 1, f1 = false, f2= false;
(note: turn is a shared variable)
while(true) {
fl = true;
turn = 2;
while (f2 and turn = 2) /*wait*/
CS
p2:
while (true) {
f2= true; bold at 802000
turn = 1; oy no mom
while (fl and turn ==1)/*wait*/
solbeob izi vil o bobolbe CS
fl = false;
remaining section;
f2= false; pr
remaining section;
owt gredz
a) Does the above code satisfy mutual exclusion? If YES, explain why. If NO, give an
example.
b) Does the above code satisfy no lockout? If YES, explain why. If NO, give an example.
c) Does the above code satisfy no starvation? If YES, explain why. If NO, give an
example.
d) Does the above code satisfy no deadlock? If YES, explain why. If NO, give an example.
5. CLASSIC SYNCHRONIZATION PROBLEMS:
Briefly describe ONE of the classic problems that you wrote about in the assigned
homework and explain the solutions to the problem.
bomung
Transcribed Image Text:} 3. CONCURRENCY AND SYNCHRONIZATION: Consider the high-level source code for two processes: process p: x-x+10 process q: x-x-10 p and q are executing concurrently, have separate local Registers, and share memory. a) What is meant by a critical section? b) How do these processes execute on an Assembly level? (pseudo-code for p and q) variable x? DEMONSTRATE your response with a tracing of the code or a diagram of the c) When these processes execute concurrently, how does the time slice affect the result for the memory. 4. CRITICAL SECTION: pl: Given the following code and the initial conditions: turn = 1, f1 = false, f2= false; (note: turn is a shared variable) while(true) { fl = true; turn = 2; while (f2 and turn = 2) /*wait*/ CS p2: while (true) { f2= true; bold at 802000 turn = 1; oy no mom while (fl and turn ==1)/*wait*/ solbeob izi vil o bobolbe CS fl = false; remaining section; f2= false; pr remaining section; owt gredz a) Does the above code satisfy mutual exclusion? If YES, explain why. If NO, give an example. b) Does the above code satisfy no lockout? If YES, explain why. If NO, give an example. c) Does the above code satisfy no starvation? If YES, explain why. If NO, give an example. d) Does the above code satisfy no deadlock? If YES, explain why. If NO, give an example. 5. CLASSIC SYNCHRONIZATION PROBLEMS: Briefly describe ONE of the classic problems that you wrote about in the assigned homework and explain the solutions to the problem. bomung
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education