a) On a single-CPU system, under what circumstances does a multithreaded program using kernel threads provide...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
a) On a single-CPU system, under what circumstances does a multithreaded program using kernel threads provide better performance (such as faster execution time) compared to a single- threaded solution (that does not use asynchronous or event-based programming)? Explain with general principles. Give TWO example applications. b) A new operating system provides a synchronization API and a library for user-level programs (i.e. like the pthread) for which the mutex lock and unlock operation are implemented with test_and_set like this: void mutex_lock (mutex* plock) { } while (test_and_set (plock)) { }; void mutex_unlock (mutex* plock) { *plock = false; } Is this implementation of mutex synchronization correct for use in general purpose user-level applications? What could go wrong? It helps to think of an example application, like the bounded-buffer problem or the dining philosophers. c) On a running Linux kernel (version > 2.6) at some point the thread_info.preempt_count field for a kernel task we call A is equal to 2. (Linux kernel synchronization is discussed in the textbook). Answer these questions: c1) Is task A currently preemptable? Explain. c2) What is new value of thread_info.preempt_count field for task A after it acquires a new lock? Explain. c3) What is the condition for kernel task A to be safely interruptible ? c4) Assuming that all locks held by task A are spinlocks, how many CPUs are on that computer ? a) On a single-CPU system, under what circumstances does a multithreaded program using kernel threads provide better performance (such as faster execution time) compared to a single- threaded solution (that does not use asynchronous or event-based programming)? Explain with general principles. Give TWO example applications. b) A new operating system provides a synchronization API and a library for user-level programs (i.e. like the pthread) for which the mutex lock and unlock operation are implemented with test_and_set like this: void mutex_lock (mutex* plock) { } while (test_and_set (plock)) { }; void mutex_unlock (mutex* plock) { *plock = false; } Is this implementation of mutex synchronization correct for use in general purpose user-level applications? What could go wrong? It helps to think of an example application, like the bounded-buffer problem or the dining philosophers. c) On a running Linux kernel (version > 2.6) at some point the thread_info.preempt_count field for a kernel task we call A is equal to 2. (Linux kernel synchronization is discussed in the textbook). Answer these questions: c1) Is task A currently preemptable? Explain. c2) What is new value of thread_info.preempt_count field for task A after it acquires a new lock? Explain. c3) What is the condition for kernel task A to be safely interruptible ? c4) Assuming that all locks held by task A are spinlocks, how many CPUs are on that computer ?
Expert Answer:
Answer rating: 100% (QA)
a A multithreaded program using kernel threads can provide better performance compared to a singlethreaded solution on a singleCPU system under the following circumstances The program performs a lot o... View the full answer
Related Book For
Value at Risk The New Benchmark for Managing Financial Risk
ISBN: 978-0071464956
3rd edition
Authors: Philippe Jorion
Posted Date:
Students also viewed these programming questions
-
B 3 m 4 m 20 a) The circular bar has a 4-m radius and lies in the x-y plane. Express the position vector from point B to the collar at A in terms of components. b) The cable AB exerts a 60 N force T...
-
Under what circumstances does a multithreaded solution using multiple kernel threads provide better performance than a single-threaded solution on a single-processor system?
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
In Mark A. Cohen, The Costs and Benefits of Oil Spill Prevention and Enforcement, Journal of Environmental Economics and Management Vol. 13 (June 1986), an attempt was made to quantify the marginal...
-
If $1000 is invested at 6% interest, compounded annually, then after years the investment is worth an = 1000(1.06)n dollars. (a) Find the first five terms of the sequence {an}. (b) Is the sequence...
-
Should The Canadian Rocky Mountain invest to expand its business in Saskatchewan?
-
Four emergency radios are available for rescue workers but one does not work properly. Two randomly selected radios are taken on a rescue mission. Let \(X\) be the number that work properly between...
-
1. What are some visible aspects of Recycline's culture that reflect the company's values and commitment to green issues? 2. What role do leaders play in shaping Recycline's organizational culture?...
-
Soarch Fila Home Insert Draw Design Transitions Animations Slide Show Record Review View Help Layout R New AAA E-E-3 JUS+AV Ax LA OOO\\ ALLOCG Record Share Shape F- Ind Stace Ouding Aange Cuck...
-
At the end of the fiscal year, the Precision Computer Centre has a $21,620 balance in Accounts Receivable. Here is a current schedule of accounts receivable: Assignment Although Accu Pacs account is...
-
A fluid is one which can be defined as a substance that: (A) has that same shear stress at all points (B) can deform indefinitely under the action of the smallest shear force (C) has the small shear...
-
What factors should you consider when selecting a medium to communicate bad news?
-
You are giving a presentation proposing that your company gamify software training for all new employees in finance. Your audience consists of executives in both finance and informational technology....
-
Explain what you should look for when evaluating a bad-news message.
-
Identify a situation that required you to share bad news in the past. Were you successful in accomplishing potentially incompatible goals such as being clear and maintaining goodwill? If so, how did...
-
What techniques can you use to soften the bad news in an indirect message?
-
Q3-MCQ 1-c 2-d 3-d 4-b 5-a 6- d 7-b 1. Conduction plus fluid flow in motion is known as a) Radiation b) Conduction 2. Convectional current only occurs in a) solids b) liquids c) gases d) liquids and...
-
Which of the following raises the credibility of areport? Which of the following raises the credibility of a report? Multiple Choice avoiding predictions avoiding the use of cause-effect statements...
-
What are the various components of interrupt and dispatch latency?
-
Consider a file system where a file can be deleted and its disk space reclaimed while links to that file still exist. What problems may occur if a new file is created in the same storage area or with...
-
In the fixed-income market, which measure reflects exposure to movements in underlying risk variable? How about the stock market and the derivatives market?
-
Consider each table below. Is the data presented consistent with the Phillips curve model of wage determination? Each table has a point \(A\) and a point B. Startyour answer with true/false/...
-
In a 2012 book, The New Geography of Jobs (a book described by Barack Obama as 'a timely and smart discussion of how different cities and regions have made a changing economy work for them', and by...
-
Nature, a leading science magazine, argues (https://www.nature.com/articles/d41586-020-01518-y) that COVID19 will force universities to confront long-standing challenges in higher education, such as...
Study smarter with the SolutionInn App