Question

In: Computer Science

Two processes share the variable "I". Process A increments it 10 times and process B decrements...

Two processes share the variable "I". Process A increments it 10 times and process B decrements it 25 times without using critical sections. The initial value of I is 0. The final value of I MUST be

Please explain.

Solutions

Expert Solution

                       ANSWER : HERE IS THE ANSWER FOR YOUR QUESTION:

  

                       ------------------------------------------------------------------------------------------------------

here we are given 2 processes as A and B which do not execute the critical section area .

so these will be not be synchronized , so will be executed in the one by one manner . first

process A will be executed and then process B will be executed .

initially , the value of I is 0 .

now , the process A increments value OF I 10 times .. so the final value of I after Process A finishes will   be 10

after this , process B start to execute and then it decrement the value by 25 . so the value will become as 10-25=-14

so , the final value of the I would be -14 as 0 value would also be reached

thus , the final value is -14

                       -------------------------------------------------------------------------------------------------------

I hope this would help you out.

If you like my answer , please upvote

If you have any doubt, you can provide comment /feedback below the answer

Thanks


Related Solutions

(MATLAB Question) 1a. Establish a variable “x” that goes from -10 to 10 in increments of...
(MATLAB Question) 1a. Establish a variable “x” that goes from -10 to 10 in increments of .1 1b. Create an equation of a line (y=mx+b) based on “x” with slope m=2 and y-intercept 2. (y=2x+2) 1c. Plot the line (plot(x,y)). 1d. Turn on a plot hold (hold on). 1e. Create a second equation of a line (y=mx+b) based on “x” with negative slope, slope m=-2 and a negative y-intercept -2. (y=-2x-2) 1f. Plot the second line (plot (x,y)) 1g. Create...
You are tasked with a process selection project. There are two processes (A and B) that...
You are tasked with a process selection project. There are two processes (A and B) that could potentially work for your application (cutting tubing to a specified length). Sample data is provided by the two companies. Out of the 16 samples from process A, you find an average of 17.92 inches and a standard deviation of 1.98 inches. Thirteen samples were taken from process B improvement and had an average length of 16.58 inches and a standard deviation of 1.30...
Chemco produces two chemicals A and B. These chemicals are produced via two manufacturing processes. Process...
Chemco produces two chemicals A and B. These chemicals are produced via two manufacturing processes. Process 1 requires 2 hours of labor and 1 lb of raw materials to produce 2 oz of A and 1 oz of B. Process 2 requires 3 hours of labor and 2 lbs of raw material to produce 3 oz of A and 2 oz of B. Sixty hours of labor and 40 lbs of raw material are available. Demand for Chemical A is...
Chemco produces two chemicals A and B. These chemicals are produced via two manufacturing processes. Process...
Chemco produces two chemicals A and B. These chemicals are produced via two manufacturing processes. Process 1 requires 2 hours of labor and 1 lb of raw materials to produce 2 oz of A and 1 oz of B. Process 2 requires 3 hours of labor and 2 lbs of raw material to produce 3 oz of A and 2 oz of B. Sixty hours of labor and 40 lbs of raw material are available. Demand for Chemical A is...
Consider the two processes below with specifications 100 plus or minus 10: Process A: mean of...
Consider the two processes below with specifications 100 plus or minus 10: Process A: mean of 100, standard deviation of 3 Process B: mean of 105, standard deviation of 1 n=5 for both processes a.) Calculate Cp, Cpk, and Cpm and interpret the results b.) What is the fraction non-conforming for each?
14. How many times does "#" print? for(int i = 0; i < 10; ++i) {...
14. How many times does "#" print? for(int i = 0; i < 10; ++i) { if(i == 2 || i==4 || i==6) { continue; } cout << "#"; }
Ringsmith Company is considering two different processes to make its product—process 1 and process 2. Process...
Ringsmith Company is considering two different processes to make its product—process 1 and process 2. Process 1 requires Ringsmith to manufacture subcomponents of the product in-house. As a result, materials are less expensive, but fixed overhead is higher. Process 2 involves purchasing all subcomponents from outside suppliers. The direct materials costs are higher, but fixed factory overhead is considerably lower. Relevant data for a sales level of 25,000 units follow:     Process 1     Process 2 Sales     $6,600,000    ...
1. Processes A, B, C, D, E, and F require service times of 3, 5, 2,...
1. Processes A, B, C, D, E, and F require service times of 3, 5, 2, 5, 3, and 5. Their arrival times are 0, 1, 3, 9, 10, and 12. What is the average turnaround time, waiting time, response time, and throughput when using SRJF, RR (q=2), and MLF (q=22i+1). Show your work.
1. Processes A, B, C, D, E, and F require service times of 3, 5, 2,...
1. Processes A, B, C, D, E, and F require service times of 3, 5, 2, 5, 3, and 5. Their arrival times are 0, 1, 3, 9, 10, and 12. What is the average turnaround time, waiting time, response time, and throughput when using SRJF, RR (q=2), and MLF (q=22i+1). Show your work.
A personal computer manufacturer is interested in comparing assembly times for two keyboard assembly processes. Assembly...
A personal computer manufacturer is interested in comparing assembly times for two keyboard assembly processes. Assembly times can vary considerably from worker to worker, and the company decides to eliminate this effect by selecting a random sample of 10 workers and timing each worker on each assembly process. Half of the workers are chosen at random to use Process 1 first, and the rest use Process 2 first. For each worker and each process, the assembly time (in minutes) is...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT