6. Initial value of shared variable m is equal to 0 and it is stored at memory address 1100. threads A, B, Y, Z use this variable as follows: Processes A and B increase the value of m by 1. Processes Y and Z decrease the value of m by 1. Since m is shared, each process protects the critical region using semaphore S initialized to 2. Write the sequence of operations so that after each thread is executed once, the value of m is equal to-2. assume the code is used S=2 Proses A A1: W(S) A2: LOAD m, 1100 A3: ADD 1 A4: MV A, 1100 A5: S(S) Proses B B1; W(S) B2: LOAD m, 1100 83: SUBT 1 B4: MV A, 1100 B5: S(S) Proses Y Y1: W(S) Y2: LOAD m, 1100 Y3: ADD 1 Y4: MV A, 1100 Y5: S(S) Proses 2 21: W(S) 22: LOAD m, 1100 23: SUBT 1 24: MV A, 1100 25:5(5)

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
6. Initial value of shared variable m is equal to 0 and it is stored at memory address 1100. Four
threads A, B, Y, Z use this variable as follows: Processes A and B increase the value of m by 1.
Processes Y and Z decrease the value of m by 1. Since m is shared, each process protects the
critical region using semaphore S initialized to 2. Write the sequence of operations so that after
each thread is executed once, the value of m is equal to -2.3
assume the code is used
S=2
Proses A
A1: W(S)
A2: LOAD m, 1100
A3: ADD 1
A4: MV A, 1100
A5: S(S)
Proses B
B1; W(S)
B2: LOAD m, 1100
83: SUBT 1
B4: MV A, 1100
85: S(S)
Proses Y
Y1: W(S)
Y2: LOAD m, 1100
Y3: ADD 1
Y4: MV A, 1100
Y5: S(S)
Proses 2
21: W(S)
22: LOAD m, 1100
23: SUBT 1
24: MV A, 1100
25: S(S)
Transcribed Image Text:6. Initial value of shared variable m is equal to 0 and it is stored at memory address 1100. Four threads A, B, Y, Z use this variable as follows: Processes A and B increase the value of m by 1. Processes Y and Z decrease the value of m by 1. Since m is shared, each process protects the critical region using semaphore S initialized to 2. Write the sequence of operations so that after each thread is executed once, the value of m is equal to -2.3 assume the code is used S=2 Proses A A1: W(S) A2: LOAD m, 1100 A3: ADD 1 A4: MV A, 1100 A5: S(S) Proses B B1; W(S) B2: LOAD m, 1100 83: SUBT 1 B4: MV A, 1100 85: S(S) Proses Y Y1: W(S) Y2: LOAD m, 1100 Y3: ADD 1 Y4: MV A, 1100 Y5: S(S) Proses 2 21: W(S) 22: LOAD m, 1100 23: SUBT 1 24: MV A, 1100 25: S(S)
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar 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