Three processes are involved in printing a file (pictured below). Process A reads the file data...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Three processes are involved in printing a file (pictured below). Process A reads the file data from the disk to Buffer 1, Process B copies the data from Buffer 1 to Buffer 2, finally Process C takes the data from Buffer 2 and print it. Process A Read from File --- Process B | Buffer 1 |-------- copy Buffer 2 Process C print Assume all three processes operate on one (file) record at a time, both buffers' capacity are one record. Write a program to coordinate the three processes using semaphores. And thread 5 will print all necessary spaces. [You will need semaphore for proper synchronization] Write a code that prints "Are Roses Red?" in console. Your code should have 5 threads. Thread one will print: "Are" Thread two will print: "Roses" Thread three will print: "Red" Thread four will print: "?" Three processes are involved in printing a file (pictured below). Process A reads the file data from the disk to Buffer 1, Process B copies the data from Buffer 1 to Buffer 2, finally Process C takes the data from Buffer 2 and print it. Process A Read from File --- Process B | Buffer 1 |-------- copy Buffer 2 Process C print Assume all three processes operate on one (file) record at a time, both buffers' capacity are one record. Write a program to coordinate the three processes using semaphores. And thread 5 will print all necessary spaces. [You will need semaphore for proper synchronization] Write a code that prints "Are Roses Red?" in console. Your code should have 5 threads. Thread one will print: "Are" Thread two will print: "Roses" Thread three will print: "Red" Thread four will print: "?"
Expert Answer:
Answer rating: 100% (QA)
Below is a simple Python program using threading and semaphores to achieve the desired coordination ... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these operating system questions
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
Write a Summary of Tartuffe the Norton anthology of western literature.
-
The current price of a stock is $20. In 1 year, the price will be either $26 or $16. The annual risk-free rate is 5 percent. Find the price of a call option on the stock that has an exercise price of...
-
Sparkling Clean Dry Cleaners Inc. began operations on January 1, 2011. In its first year, the following transactions occurred: 1. Issued common shares for $150,000 cash. 2. Purchased dry cleaning...
-
Consider the following cash flow profile, and assume MARR is 10 percent/year and the finance rate is 4 percent/year. a. Determine the MIRR for this project. b. Is this project economically...
-
Mt. Sinai Hospital in New Orleans is a large, private, 600-bed facility, complete with laboratories, operating rooms, and x-ray equipment. In seeking to increase revenues, Mt. Sinai's administration...
-
2. An engineer is planning for a 15-year retirement. In order to supplement his pension and offset the anticipated effects of inflation, he intends to withdraw $6000 at the end of the first year, and...
-
Enlightened Eats in Anchorage, Alaska, has six employees who are paid semimonthly. Calculate the net pay from the information provided below for the November 15 pay date. Assume that all wages are...
-
The following data gives the distances that a sample of Johannesburg car owners drive during one week. Distance driven (km) 114 69 91 24 61 107 110 120 42 146 255 95 143 110 77 281 146 266 120 85 144...
-
1. Do you agree that "planning is a bridge between the present and the future"? Explain 2. Discuss some of the reasons as to why planning is an important function of management. How does planning...
-
A portion of the currently running process's page table is shown below: Virtual page # Reference Valid bit Dirty bit Frame # bit 7 1 1 1 3 8 0 0 0 9 1 0 1 -- 4 10 0 0 11 12 1 1 1 1 0 0 - 0 0 1 Assume...
-
When did the split between the two primate suborders (Strepsirrhini and Haplorrhini) occur? Group of answer choices 100-110 million years ago 5-10 million years ago 70-80 million years ago 30-40...
-
Motivations for investing in the futures market includes all of the following EXCEPT Question 2 options: speculation. hedging a current holding against the risk of an adverse price change. the...
-
On an island, nine people are waiting, one behind the other, for a boat ride. The queue is made up of two kinds of people, the liars who always lie and the sincere who always tell the truth. Each of...
-
Design the simplest digital circuit that has three inputs, A, B and C, which produces an output value of 1 whenever btwo or more of the input variables has the value 0: otherwise the output has to be...
-
In your readings, there were many examples given for nurturing close family relationships in this ever-evolving technological society we live in Based upon your readings and research describe three...
-
In 2012, Gale and Cathy Alexander hosted an exchange student, Axel Muller, for 9 months. Axel was part of International Student Exchange Programs (a qualified organization). Axel attended tenth grade...
-
Frank Willingham has the following transactions during the year: Sale of office equipment on March 15 that cost $20,000 when purchased on July 1, 2010. Frank has claimed $5,000 in depreciation and...
-
Mike sells his home to Jane on April 2, 2012. Jane pays the property taxes covering the full calendar year in October, which amount to $2,500. How much may Mike and Jane each deduct for property...
-
Read the following extract from an article about a business venture of the Bob Jane company. Is prudence still a virtue? The concept of prudence and its use, or non-use, in financial reporting has...
-
Your friend Ninette Nobis was a tourism management student when you were at university together and is now a manager of an upmarket hotel in the Exquisite Hotels chain. Because of the impact of an...
-
Transactions affecting Bradford Ltds accounts receivable for the year ended 30 June are presented below. On 1 July of the previous year, the opening balance of the Allowance for Doubtful Debts...
Study smarter with the SolutionInn App