Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

DO NOT COPY FROM ANY OTHER CHGG QUESTION, IT'S WRONG II. Consider the following two threads in the same process executing on the same core.

DO NOT COPY FROM ANY OTHER CHGG QUESTION, IT'S WRONG

image text in transcribedimage text in transcribed

II. Consider the following two threads in the same process executing on the same core. The value at memory 2000 is initialized to 0 . We also assume that Thread 1 is scheduled to execute first. Thread_2 .main mov $5,%ax .top mov 2000,%dx add $2,%dx mov %dx,2000 sub $1,%ax test $4,%dx jgt .out test $0,%ax jgt .top .out halt Note: the above-used assembly instructions are the same as the x86 assembly introduced in tutorial 3. (a) (5 marks) What is the final value at the memory 2000 if the interrupt is disabled? (b) (5 marks) If the interrupt is enabled (we assume that a thread switches to the other thread when an interrupt occurs), will the two threads see the same final values of %ax after both threads finish their work? If yes, what is the value of % ax seen by the two threads? If not, what are the values of % ax seen by each thread respectively? (c) (5 marks) If an interrupt could occur at any time (i.e., after the execution of any instruction), will the final value in memory 2000 be always the same as the case where the interrupt is disabled? If yes, please explain the reason; if not, which code segment in Thread_1 and Thread_2 needs to be protected (here "protected" means the interrupt is disabled during the execution of that code segment)

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_2

Step: 3

blur-text-image_3

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

Data Management Databases And Organizations

Authors: Richard T. Watson

6th Edition

1943153035, 978-1943153039

More Books

Students also viewed these Databases questions

Question

2. What do you believe is at the root of the problem?

Answered: 1 week ago