Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Semaphores: How many A's and B's are printed from the following processes: Can someone please explain to me how this is calculated? I'm confused about

Semaphores: How many A's and B's are printed from the following processes:

image text in transcribed

Can someone please explain to me how this is calculated? I'm confused about how semaphores work when they aren't implemented as mutex locks. I think the answer is B.), but i'm not sure why that is. Thanks.

17. As shown with the following code, four processes produce output using the routine "printf" and synchronize using three semaphores "R", "S" and "T." 25 Semaphore R=1, S = 3, T = 0; /* initialization */ /*process 1 *//* process 2/ while (true) /*process 3 while (true) P (T) /*process 4 while (true) ( */ while (true) [ P (S) printf('A') P (T) printf ('B'); printf ('C' V (T) P (R); printf 'E'; V (T) printf ('D' V (R) 17.1 How many A and B's are printed when this set of processes runs? A. 2 As and 3 B B. 3 As and any Bs C. 1A and 0 B D. Any As and any Bs

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

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

More Books

Students also viewed these Databases questions