Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Conditional Variable Given a mutex lock mm, and a conditional variable cc, the following events happen in the order of occurrence stated below: T2 executes

Conditional Variable

Given a mutex lock mm, and a conditional variable cc, the following events happen in the order of occurrence stated below:

  1. T2 executes mutex-lock(m).
  2. T1 executes mutex-lock(m).
  3. T2 executes cond-wait(c, m).
  4. T1 executes cond-signal(c).
  5. T1T1 executes mutex-unlock(m)

Fill in the boxes below. If there is no thread waiting for a lock or a signal, leave the boxes blank.

image text in transcribed

Before Step 4

Write down the state of the two waiting queues after steps 1, 2, and 3 are completed.

For the mutex variable mm, write your answers as a comma-separated list with the first entry being the thread that currently has the lock. For example, if T1 has the lock and T2 is waiting for the lock, you should answer "T1, T2". If a queue is empty, write down "NA"

For the conditional variable cc, write a comma-separated list of threads waiting in order that they arrived. For instance, if T1 and T2 are waiting for mutex lock mm, you should answer "T1 m, T2 m."

Mutex variable m=? Conditional variable c=?

Before Step 5

Write down the state of the two waiting queues before step 5. Steps 1, 2, 3, and 4 have completed.

For the mutex variable mm, write your answers as a comma-separated list with the first entry being the thread that currently has the lock. For example, if T1 has the lock and T2 is waiting for the lock, you should answer "T1, T2." If a queue is empty, write down "NA"

For the conditional variable cc, write a comma-separated list of threads waiting in order that they arrived. For instance, if T1 and T2 are waiting for mutex lock mm, you should answer "T1 m, T2 m."

Mutex variable m=? Conditional variable c=?

After All Steps

Write down the state of the two waiting queues after all the steps are completed.

For the mutex variable mm, write your answers as a comma-separated list with the first entry being the thread that currently has the lock. For example, if T1 has the lock and T2 is waiting for the lock, you should answer "T1, T2" If a queue is empty, write down "NA"

For the conditional variable c, write a comma-separated list of threads waiting in order that they arrived.

Mutex variable m=? Conditional variable c=?

Mutex Variable M Thread ID Lock Thread ID Lock Thread ID Lock Conditional Variable Mutex Variable M Thread ID Lock Thread ID Lock Thread ID Lock Conditional Variable

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

More Books

Students also viewed these Accounting questions

Question

the factors that affect the width of a confidence interval.

Answered: 1 week ago