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

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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