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

A system with two dual-core processors has four processors available for schedul

ID: 670303 • Letter: A

Question

A system with two dual-core processors has four processors available for scheduling. A CPU-intensive application is running on this system. All input is performed at program start-up, when a single file must be opened. Similarly, all output is performed just before the program terminates, when the program results must be written to a single file. Between startup and termination, the program is entirely CPU-bound. Your task is to improve the performance of this application by multithreading it. The application runs on a system that uses the one-to-one threading model (each user thread maps to a kernel thread).

a) How many threads will you create to perform the input and output? Explain.

b) How many threads will you create for the CPU-intensive portion of the application? Explain.

Explanation / Answer

a> Reading input from a single file and Writing output to a single file cannot be sped up using multiple cores. Speed of file system input-output is decided by the properties and nature of where and how the file is stored[like type of hard disk,optical disk].So using multiple threads for file i/o is not going to help, because those threads are just going to be waiting for the I/O to complete.Hence we need only one thread for reading input from the file and exactly one thread for writting output to the file also.

b>There should be exactly 4 threads for the CPU-intensive portion of the application. Because there should be as many threads as there are processing cores[as in this case we have 2 dual core processors].Fewer threads would be a waste of processing resources and any number greater than 4 would be unable to run hence efficiency will go down.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote