Create a deadlock prevention program that submits processes

Assignment Help C/C++ Programming
Reference no: EM133119190

Question 1: Create a server process that accepts input from each of several clients. One at a time, a client sends a struct containing three values: a job name, a CPU burst (an integer), and a private FIFO name through a FIFO named Common_FIFO. The server calculates a running total of all CPU bursts it has received so far from the clients, and sends the current running total of CPU bursts back to the current client through its individual private FIFO. The server prints the name of the job, the value from the current client, and the current running total. After three clients have submitted their structs, the server calculates the average of all integers submitted by the clients.

A client prompts the user to enter an integer value between 1 and 16. If the integer is not in that range, continue to prompt the user for a valid integer. The current running total that is sent to the client from the server is also displayed on the client.

For example:
client 1 sends: Hmwk_6.c, 15, FIFO_4567 -> server calculates total as 15 and sends 15 to client 1
client 2 sends: OS_24, 9, FIFO_1238 -> server calculates total as 24 and sends 24 to client 2
client 3 sends: Prog_1.c, 8, FIFO_6789 -> server calculates total as 32 and sends 32 to client 3
... the server echoes all the values it receives from the clients
... the server prints "Average of 3 input values is 10.67 "
... to format this nicely, you can use: printf("%.2f", average);

Common_FIFO is created and opened once, and receives one struct input per client.

Prepare your own test data. For testing purposes, burst values will be those given in the example. Your program should allow one of the clients to input a value of 0, then 28 before it submits a valid integer in the range.

Question 2: Create a Deadlock Prevention programthat submits processes to the Ready State only if they can be allocated all of the devices they request for execution. The server has a list of total resources, such as scanner, laser printer, and 3-D printer and a total number of devices for each. A client is prompted to enter a given device (for example "S", "L" or "D") and the number of instances of that device needed. Such a request is sent to the server by several clients. If the full request for devices cannot be allocated for this client, none of the devices will be allocated and the client request is rejected with a message back to the client. If the full request for devices can be satisfied, this client is allowed to be placed in the Ready State. Use appropriate print statements to indicate whether or not device requests are satisfied, thus allocated. When at least 3 clients have been added successfully to the Ready state, the server "runs" the client processes that are in the Ready State (by adding the CPU burst to a "clock"). As each process completes, its resources will be deallocated and added back to the available resources. Show the initial list of resources, the available resources after they have been allocated for each client, and the final list of resources when a process completes. Report to each client its individualturnaround time and the average turnaround time for all client processes.

Assume that all processes arrive at time 0. Format your output to one place after the decimal.

Reference no: EM133119190

Questions Cloud

Prepare a statement of owner equity for the year ended : On January 1, 20Y3, Xavier Heffner, Capital had a balance of $154,200. Prepare a statement of owner equity for the year ended
Dealing with a american call on currency : Suppose that you are dealing with a American call on currency, and that the foreign currency has risk-free rate 0. Explain why, in this case, the American call
Corporate bond fund and the stock index fund : The risk-free asset (), an S&P 500 index fund (S), and a corporate bond fund (B) have the following statistical properties:
What is tremor ltd final cost of the inventory that it kept : Tremor Ltd returned 45% of the goods to the seller and later took a 2% settlement discount. What is Tremor Ltd's final cost of the inventory that it kept
Create a deadlock prevention program that submits processes : Create a Deadlock Prevention program that submits processes to the Ready State only if they can be allocated all of the devices they request for execution
Analyzing the returns of tesla : You are analyzing the returns of Tesla through the lens of the CAPM. You decide to plot a scatterplot of the excess monthly returns of TSLA relative to the exce
What was cost of goods sold : For the current period, following data were taken from the ledger: Beginning inventory was $8,000 and ending inventory was $13,000. What was cost of goods sold
What is the operating cash flow for project : The applicable tax rate is 25 percent. What is the operating cash flow for this project? (You need to show your work and the result)
Three years of compounding interest : Calculate how much their money market fund is now worth after three years Of compounding interest. Can they run the store with their employees on duty if they a

Reviews

Write a Review

C/C++ Programming Questions & Answers

  User entry to a month value and display

Convert the user's entry to a Month value and display it.Create an enumeration named Planet that holds the names for the eight planets in our solar system, starting with MERCURY and ending with NEPTUNE.

  Write a program that allows users to enter a dollar amount

Write a program that allows users to enter a dollar amount for their bank account balance at the beginning of the month. Then ask the user to enter a dollar amount for any number of checks written in a month, up to 50. Include an approriate sentinel ..

  Function to compute total motion for single signal input

A control system applies a force to an actuator proportional to the voltage of a signal coming into the control system. It is desired not to allow actuator to quiver back and forth in the presence of small corrections near zero-force point. More f..

  In this program you will implement a simple reverse polish

in this program you will implement a simple reverse polish notation rpn calculator. rpn is a notation in which

  Prompt the user for and read 6 numbers

Write a program using an array that will store input data. Prompt the user for and read 6 numbers between 70 and 90. Verify the numbers should be greater than 70 and less than 90. If the number is less than or equal to 70 or greater than 90, repro..

  Create and print out the two arrays

Create and print out the two arrays: (Be sure to do this first) You are allowed to hard code these arrays into your program.

  Explain how to represent a lagged fibonacci generator

Explain how to represent a lagged Fibonacci generator using list abstract data types. What representation would be the most appropriate?

  Compute the sum of the integers

Write a short code fragment that would compute the sum of the integers from 1 to 100 and leave this sum in $6. No input or output is necessary.

  Recursive function could result in an infinite loop

Briefly explain how the following recursive function could result in an infinite loop and what you could do to correct this:

  Calculate and displays the number of slices of pizza

The manager of a pizza palace wants a program that calculate and displays the number of slices of pizza into which a circular pizza can be divided . The manager will enter the radius of the entire pizza.

  Write a function named vowelwords

Write a function named vowelwords(), that reads the file text1.txt and create a new file named text2.txt, which shall contain only those words from the file text1.txt which don’t start with an uppercase vowel(i.e., with ‘A’,’E’,’I’,’O’,’U’)

  Develop a simple prototype version of algorithm

Part 1: Before attempting this implementation, you choose to develop a simple prototype version of this algorithm in C++.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd