Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assuming that P(occupied) and V(occupied) each takes 1 ms and critical section consists of 4 instructions cr1, cr2, cr3, and cr4 of equal instruction time

image text in transcribed

Assuming that P(occupied) and V(occupied) each takes 1 ms and critical section consists of 4 instructions cr1, cr2, cr3, and cr4 of equal instruction time adding up to 1 ms and noncritical section consists of 4 instructions nc1, nc2, nc3, and nc4 of equal instruction time adding up to 2 ms.

a) Suppose OS schedules by round robin of thread 0 for 2ms, thread 1 for 2ms, thread 0 for 2ms, and thread 1 for 2ms.

Compute the real amount of time when OS moves between thread 0 and thread 1 each twice as above. Note the amount of time could be more than 8 ms since at the end of 2 ms, thread 0 may be in the middle of an atomic instruction.

b) Show which instruction is being executed in thread 0 when thread 0 and thread 1 each has been executed twice with 2ms as the time of scheduling.

c) Tabulate and show how much time is spent in each instruction of thread 0 in the first run and in the second run.

l System. 2 3 I create semaphore and iniialize value Lo 4 Semaphore occupiednew SemaphoreCi) 6 startThreadsOinitialize and launch both threads 8 Thread 5 7 9 10 void main 1.2 13 14 15 16 1.7 18 19 20 21 whileC done PC occupied / wait critica1 section code VC occupied // signal /code outside critical section 1/ end while 22 /Thread TX l System. 2 3 I create semaphore and iniialize value Lo 4 Semaphore occupiednew SemaphoreCi) 6 startThreadsOinitialize and launch both threads 8 Thread 5 7 9 10 void main 1.2 13 14 15 16 1.7 18 19 20 21 whileC done PC occupied / wait critica1 section code VC occupied // signal /code outside critical section 1/ end while 22 /Thread TX

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

Data And Information Quality Dimensions, Principles And Techniques

Authors: Carlo Batini, Monica Scannapieco

1st Edition

3319241060, 9783319241067

More Books

Students also viewed these Databases questions

Question

3. What may be the goal of the team?

Answered: 1 week ago

Question

Evaluate the limit 1-1-x lim X-70 X 217

Answered: 1 week ago

Question

How do Dimensional Database Models differ from Relational Models?

Answered: 1 week ago

Question

What type of processing do Relational Databases support?

Answered: 1 week ago

Question

Describe several aggregation operators.

Answered: 1 week ago