Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

a/What is the state of the process after all threads have completed? b/What value(s) could (r1, r2) have when T2() completes? c/ T or F:

image text in transcribeda/What is the state of the process after all threads have completed? b/What value(s) could (r1, r2) have when T2() completes? c/ T or F: Whether T1 runs T1A() or T1B() does not change the possible values T2 can have in r1 when it completes.

49. Consider the possible values that r1 could have when T2 completes, and mark the following statement as true or false: Whether T1 runs T1A() or T1B) does not change the possible values T2 can have in rl when it completes. The following question asks you to consider a C program fragment. Threads T1, T2, and T3 concurrently run in the same address space and complete the functions with corresponding names. This question asks you about the state of the process after all threads have com- pleted. Note that x and y are allocated in the static data segment; you may treat them as if they are on the heap, and assume that they are aligned 32-bit words. int x = 0; int y = 0; void T1() { x = x + 1; } void T2() { y = y + 1; } void T3() { int r1 = x; int r2 = y; } 49. Consider the possible values that r1 could have when T2 completes, and mark the following statement as true or false: Whether T1 runs T1A() or T1B) does not change the possible values T2 can have in rl when it completes. The following question asks you to consider a C program fragment. Threads T1, T2, and T3 concurrently run in the same address space and complete the functions with corresponding names. This question asks you about the state of the process after all threads have com- pleted. Note that x and y are allocated in the static data segment; you may treat them as if they are on the heap, and assume that they are aligned 32-bit words. int x = 0; int y = 0; void T1() { x = x + 1; } void T2() { y = y + 1; } void T3() { int r1 = x; int r2 = y; }

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_2

Step: 3

blur-text-image_3

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

Microsoft SQL Server 2012 Unleashed

Authors: Ray Rankins, Paul Bertucci

1st Edition

0133408507, 9780133408508

More Books

Students also viewed these Databases questions