$24
The given bank.c program has 3 processes namely, the dad process and two son processes where a son withdrawing money from the bank and the dad depositing money in the bank, at randomly selected time intervals. The program in the given form has synchronization errors and logical errors. The program itself compiles correctly.
In the bank there are also 2 atm machines. Meaning at a time there are only 2 processes that can request to view the balance or can withdraw or deposit money.
Task1:
Identify the critical section and synchronize the program. You would need to use P(sem) and V(sem) operations at the right places to solve the synchronization problem. You will also need to find the logical flaw if there is any and try to solve it. To use P(sem) and V(sem) include the provided “sem.h” file. Your solution should solve the following problems:
• Prevent race conditions
• Prevent a son from withdrawing money when there is no balance.
• Prevent undefined outputs like negative balance
• Prevent a process from continuously requesting access to the shared memory. Prevent unnecessary cpu cycle.
• The problem should be solved with as few semaphore variables as possible.
Marks: 30
Task2:
Submit a report showing the critical section of the code ( and logical errors) and explain your solution in detail.
Marks: 10
Submission Instructions
• All the programs MUST be clearly indented and internally documented
• Make sure your programs compile and run without any errors
• Only include c files or txt files for submission. Do not include any executables.
• Save all your programs with meaningful names and zip into a single folder as: Lab5_[your last name here].zip (e.g., Lab5_Xyz.zip)
• Email your code with the subject line, "Task5-CSC33200–Section H(41576)-lastname"
• Email: sdebnath@ccny.cuny.edu
******
Office Hour: Thursday 11:00 AM – 12:00 PM
Zoom Link: https://ccny.zoom.us/j/82938095199
Meeting ID: 829 3809 5199
One tap mobile
+16465588656,,82938095199# US (New York)
+13126266799,,82938095199# US (Chicago)
Dial by your location
+1 646 558 8656 US (New York)
+1 312 626 6799 US (Chicago)
+1 301 715 8592 US (Washington DC)
+1 253 215 8782 US (Tacoma)
+1 346 248 7799 US (Houston)
+1 669 900 6833 US (San Jose)
Meeting ID: 829 3809 5199
Find your local number: https://ccny.zoom.us/u/kMs03gJtK
IMPORTANT NOTE: Please connect with zoom with a valid CCNY or CITYMAIL email id. Please sign up with the CITYMAIL or CCNY email address at :
https://www.ccny.cuny.edu/it/zoom