Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following question asks you to consider a C program fragment. Threads T1 and T2 con- currently run in the same address space. This question

image text in transcribed

The following question asks you to consider a C program fragment. Threads T1 and T2 con- currently run in the same address space. This question asks you about the state of the process after both threads have completed in two cases: when T1 runs T1A, and when T1 runs TIBO). In both cases, T2 runs T20). Assume that lock is initially unlocked, and is an xv6 spinlock as described in the lecture notes. Note that x is allocated in the static data segment; you may treat it as if it is on the heap, and assume that it is an aligned 32-bit word. int x = x = 0; void T1A() { x = x + 1; void T1B() { acquire(\&lock); x = x + 1; release (\&lock); } void T2() { int r1 = x; } 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 TIB() 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 and T2 con- currently run in the same address space. This question asks you about the state of the process after both threads have completed in two cases: when T1 runs T1A, and when T1 runs TIBO). In both cases, T2 runs T20). Assume that lock is initially unlocked, and is an xv6 spinlock as described in the lecture notes. Note that x is allocated in the static data segment; you may treat it as if it is on the heap, and assume that it is an aligned 32-bit word. int x = x = 0; void T1A() { x = x + 1; void T1B() { acquire(\&lock); x = x + 1; release (\&lock); } void T2() { int r1 = x; } 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 TIB() does not change the possible values T2 can have in rl when it completes

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

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Shamkant B. Navathe

7th Edition Global Edition

1292097612, 978-1292097619

More Books

Students also viewed these Databases questions

Question

What is the difference between Needs and GAP Analyses?

Answered: 1 week ago

Question

What are ERP suites? Are HCMSs part of ERPs?

Answered: 1 week ago