Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Insymbol Section ( 1 entry ) result 1 0 Outsymbol Section ( 2 entries ) get 4 2 5 get 4 2 3 Object Code

Insymbol Section (1 entry)
result 10
Outsymbol Section (2 entries)
get425
get423
Object Code (11 words)
export answer
jmp mainx 20
answer:
word 10
lock:
word 0
main 20 :
Idimm r5,100
Idimm r4,0 # loop counter
Idimm r6,1 #loop counter increment
Idimm r7,5 # upper bound
doitagain:
# busy wait on the lock
Idimm r1,1 # want to set the lock to 1
tryAgain:
Idimm r2,0 # need to wait until lock is 0
cmpxchg r2,r1, lock # if lock is 0 then lock it
beq r2,r1, tryAgain # else r2 will be set to 1, and if so repeat
load ro, answer # now have exclusive control
addi r0,r5 # so safe to add in the local answer
store r0, answer
Idimm r2,0 # unlock
store r2, lock
addi r4,r6
blt r4,r7, doitagain
# all done!
halt
image text in transcribed

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

Linked Data A Geographic Perspective

Authors: Glen Hart, Catherine Dolbear

1st Edition

1000218910, 9781000218916

More Books

Students also viewed these Databases questions