Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. Program Design (10) There are black and white balls in a box. Now two processes A and B are employed to separate the black

image text in transcribed
3. Program Design (10) There are black and white balls in a box. Now two processes A and B are employed to separate the black and white balls. Process A takes out a black ball each access, and process B takes out a white ball each access. Write the PV semaphore operations for process A and B for the following situations, respectively. Note that the semaphore and its initial value should be defined. 1) When A is using the box, B is not allowed to use the box. When B is using the box, As is not allowed to use the box. Write the PV operations for the ball producer machine and process A/B 2) The two processes should take turns to pick up balls from the box, which means that after process A access to the box, process B should access to the box, then process A, process B, process A, process B... Write the PV operations for the ball producer machine and process A/B 4. Short-answer Questions (20) 1.(5) Draw the diagram of process state. 2.(6) Describe the differences among short-term, medium-term and long-term scheduling. 3.(4) Peterson's solution is a classic software-based solution to the critical-section problem. Explain why Peterson's solution can solve the critical-section problem. Here is the Peterson's solution. do { flag[i] = true; turn =j; while (flag[i] && turn == j); I/critical section flag[i] = false; //remainder section } while (true); 4.(5) What is deadlock? List the four necessary conditions for deadlock

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introductory Relational Database Design For Business With Microsoft Access

Authors: Jonathan Eckstein, Bonnie R. Schultz

1st Edition

1119329418, 978-1119329411

More Books

Students also viewed these Databases questions

Question

What are the purposes of promotion ?

Answered: 1 week ago