Question: A. Fill each entry in the following table with Yes or No for the example program in Figure 12.15. In the first column, the notation

A. Fill each entry in the following table with “Yes” or “No” for the example program in Figure 12.15. In the first column, the notation v.t denotes an instance of variable v residing on the local stack for thread t , where t is either m (main thread), p0 (peer thread 0), or p1 (peer thread 1).

Variable instance ptr cnt i.m msgs.m myid.po myid.pl main thread? Referenced by peer thread 02 peer thread 1?

B. Given the analysis in part A, which of the variables ptr, cnt, i, msgs, and
myid are shared?

Figure 12.15

1 #include "csapp.h" 2 #define N 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28

Variable instance ptr cnt i.m msgs.m myid.po myid.pl main thread? Referenced by peer thread 02 peer thread 1?

Step by Step Solution

3.33 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a The main idea here is that stack variables are private whereas global and static variables are sha... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Computer Systems A Programmers Perspective Questions!