Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

a) On a single-CPU system, under what circumstances does a multithreaded program using kernel threads provide void mutex_unlock (mutex* plock) { *plock = false; } Is this implementation of mutex synchronization correct

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 ?

Step by Step Solution

3.47 Rating (157 Votes )

There are 3 Steps involved in it

Step: 1

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... 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

Value at Risk The New Benchmark for Managing Financial Risk

Authors: Philippe Jorion

3rd edition

0070700427, 71464956, 978-0071464956

More Books

Students also viewed these Programming questions

Question

What are the various components of interrupt and dispatch latency?

Answered: 1 week ago