Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. -30 points Answer these questions: a) On a single-CPU system, under what circ

ID: 3908370 • Letter: 1

Question

1. -30 points Answer these questions: 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)) f

Explanation / Answer

Please Note: As per Chegg Answering Guidelines, I have answered the first question. Please Post Separate for other Questions.

On a single CPU system, under what circumstances does a multithreaded program using kernel threads provide better performance compared to a single threaded solution?

Answer)

A single CPU system means a system with a single processor, and a multithreaded program means a program with multiple threads which may try to execute simultaneously. A multithreaded program using kernel threads gives better performance when there are page fault in the system and the kernel thread suffers from page faults. Thus to optimize the CPU time, another kernel thread can be swapped to the CPU to execution and thus making useful execution of the threads. Now, when a single threaded process works, the process will be stuck there in the CPU as there is only one thread to execute and the CPU time waiting for the page fault cannot be utilized well. Thus, when the multithreaded program suffers from page faults, a multithreaded program using kernel threads provide better performance compared to a single threaded solution.