COMPUTER SYSTEMS&MOD MSGT/ET SA AC PKG
COMPUTER SYSTEMS&MOD MSGT/ET SA AC PKG
3rd Edition
ISBN: 9780134671123
Author: Bryant
Publisher: PEARSON
Expert Solution & Answer
Book Icon
Chapter 12.4, Problem 12.6PP

A.

Explanation of Solution

Analysis from given section:

For variable instance “ptr”:

  • For main thread:
    • From the given code, the variable “ptr” is a global variable.
    • It is written by the main thread.
  • For peer thread 0 and thread 1:
    • The variable “ptr” is read by the peer threads.

For variable instance “cnt”:

  • For main thread:
    • From the given code, the variable “cnt” is a static variable and it is contains with only one instance in memory. Hence, it is not exist in the main thread.
  • For peer thread 0 and thread 1:
    • The variable “cnt” is read and written by the peer threads.

For variable instance “i.m”:

  • For main thread:
    • From the given code, the variable “i.m” is a local automatic variable.
    • It is stored on the stack of the main thread. Hence, this variable is exist in the main thread.
  • For peer thread 0 and thread 1:
    • The given variable is stored on the main thread, while its corresponding value is passed to the peer threads, the peer threads never place it on the stack. So, it is not shared.

For variable instance “msgs.m”:

  • For main thread:
    • From the given code, the variable “msgs.m” is a local automatic variable.
    • It is stored on the stack of the main thread. Hence, it is exist in the main thread.
  • For peer thread 0 and thread 1:
    • The given variable is stored on the main thread...

B.

Explanation of Solution

Analysis of shared variable from part A:

From the part A, the variables “ptr”,...

Blurred answer
Students have asked these similar questions
D. S. Malik, Data Structures Using C++, 2nd Edition, 2010
Methods (Ch6) - Review 1. (The MyRoot method) Below is a manual implementation of the Math.sqrt() method in Java. There are two methods, method #1 which calculates the square root for positive integers, and method #2, which calculates the square root of positive doubles (also works for integers). public class SquareRoot { public static void main(String[] args) { } // implement a loop of your choice here // Method that calculates the square root of integer variables public static double myRoot(int number) { double root; root=number/2; double root old; do { root old root; root (root_old+number/root_old)/2; } while (Math.abs(root_old-root)>1.8E-6); return root; } // Method that calculates the square root of double variables public static double myRoot(double number) { double root; root number/2; double root_old; do { root old root; root (root_old+number/root_old)/2; while (Math.abs (root_old-root)>1.0E-6); return root; } } Program-it-Yourself: In the main method, create a program that…
I would like to know the main features about the following 3 key concepts:1. Backup Domain Controller (BDC)2. Access Control List (ACL)3. Dynamic Memory
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage