Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hello, I really neeed help with this questions please help. Thank you To start, lets examine a simple program, loop.s. First, just look at the
Hello, I really neeed help with this questions please help. Thank you
To start, lets examine a simple program, loop.s. First, just look at the program, and see if you can understand it: cat loop.s. Then, run it with these arguments: ./x86.py -p loop.s -t 1 -i 100 -R dx This specifies a single thread, an interrupt every 100 instructions, and tracing of register %dx. Can you figure out what the value of %dx will be during the run? Once you have, run the same above and use the -c flag to check your answers; note the answers, on the left, show the value of the register (or memory value) after the instruction on the right has run. 2. Now run the same code but with these flags: ./x86.py -p loop.s -t 2 -i 100 -a dx=3,dx=3 -R dx This specifies two threads, and initializes each %dx register to 3. What values will %dx see? Run with the -c flag to see the answers. Does the presence of multiple threads affect anything about your calculations? Is there a race condition in this code? 3. Now run the following: ./x86.py -p loop.s -t 2 -i 3 -r -a dx=3,dx=3 -R dx This makes the interrupt interval quite small and random; use different seeds with -s to see different interleavings. Does the frequency of interruption change anything about this program? 4. Next well examine a different program (looping-race-nolock.s). This program accesses a shared variable located at memory address 2000; well call this variable value for simplicity. Run it with a single thread and make sure you understand what it does, like this: ./x86.py -p looping-race-nolock.s -t 1 -M 2000 What value is found in value (i.e., at memory address 2000) throughout the run? Use -c to check your answer. 5. Now run with multiple iterations and threads: ./x86.py -p looping-race-nolock.s -t 2 -a bx=3 -M 2000 Do you understand why the code in each thread loops three times? What will the final value of value be?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started