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:
![a) On a single-CPU system, under what circumstances does a multithreaded program using kernel threads provide](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2023/09/6515532bb6763_1695896355101.jpg)
![void mutex_unlock (mutex* plock) { *plock = false; } Is this implementation of mutex synchronization correct](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2023/09/651553415f56e_1695896378081.jpg)
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...
-
Consider the figure given below. The darker line shows how many units of goods A and B a worker in Taiwan can produce and the lighter line shows the number of units of goods A and B that a worker in...
-
Should Halligan and Shah be so focused on HubSpot's churn rate? Why or why not? How is churn related to the magic number and what does each metric indicate about the current and future health of...
-
An IQ test. TheWechsler Adult Intelligence Scale (WAIS) is a common IQ test for adults. The distribution of WAIS scores for persons over 16 years of age is approximately Normal with mean 100 and...
-
Sleepy Hollows General Fund budget for fiscal 2013 is based on the following estimated revenues and appropriations. Is Sleepy Hollow projecting a budgetary surplus or a deficit for 2013? Prepare the...
-
Word Problem 1 0 - 2 3 ( Algo ) [ LU 1 0 - 3 ( 1 ) ] Max Wholesaler borrowed $ 4 , 5 0 0 on a 1 1 % , 1 2 0 - day note. After 4 5 days, Max paid $ 1 , 5 7 5 on the note. Thirty days later, Max paid...
-
A botanist conducts study about the average number of blooms on a well-tended marigold plant. 73 seedlings are cultivated to maturity and the number of blooms recorded. The results are given in the...
-
Please show all the steps thank you :) Transcribed image text: 33. Using the given data, calculate the required rate of return for the stock: The current risk free rate is 2.0% and the current market...
-
In 2024, the Westgate Construction Company entered into a contract to construct a road for Santa Clara County for $10,000,000. The road was completed in 2026. Information related to the contract is...
-
Briefly describe the case you have chosen. Categorize the social worker's experience as vicarious trauma, compassion fatigue, or burnout. Provide justification. Identify the social worker's score on...
-
Given f(x) below, find f'(x). f(x) = = m 5z In (2) et dt
-
Olsen & Alain, CPAs (O&A) performed the audit of Rocky Point Brewery (RPB), a public company in 20X1 and 20X2. In 20X2, O&A also performed tax services for the company. Which statement best describes...
-
Exercise 9-4 (Algo) Prepare a Flexible Budget Performance Report [LO9-4] Vulcan Flyovers offers scenic overflights of Mount Saint Helens, the volcano in Washington State that explosively erupted in...
-
Tambin Inc. produces a gasoline additive that, when added to the gas tank of the average automobile, is designed to increase gas mileage by 20%. The companys controller suspects that the year-end...
-
Compile data on consumption and expenditures for the following categories in 30 different countries: (1) food and beverages, (2) clothing and footwear, (3) housing and home operations, (4) household...
-
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?
-
What is the primary criterion by which ac- counting information can be judged? (a) Consistency. (b) Predictive value. (c) Usefulness for decision making. (d) Comparability. AppendixLO1
-
Generally accepted accounting principles are: (a) a set of standards and rules that are recog- nized as a general guide for financial reporting. (b) usually established by the Internal Revenue...
-
What is liquidity? How can it be measured using a classified balance sheet? AppendixLO1
![Mobile App Logo](https://dsd5zvtm8ll6.cloudfront.net/includes/images/mobile/finalLogo.png)
Study smarter with the SolutionInn App