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)
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
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)](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fefb44227-8073-4f7e-b70d-cf264441fef3%2F3e7c6fb7-b9a7-476b-91f2-2590e6cc1eca%2F0offqjs_processed.jpeg&w=3840&q=75)
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
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
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)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
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)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education