Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Question :

Synchronization barriers are a common paradigm in many parallel applications. A barrier is supposed to block a calling thread until all N threads have reached the barrier.

(Parallel applications often divide up the work, e.g. matrix operations or graphical rendering, among N processes, each of which compute independently, reach an barrier, exchange results, then work on the next phase of computation) Many times the number of threads is not known in advance.

One pseudocode monitor solution is as follows:

Monitor Barrier ( ){

int numThreads ;

int numThreadsAtBarrier ;

newThreadCreated( ){ numThreads++; }

barrierReached( ){

numThreadsAtBarrier ++;

if(numThreadsAtBarrier == numThreads)

numThreadsAtBarrier = 0;

signalAll( );

else

wait( );

} initilaizationCode( ){

numThreads =0;

numThreadsAtBarrier = 0;

}

}

a. Provide comments in the psuedocode, describing the monitor code.

b. Briefly describe a difficulty in a semaphore solution to this barrier problem.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M93133109

Have any Question?


Related Questions in Computer Engineering

Discuss how the scope of computer security grew from

Discuss how the scope of computer security grew from physical security to include : Securing the data Limiting random and unauthorized access to that data. Involvement of personnel from multiple levels of the organizatio ...

Sorted array insertiona implement the fastest possible

Sorted Array Insertion a) Implement the fastest possible algorithm to insert a new entry into a sorted (in ascending order) array of strings. Duplicates are NOT allowed - throw an IllegalArgumentException if a duplicate ...

Question suppose you have a class whose objects are very

Question : Suppose you have a class whose objects are very, very large. Briefly, describe the advantages and drawbacks of call-by-value and call-by-reference for large objects. Describe a parameter passing mechanism that ...

Question when setting quotas for disk space what are the

Question : When setting quotas for disk space, what are the two tools for enabling and configuring quotas? And which of the two are the more flexible? When creating a new share, what is the configuration option that enab ...

Reduce nfa to dfaconsider the transition table for nfa

Reduce NFA to DFA Consider the transition table for NFA N: 1.Draw a transition graph for machine N. Consider using JFLAP unless you have another tool you know for the problem. (I guess by hand will do, but that is so nin ...

A small library keeps a roster of who will be at the desk

A small library keeps a roster of who will be at the desk each day. They have a database table as shown below. Week Start___Mon___Tue____Wed_____Thur____Fri 17/10/2011 -- Jane -- Sue -- George -- Sue -- Jane 24/10/2011 - ...

Question share your favorite open web resource and what

Question : Share your favorite open web resource and what cool tools does it have? What can you learn from it? How will it help as a career resource? What is your favorite learning express or JCA course, tool, or Page. W ...

Answer the following questions suppose that multiplying two

Answer the following Questions : Suppose that multiplying two general n by n matrices takes 3 seconds on a given computer, if n = 1000. Estimate how much time it will take to compute the LU-decomposition of such a matrix ...

Every day your friend commutes to school on the subway at 9

Every day your friend commutes to school on the subway at 9 AM. If the subway is on time, she will stop for a $3 coffee on the way to class. If the subway is delayed she skips the coffee and goes straight to class. The p ...

Write a matlab code to solve thisit seems that the math

Write a matlab code to solve this It seems that the Math department at a rival university has once again dropped the ball, and forgotten the value of n. You are to write a script which consumes a number that specifies th ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As