Using C programming language, you will be developing a mutual exclusion algorithm for a process synchronization problem. You need to make sure that your mutual exclusion algorithm ensures that only one process can access the critical section portion of your code at a given point in time. You are allowed to use any mutual exclusion / semaphore related C systems calls.a) Description of the problem is given below:Assume that there are a set of n bank accounts (n ≥ 1) shared by a set of x clients (x ≥ 1). Clients can perform three different types of transactions with each bank account: deposit, withdraw or transfer funds. If a particular transaction results in a negative account balance, the transaction should be ignored (i.e. an account balance should never be less than 0).b) Structure of the input file:In the following example, there are two bank accounts (a1 and a2) shared by a total of ten clients (c1 to c10). The clients are allowed to deposit money into both the accounts, withdraw money from both the accounts, and transfer money between the two accounts. The initial balances of the accounts are specified in the input file. An input file is provided below for illustrative purposes.2a1 b 5000a2 b 3500c1 d a1 100 w a2 500 t a1 a2 25c2 w a1 2500 t a1 a2 150……c9 w a1 1000 w a2 500c10 d a1 50 d a2 200Illustration:(i) a1 b 5000The above line specifies the initial balance of account #1 as $5000(ii) c1 d a1 100 w a2 500 t a1 a2 25The above line specifies the operations performed by client #1. client #1 deposits $100 into Account #1, then withdraws $500 from Account #2, and then transfers $25 from Account #1 to Account #2The input file name will be provided to the program as a command line argument (similar to Assignment 4). Hardcoding the input file is not allowed. A different input file will be used to evaluate your program for marking purposes where the structure of this input file will remain the same, and only the data will be different.You must output the balances of each bank account after all the transactions have been performed. For each bank account, your output should display the account followed by the account balance. For example:a1 b 500a2 b 300Your C program should output results to the screen and into a text file “assignment_6_output_file.txt”.c) Makefile:You are also responsible for creating and submitting a Makefile. If you are not familiar with Makefiles, consult this quick tutorial. You can also refer to the Makefile provided to you in Assignment 4.- When running make it should compile your program and build output to a6- To run your program after compiling: ./a6 [Input filename]3- make clean should remove the output file generated and the compiled executableSample Input and Output FileA sample input file “assignment_6_input_file.txt” has been provided to you with the expected output in “expected_output.txt”.For testing purposes. we have designed the sample input in a way where the final account balances will always remain the same after completing the transactions. However, when testing your program with another input file, note that due to the non-deterministic nature of threads, the final account balances may vary when running your program multiple times.a1 b 0 a2 b 2300 a3 b 3050 a4 b 3800
1
a1 b 1000 a2 b 2000 a3 b 3000 a4 b 4000 c1 d a2 100 t a1 a2 100 c2 w a1 300 t
a1 a2 500 d a4 200 c3 d a3 50 w a4 400 w a1 100 c4 w a1 40000 w a2 400
1

Purchase answer to see full
attachment




Why Choose Us

  • 100% non-plagiarized Papers
  • 24/7 /365 Service Available
  • Affordable Prices
  • Any Paper, Urgency, and Subject
  • Will complete your papers in 6 hours
  • On-time Delivery
  • Money-back and Privacy guarantees
  • Unlimited Amendments upon request
  • Satisfaction guarantee

How it Works

  • Click on the “Place Order” tab at the top menu or “Order Now” icon at the bottom and a new page will appear with an order form to be filled.
  • Fill in your paper’s requirements in the "PAPER DETAILS" section.
  • Fill in your paper’s academic level, deadline, and the required number of pages from the drop-down menus.
  • Click “CREATE ACCOUNT & SIGN IN” to enter your registration details and get an account with us for record-keeping and then, click on “PROCEED TO CHECKOUT” at the bottom of the page.
  • From there, the payment sections will show, follow the guided payment process and your order will be available for our writing team to work on it.