Write a program in c to detect if the system will face any deadlock in the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program in c to detect if the system will face any deadlock in the future. If a deadlock is detected then print "Deadlock Ahead" otherwise print "Safe here". The situation is given below. (Allowed to use Banker's Algorithm). [10 Marks] Note: The code can be implemented in several different ways, but make sure the parameter remains the same as shown below. n = 5; // Number of processes m = 4; // Number of resources int alloc[5][4] = {{0, 1, 0, 3}, // PO// Allocation Matrix {2, 0, 0, 0}, // P1 {3, 0, 2, 0}, // P2 {2, 1, 1, 5}, // P3 { 0, 0, 2, 2} }; // P4 int max[5][4] ={{ 6, 4, 3, 4}, // PO // MAX Matrix {3, 2, 2, 1}, // P1 {9, 1, 2, 6}, // P2 {2, 2, 2, 8}, // P3 {4, 3, 3, 7}}; // P4 int avail[4] = {3, 3, 2, 1}; //Available resources Write a program in c to detect if the system will face any deadlock in the future. If a deadlock is detected then print "Deadlock Ahead" otherwise print "Safe here". The situation is given below. (Allowed to use Banker's Algorithm). [10 Marks] Note: The code can be implemented in several different ways, but make sure the parameter remains the same as shown below. n = 5; // Number of processes m = 4; // Number of resources int alloc[5][4] = {{0, 1, 0, 3}, // PO// Allocation Matrix {2, 0, 0, 0}, // P1 {3, 0, 2, 0}, // P2 {2, 1, 1, 5}, // P3 { 0, 0, 2, 2} }; // P4 int max[5][4] ={{ 6, 4, 3, 4}, // PO // MAX Matrix {3, 2, 2, 1}, // P1 {9, 1, 2, 6}, // P2 {2, 2, 2, 8}, // P3 {4, 3, 3, 7}}; // P4 int avail[4] = {3, 3, 2, 1}; //Available resources
Expert Answer:
Related Book For
Statistics For Managers Using Microsoft Excel
ISBN: 9780133130805
7th Edition
Authors: David M. Levine, David F. Stephan, Kathryn A. Szabat
Posted Date:
Students also viewed these programming questions
-
1a) provide a reflection on management and leadership skills by using a different range of models and develop as well as justify a personal development plan that will facilitate an increased level of...
-
Q1. You have identified a market opportunity for home media players that would cater for older members of the population. Many older people have difficulty in understanding the operating principles...
-
(a) A user complains that their web application Times Out after successfully connecting to a remote host, yet, an investigation with ping indicates the remote host is alive. Propose a cause of this...
-
iHerb Inc. has several herb extractor evaporators that were purchased four years ago at a price of $20,000. These machines currently require annual maintenance costs of $2,000. However, the...
-
Which of the following statements is/are true for a 0.10 M solution of a weak acid HA?
-
Globalization affects businesses, but it also has a direct impact when a person a. uses technology to communicate with other gamers in Japan. b. has opportunities to study or work in countries around...
-
The Merton Manufacturing Co Ltd has been in business for many years making fitted furniture and chairs. During 2004 and 2005 substantial losses have been sustained on the manufacture of chairs and...
-
On January 1, 2014, Ridge Road Company acquired 20 percent of the voting shares of Sauk Trail, Inc. for $2,700,000 in cash. Both companies provide commercial Internet support services but serve...
-
please help me solve Hudson River Bakery reported net sales revenue of \( \$ 36,000 \) and cost of goods sold of \( \$ 10,000 \). Compute Hudson River's correct gross profit if the company made...
-
(Liberatore and Miller, 1985) A manufacturing facility uses two production lines to produce three products over the next 6 months. Backlogged demand is not allowed. However, a product may be...
-
. Minden Company is a wholesale distributor of premium European chocolates. The company's balance sheet on April 30 is as follows: MINDEN COMPANY Balance Sheet April 30 Assets Cash $ 11,006...
-
How do emerging trends in natural language processing (NLP) and conversational query interfaces influence the design and implementation of natural language queries, semantic parsing, and query...
-
How do relational database management systems optimize storage and retrieval operations through the implementation of various table indexing techniques, including B-trees, hash indexes, and bitmap...
-
How do you center align an element horizontally and vertically using CSS? Provide the CSS code.
-
How do advanced query planning strategies such as multi-stage optimization, bushy tree optimization, and join order enumeration address the combinatorial explosion of query plan search space,...
-
How do modern database management systems optimize table structures to minimize storage overhead and maximize query performance, considering techniques such as data compression, indexing, and...
-
Sylvestor Systems borrows $143,000 cash on May 15 by signing a 150-day, 7%, $143,000 note. 1. On what date does this note mature? 2-a. Prepare the entry to record issuance of the note. 2-b. First,...
-
The company manufactures three products: wooden chairs, tables and dressers. AFC started off as a 'Mom & Pop' shop but has grown rapidly. AFC uses one assembly line to build all three products,...
-
A survey of 2,250 American adults reported that 59% got news both online and offline in a typical day. (Data extracted from "How Americans Get News in a Typical Day," USA Today, March 10, 2010, p....
-
The 2012 Restaurant Industry Forecast takes a closer look at today's consumers. Based on a 2011 National Restaurant Association survey, American adults are categorized into one of three consumer...
-
Prenumbered sales invoices are kept in a LYJ sales journal. The invoices are numbered from 0001 to 5000. a. Beginning in row 16, column 01, and proceeding horizontally in a table of random numbers,...
-
Tobacco Leaf Treehouses, Inc., a Kentucky company, has determined that a majority of its customers are located in the Pennsylvania area. It therefore is considering using a lockbox system offered by...
-
Your firm has an average receipt size of \($50.\) A bank has approached you concerning a lockbox service that will decrease your total collection time by three days. You typically receive 12,000...
-
Pete Moss, Inc., a large fertilizer distributor based in California, is planning to use a lockbox system to speed up collections from its customers located on the East Coast. A Philadelphia-area bank...
Study smarter with the SolutionInn App