Make a C / C++, Java, or Python program with two processes (or threads, whichever is easier for you to code), a producer and a consumer. If you want to use another language, clear it with me first. The producer process/thread consists of a loop that writes the loop count (a value from 0 to 4) into a variable that it shares with the consumer process/thread (this variable is to be initialized to 100). On each pass through the loop, before the producer writes into the shared variable, it does a random wait of from one to three seconds (compute a new random wait value on each pass through the loop). The loop is to be executed five times. The consumer process consists of a loop that reads the variable it shares with the producer five times and computes the sum of the values it has read. On each pass through the loop before it reads the shared variable, it does a random wait of from one to three seconds (compute a new random value on each pass through the loop). When the loop finishes, the program is to write the sum into a file. You must run the program twice and submit the output from both runs. Note that the output from the runs will almost certainly be different if you have written your program correctly. Place a zip file with the code, a copy of the output from each of your runs for grading (the output file must be to a data file and not a screen shot) in the D2L Dropbox for the 2nd assignment. Also include a word or text file with your observations on the assignment: What did you notice about the runs? What if anything did you learn doing this assignment? Roughly how long (in hours) did the assignment take? Please put comments at the top of your program with your name, the date, the assignment number, and a brief description of the program. I also want to see comments within the program. The first items in your data file and observations file must be your name and the assignment number (have your program output this information into your output file). Note, I do not want screen shots, your program must output to a data file which is to be sent to me. You are to zip your files together and place the zip file in the drop box for assignment 2 on D2L - do not send me a tar file or another type of compression file or place the files out on the Internet or the Cloud for me to pick up. If you do not know how to create a process/thread in Java, C/C++, or Python or do not know how to do a random wait, or how to output to a data file, it is your responsibility to learn how. This information is available on the Internet. The contents of you output file should look something like this (where ### is your computed sum). If you have the output from both runs in the same file, you do not need to repeat your name and the assignment number. John Smith Computer Operating Systems Assignment #2 The sum is ###

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter8: Advanced Method Concepts
Section: Chapter Questions
Problem 7RQ
icon
Related questions
Question
Make a C / C++, Java, or Python program with two processes (or threads, whichever is easier for you to code), a producer and a consumer. If you want to use another language, clear it with me first. The producer process/thread consists of a loop that writes the loop count (a value from 0 to 4) into a variable that it shares with the consumer process/thread (this variable is to be initialized to 100). On each pass through the loop, before the producer writes into the shared variable, it does a random wait of from one to three seconds (compute a new random wait value on each pass through the loop). The loop is to be executed five times. The consumer process consists of a loop that reads the variable it shares with the producer five times and computes the sum of the values it has read. On each pass through the loop before it reads the shared variable, it does a random wait of from one to three seconds (compute a new random value on each pass through the loop). When the loop finishes, the program is to write the sum into a file. You must run the program twice and submit the output from both runs. Note that the output from the runs will almost certainly be different if you have written your program correctly. Place a zip file with the code, a copy of the output from each of your runs for grading (the output file must be to a data file and not a screen shot) in the D2L Dropbox for the 2nd assignment. Also include a word or text file with your observations on the assignment: What did you notice about the runs? What if anything did you learn doing this assignment? Roughly how long (in hours) did the assignment take? Please put comments at the top of your program with your name, the date, the assignment number, and a brief description of the program. I also want to see comments within the program. The first items in your data file and observations file must be your name and the assignment number (have your program output this information into your output file). Note, I do not want screen shots, your program must output to a data file which is to be sent to me. You are to zip your files together and place the zip file in the drop box for assignment 2 on D2L - do not send me a tar file or another type of compression file or place the files out on the Internet or the Cloud for me to pick up. If you do not know how to create a process/thread in Java, C/C++, or Python or do not know how to do a random wait, or how to output to a data file, it is your responsibility to learn how. This information is available on the Internet. The contents of you output file should look something like this (where ### is your computed sum). If you have the output from both runs in the same file, you do not need to repeat your name and the assignment number. John Smith Computer Operating Systems Assignment #2 The sum is ###
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Race Condition
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,