A very simple OS may be represented as a set of three threads interacting as follows:...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
A very simple OS may be represented as a set of three threads interacting as follows: Process Simple_OS; reader_thread { } while (1) { } } main_body_thread { while (1) { } read data from input device; deposit data in input_buffer; } fetch data from input_buffer; process data and generate output result; deposit result in output_buffer; display_thread { while (1) { fetch result from output_buffer; display result on output device } The simple OS suffers with concurrency issue. Modify and augment this simple OS using semaphore operations to properly buffer the input data that flows from the reader to the main body, and the output result that flows from main body to the display. Assume that both input and output buffers have N buffers and the fetch statement can access the buffers correctly. You have to make use of semaphores to coordinate amongst the three threads. Remember to properly initialize the semaphores before using them (similar to the approach adopted in the lecture note, e.g., slide # 28 of Lecture note 06- Synchronization). A very simple OS may be represented as a set of three threads interacting as follows: Process Simple_OS; reader_thread { } while (1) { } } main_body_thread { while (1) { } read data from input device; deposit data in input_buffer; } fetch data from input_buffer; process data and generate output result; deposit result in output_buffer; display_thread { while (1) { fetch result from output_buffer; display result on output device } The simple OS suffers with concurrency issue. Modify and augment this simple OS using semaphore operations to properly buffer the input data that flows from the reader to the main body, and the output result that flows from main body to the display. Assume that both input and output buffers have N buffers and the fetch statement can access the buffers correctly. You have to make use of semaphores to coordinate amongst the three threads. Remember to properly initialize the semaphores before using them (similar to the approach adopted in the lecture note, e.g., slide # 28 of Lecture note 06- Synchronization).
Expert Answer:
Answer rating: 100% (QA)
Process SimpleOS readerthread while1 PS read data from input device deposit data in input... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
A 10 GHz radar signal may be represented as a uniform plane wave in a sufficiently small region. Calculate the wavelength in centimeters and the attenuation in nepers per meter if the wave is...
-
A circle is represented as a set of x and y coordinates of the screen pixel, where the shape of the circle is drawn, and an integer represent the diameter of the circle. Please design and implement...
-
This problem demonstrates the use of semaphores to coordinate three types of processes.6 Santa Claus sleeps in his shop at the North Pole and can only be awakened by either (1) all nine reindeer...
-
Sketch the graph and draw several vertical and horizontal traces. (x, y) = sin(x y)
-
Chemical Waste Treatment, Inc., a fast-growing company that disposes of chemical wastes, has an $800,000 line of credit at its bank. One section in the credit agreement says that the ratio of cash...
-
Which of the five typical response styles users will experience with Hello Barbie?
-
In the past five years, there have been significant innovations in technology such as smartphones and tablets. Technology companies rely on intellectual property (IP) rights, such as patents,...
-
Arndt Company provides the following information for the month ended October 31, 2014: sales on credit $280,000, cash sales $100,000, sales discounts $5,000, and sales returns and allowances $11,000....
-
Find the two unknown sides in this triangle. Keep 4 significant digits. x+3.10m -240m-x 5.21m
-
This diagram shows an electron tube. Electrons emitted from the cathode accelerate towards the anode and then pass into a uniform electric field created by two oppositely charged horizontal metal...
-
Reduce the matrix To reduced row echelon form without introducing fractions at any intermediate stage. 2 1 0 -2 -29 3 3 4
-
What are two ways in which performance of a contract can be accomplished?
-
Under the UCC, in the case of a merchant, what does good faith mean?
-
Frank owes Jim $1,000. Frank contracts with Danylo to pay the $1,000 and notifies Jim of the contract by e-mail. Jim replies by e-mail that he agrees. After Frank receives Jims reply, Danylo and...
-
In an action to rescind a contract for fraudulent misrepresentation, proof of injury is required for damages to be awarded. (True/False)
-
Liquidated damages are uncertain in amount. (True/False)
-
A series reaction: A k2 B C occurs over a solid catalyst. The temperature of the bulk gas is 500 K and that of the catalyst surface is 525 K. The mass transfer coefficients for all of the species are...
-
Suppose that the laptop of Prob. 2.16 is placed in an insulating briefcase with a fully charged battery, but it does not go into sleep mode, and the battery discharges as if the laptop were in use....
-
State whether the divergence of the following vector fields is positive, negative, or zero: (a) the thermal energy flow in J/(m 2 s) at any point in a freezing ice cube; (b) the current density in...
-
A filamentary conductor carrying current I in the a z direction extends along the entire negative z axis. At z = 0 it connects to a copper sheet that fills the x > 0, y > 0 quadrant of the xy plane....
-
Coaxial conducting cylinders are located at = 0.5 cm and = 1.2 cm. The region between the cylinders is filled with a homogeneous perfect dielectric. If the inner cylinder is at 100 V and the outer...
-
From the following account balances of Josland at 31 December 20X2 prepare a balance sheet in both T-format and narrative classified format. Cash at bank $113 500 Accounts receivable (net) 52 400...
-
Flightboat Ltd borrowed $60 000, issued $20 000 worth of ordinary shares, paid a dividend of $50 000 and the owner withdrew $10 000 in cash. What was Flightboats net cash provided (used) by financing...
-
Obtain the Woolworths 2018 annual report and answer the following questions. Required: 1 How does Woolworths report on its corporate responsibility? 2 List three important points the CEO makes...
Study smarter with the SolutionInn App