Computer Systems: A Programmer's Perspective (3rd Edition)
Computer Systems: A Programmer's Perspective (3rd Edition)
3rd Edition
ISBN: 9780134092669
Author: Bryant, Randal E. Bryant, David R. O'Hallaron, David R., Randal E.; O'Hallaron, Bryant/O'hallaron
Publisher: PEARSON
Expert Solution & Answer
Book Icon
Chapter 12.5, Problem 12.7PP

Explanation of Solution

Instruction ordering of “badcnt.c”:

  • When performing instruction “H1”, the value of “%rdx1” and “%rdx2” is null and “cnt” value is “0”.
  • When performing instruction “L1”:
    • The instruction “L1” means loads the shared variable “cnt” into register “%rdx1”.
      • Hence, the value of “%rdx1” contains the value of “cnt” variable.
      • Therefore, %rdx1=0
  • When performing instruction “H1”, the value of “%rdx1” and “%rdx2” is null and “cnt” value is “0”.
  • When performing instruction “L2”:
    • The instruction “L2” means loads the shared variable “cnt” into register “%rdx2”.
      • Hence, the value of “%rdx2” contains the value of “cnt” variable.
      • Therefore, %rdx2=0
  • When performing instruction “U2”:
    • The instruction “U2” means update value in register “%rdx2”.
      • Update value means increment the value of “%rdx2” by “1”.

        %rdx2=%rdx2+1=0+1%rdx2=1

      • Therefore, %rdx2=1 and the value of “cnt” is “0”. Here, the “cnt” will be not be update. It only update after the instruction stored.
  • When performing instruction “S2”:
    • The instruction “S2” means store the updated value of register “%rdx2” into “cnt”.
      • Hence, %rdx2=1 and “cnt” value is “1”.
  • When performing instruction “U1”:
    • The instruction “U1” means update value in register “%rdx1”.
      • Update value means increment the value of “%rdx1” by “1”

Blurred answer
Students have asked these similar questions
A manipulator is identified by the following table of parameters and variables:a. Obtain the transformation matrices between adjacent coordinate frames and calculate the global transformation matrix.
Which tool takes the 2 provided input datasets and produces the following output dataset? Input 1: Record First Last Output: 1 Enzo Cordova Record 2 Maggie Freelund Input 2: Record Frist Last MI ? First 1 Enzo Last MI Cordova [Null] 2 Maggie Freelund [Null] 3 Jason Wayans T. 4 Ruby Landry [Null] 1 Jason Wayans T. 5 Devonn Unger [Null] 2 Ruby Landry [Null] 6 Bradley Freelund [Null] 3 Devonn Unger [Null] 4 Bradley Freelund [Null] OA. Append Fields O B. Union OC. Join OD. Find Replace Clear selection
What are the similarities and differences between massively parallel processing systems and grid computing. with references
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
Operations Research : Applications and Algorithms
Computer Science
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Brooks Cole
Text book image
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:9780357392676
Author:FREUND, Steven
Publisher:CENGAGE L
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
Fundamentals of Information Systems
Computer Science
ISBN:9781305082168
Author:Ralph Stair, George Reynolds
Publisher:Cengage Learning