Question

In: Computer Science

What is the main benefit of thread synchronization? Why do you think CUDA does not allow...

What is the main benefit of thread synchronization? Why do you think CUDA does not allow block synchronization?

Solutions

Expert Solution

Thread Synchronization is the process of excecuting more than one threads that share the same critical resources at the same time (i.e. concurrently) in such a way that no resource conflicts happen. This is generally achieved by restricting the execution of a thread until another thread or part of it is not executed completely. This simplest example in this scenario is:

Consider two threads that share the same critical resources ( such resources which can only be used by a single process at a time). If these threads are allowed to run asynchronously (i.e. without synchronization) then they can try to access the same critical resource at the same time (as actual thread execution in CPU depends on the time slices provided by the OS and is effectively unpredictable). So, this can cause several anomalies like unpredictable and inconsistant outputs resulting in serious bugs or even system crashes or a condition called Race Condition.

So, the main benefits of thread synchronization are:

  1. Prevention of Race Condition.
  2. Prevention of inconsitant or unexpected output

CUDA does not allow block synchronization because:

  1. Block synchronization is impractical if large and demanding processes are considered. Consider a process that requires a millions blocks to execute but the GPU running it only allows 1,000 blocks at a time. In this case, block synchronization can easily become obsolete. These cases are also very frequent when programs like Machine Learning are considered.
  2. The context saving required to achieve block synchronization is very huge and hence very slow.
  3. Alternatives to block syncronization are very fast and efficient like kernel switching/ launching a new kernel.

Related Solutions

Why do you think IFRS does not allow for intangible assets to be disclosed?
Why do you think IFRS does not allow for intangible assets to be disclosed?
do you think women should be allow to serve in combat? why and why not?
do you think women should be allow to serve in combat? why and why not?
Thread 1: Why do you think that women are still continued to be viewed as objects...
Thread 1: Why do you think that women are still continued to be viewed as objects in most, if not all, media? Has this situation changed much from the past to present day? How does this pertain to the male gaze today?   Thread 2: By all indications, including the 2016 election, women continue to be sidelined, stereotyped and sexualized in popular media and entertainment. Girls and boys from a young age seem to have been given a certain outlook on...
What were the main advantages of the gold standard? Why it was abandoned? Do you think...
What were the main advantages of the gold standard? Why it was abandoned? Do you think countries should start to use gold standard again?
What do you think of the keto diet? Does it seem healthy (why or why not...
What do you think of the keto diet? Does it seem healthy (why or why not based on what you've learned in this class so far). Have you explored other fad diets? Do any of these seem appealing to you (why or why not)? 150 words
In conducting benefit-cost analyses, do you think nonuse values should be considered? Why or why not?
In conducting benefit-cost analyses, do you think nonuse values should be considered? Why or why not?
q1 What do you think is the benefit of a financial statement audit to each of...
q1 What do you think is the benefit of a financial statement audit to each of the following groups. Write a maximum of two sentences to answer for each group of people (maximum of 8 sentences total). The firm being audited Investors in the firm being audited Society in general The audit firm q2 You have a publicly traded audit client with the following characteristics: $100,000,000 in net income before taxes 10,000,000 shares of stock outstanding Analyst expectations of $8.00...
why does the US operate under a dual banking system and what do you think are...
why does the US operate under a dual banking system and what do you think are the advantages and disadvantages
What do you think are sources of economic growth in Europe and North America? Why does...
What do you think are sources of economic growth in Europe and North America? Why does convergence occur among OECD countries rather than all around the world?
Do you think there are too many local elected officials? Why or why not? Does this...
Do you think there are too many local elected officials? Why or why not? Does this high number of local elected officials have an effect on voter turnout during local elections? If so, in what ways? If not, why not? How might Texas increase voter interest in, and information about, local elections?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT