subject

Use semaphore(s) to solve the following problem. There are three processes: P1, P2, and P3. Each process Pi has a segment of codes Ci, i=1, 2, 3. These three processes are executed only once, i. e., no repeat or loop at all, and their executions can start at any time. Your goal is to ensure that the execution of C1, C2, and C3 must satisfy the following conditions:
a. If C1 is executed ahead of C2 and C3, C2 must be executed ahead of C3.
b. Otherwise, C1 must be executed after both C2 and C3 are executed. In this case, the order of C2 and C3's execution doesn't matter. One of the possible execution orders is demonstrated below. Obviously, two other possible sequences in time are C2, C3, C1 and C3, C2, C1.
Please write your algorithm level code for semaphore initialization and usage in each code segment. [Hint: no if statements should ever be used. All you need is some semaphore function calls surrounding C1, C2, and C3 and their initial values.]

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 19:30, davisparker5269
Write a function processpeople() that takes the name of a file as a parameter. each line of the file corresponds to information about a person. in particular a line contains either a name (in the form lastname, firstname with no spaces in it) or a name (lastname, firstname) and a year. the function will process the file, creating a person object for each line in the file. the function will print information about each line as it processes it, as well as appending the new person object into a list. make sure to use person methods to display information rather than recreating the work you did for the first problem. once the entire file has been processed, the function returns the list of person objects created from the file. if the file is empty, the function should return an empty list. if the input file cannot be opened, the function should print a message to that effect and then return an empty list. the following shows what would be displayed for two example files which have been provided in the link. the file none. txt does not exist. note that your function must work on an arbitrary file that consists of valid lines. you cannot assume anything about the file except that it contains lines that have the format described above.
Answers: 2
image
Computers and Technology, 22.06.2019 15:10, reycaden
David is in week 3 of his current ashford course and has a paper due by monday night at midnight. he has finished everything but the concluding paragraph. as he boots up his computer to work on it, he sees a flash across the screen and then the screen goes black. he begins to panic as he tries desperately to turn the laptop back on. david should have saved his work on what kind of portable device?
Answers: 2
image
Computers and Technology, 22.06.2019 21:30, aesthetickait
How do you take a green screen out of the video while editing?
Answers: 2
image
Computers and Technology, 22.06.2019 23:50, Crull5999
List a few alternative options and input and output over the standerd keyboard and monitor. explain their functioning in details.
Answers: 2
You know the right answer?
Use semaphore(s) to solve the following problem. There are three processes: P1, P2, and P3. Each pro...

Questions in other subjects:

Konu
Mathematics, 26.05.2021 20:30