Q# 01 Race conditions are possible in many computer systems. Cosider a banking system with two methocs: deposit (amount) and withdraw (amount). These two methods are passed the amount that is to be deposited or withdrawn from a bank account. Assume that a husband and wife share a bank account and that concurrently the husband calls the withdraw () method and the wife calls deposit (). Describe how a race condition is possible and what might be done to prevent the race cond tion from occurring. (10)

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
100%
9:12 l l a
Edit
50
Women University A& JK,B agh
final Exam ination semester Fall - 2020
Department: Computer Science & IT
Program: BSCS-5" MCS-3rd
Course Title: 0 perating system
Instructor: Imum Shafique
Time Allowed 8:00hrs
Marks: 45
Note:
v Attempt all questions.
v Do not write anything on the question paper, except your registration number.
v Be brief and to the point
v Do not use decorative material on papers
v Write question numbers as given in question paper
Q# 01 Race conditions are possible in many computer systems. Consider a banking system with
two methods: deposit (amount) and withdraw (amount). These two methods are passed the
amount that is to be deposited or withdrawn from a bank account. Assume that a husband and
wife share a bank account and that concurrently the husband calls the withdraw () method and
the wife calls deposit (). Describe how a race condition is possible and what might be done to
prevent the race condition from occurring. (10)
Q# 01 The first known correct software solution to the critical-section problem for two processes
was developed by Dekker. The two processes, PO and P1, share the following variables: bodean
flag{2]; /* initially false */ int tury The structure of process Pi (i == 0 or 1) is shown in Figure
below
de
flagti)- true;
while (flaglj)(
if (turn (
flaglal - false;
while (turn j)
!! do nothing
flag(i)- true,
I/ critical section
turs ji
flag(a)- falee;
I/ renainder section
) vhile (true):
the other process is Pj (j == 1 or 0). Provethat the algorithm satisfies all three
requirements for the critical-section problem (10)
DO
Dם
W
Tools
Mobile View
Share
PDF to DOC
88
Transcribed Image Text:9:12 l l a Edit 50 Women University A& JK,B agh final Exam ination semester Fall - 2020 Department: Computer Science & IT Program: BSCS-5" MCS-3rd Course Title: 0 perating system Instructor: Imum Shafique Time Allowed 8:00hrs Marks: 45 Note: v Attempt all questions. v Do not write anything on the question paper, except your registration number. v Be brief and to the point v Do not use decorative material on papers v Write question numbers as given in question paper Q# 01 Race conditions are possible in many computer systems. Consider a banking system with two methods: deposit (amount) and withdraw (amount). These two methods are passed the amount that is to be deposited or withdrawn from a bank account. Assume that a husband and wife share a bank account and that concurrently the husband calls the withdraw () method and the wife calls deposit (). Describe how a race condition is possible and what might be done to prevent the race condition from occurring. (10) Q# 01 The first known correct software solution to the critical-section problem for two processes was developed by Dekker. The two processes, PO and P1, share the following variables: bodean flag{2]; /* initially false */ int tury The structure of process Pi (i == 0 or 1) is shown in Figure below de flagti)- true; while (flaglj)( if (turn ( flaglal - false; while (turn j) !! do nothing flag(i)- true, I/ critical section turs ji flag(a)- falee; I/ renainder section ) vhile (true): the other process is Pj (j == 1 or 0). Provethat the algorithm satisfies all three requirements for the critical-section problem (10) DO Dם W Tools Mobile View Share PDF to DOC 88
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Public key encryption
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
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