Question

The following are programming examples in which multithreading provides better performance than a single-threaded solution: a....

The following are programming examples in which multithreading provides better performance than a single-threaded solution:

a. A Web server that services each request in a separate thread.

b. A matrix multiplication program where different parts of the matrix may be worked on in parallel.

c. An interactive GUI program such as a debugger where a thread is used to monitor user input, another thread represents the running application, and a third thread monitors performance.

On the other hand, the following are programming examples in which multithreading does NOT provide better performance than a single-threaded solution.

  1. An individual tax return program that must does its calculation in a particular order.

b. Another example is a “shell” program such as the C-shell or Korn shell. Such a program must closely monitor its own working space such as open files, environment variables, and current working directory.

Provide one programming example in which multithreading provides better performance than a single-threaded solution. Also, provide one programming example in which multithreading does NOT provide better performance than a single-threaded solution. Your answers must be specific (e.g., a tax return program and a matrix multiplication program) and different from the ones that have already been mentioned above. Clearly explain to justify your answers.

Homework Answers

Answer #1

Multithreading is benificial in the situations to achieve parallelism , where even if one thread task gets halted, the other thread operations work smoothly.

Single threaded solution is generally desirable in sequential tasks where, output of one function is the input to the next one. In that case, creating multiple threads will generate more overhead.

One example where Multithreading is better :-

  • A music player that contains multiple tasks such as playing current song, displaying the play list, adding/deleting songs etc.
  • All these different tasks can be managed with the help of multiple threads so that all individual tasks can be carried out independently and in parallel.
  • In this case, single thread is not efficient to manage all the tasks.
  • Even if there is some problem in one thread function, the other threads work smoothly.

One example where Single -Threaded Solution is better :-

  • A program to find the average of given numbers.
  • In this case, a single thread solution is better as it is a sequential problem where we first need to find the sum of numbers then divide the sum by count of given numbers.
  • Employing multiple threads in this situation will be costly and time taking too.
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Provide a complete solution to the following problem using the C++ language in a SINGLE file...
Provide a complete solution to the following problem using the C++ language in a SINGLE file with a .cpp file extension. READ THE ENTIRE QUESTION (AND THE EXAMPLE) CAREFULLY BEFORE DEVELOPING YOUR SOLUTION! Design the code for a class called Pi, which will be used to encapsulate the value of pi stored as a string. (example ONLY) "3.141592654" | |_ _ _ _| whole number portion_| |_ _ _ _ _fractional portion (9 digits) The Pi class has the following...
I did already posted this question before, I did get the answer but i am not...
I did already posted this question before, I did get the answer but i am not satisfied with the answer i did the code as a solution not the description as my solution, so i am reposting this question again. Please send me the code as my solution not the description In this project, build a simple Unix shell. The shell is the heart of the command-line interface, and thus is central to the Unix/C programming environment. Mastering use of...
Which of the following is false?Group of answer choices Product liability laws can make it unprofitable...
Which of the following is false?Group of answer choices Product liability laws can make it unprofitable to sell shoddy merchandise, providing a substantial incentive to provide safe products independent of government regulations. Asymmetric information exists when the available information is initially distributed in favor of one party to a transaction relative to another. In adverse selection situations, it is rational for a seller with more information about a product to provide a truthful and complete disclosure and make that fact...
CSC 322 Systems Programming Fall 2019 Lab Assignment L1: Cipher-machine Due: Monday, September 23 1 Goal...
CSC 322 Systems Programming Fall 2019 Lab Assignment L1: Cipher-machine Due: Monday, September 23 1 Goal In the first lab, we will develop a system program (called cipher-machine) which can encrypt or decrypt a code using C language. It must be an errorless program, in which user repeatedly executes pre-defined commands and quits when he or she wants to exit. For C beginners, this project will be a good initiator to learn a new programming language. Students who already know...
python programming Question #4: # Years ago the Romans used a different system to represent numbers....
python programming Question #4: # Years ago the Romans used a different system to represent numbers. # Instead of using the digits (0, 1, 2, 3, 4, 5, 6, etc.), the Romans # formed numbers by joining combinations of the characters # (I, V, X, L, C, D, and M). # Roman Numeral characters and their integer values are: # I = 1, V = 5, X = 10, L = 50, C = 100, D = 500, and M...
Yeah, Science! Pinkman Inc. (“Pinkman”) is a wholly owned subsidiary of an SEC registrant. Pinkman has...
Yeah, Science! Pinkman Inc. (“Pinkman”) is a wholly owned subsidiary of an SEC registrant. Pinkman has a contract (the “Contract”) with the Heisenberg Institute (“Heisenberg”), which is a privately funded research institute with the stated mission of developing a cure for narcolepsy and other wide-spread sleep disorders. Under the Contract (which has a term of ten years), Pinkman serves as the administrator of the “Lab,” which is a multiple-unit campus consisting of recreational vehicles that Heisenberg uses to conduct research....
Which of the following distinguishes scenario analysis from sensitivity analysis? a. Scenario analysis only applies to...
Which of the following distinguishes scenario analysis from sensitivity analysis? a. Scenario analysis only applies to new product development projects. b. Sensitivity analysis only applies to new product development projects c. Sensitivity analysis involves changing one project variable at a time while scenario analysis involves changing more than one project variable at the same time d. Sensitivity analysis only applies when projects are mutually exclusive. 3. Which of the following statements is true regarding the internal rate of return (IRR)?...
QUESTION 1 Which one of the following would NOT be necessary for an offer to have...
QUESTION 1 Which one of the following would NOT be necessary for an offer to have legal standing? A. The language must reflect the intent to become a party to a contract. B. All of the conditions under which the offer would be terminated must be identified. C. All the significant terms and/or conditions must be contained in the offer. D. The offer must be effectively communicated to the other party. 3 points    QUESTION 2 Which one of the...
1) Which of the following is not a valid way that a CRM system can collect...
1) Which of the following is not a valid way that a CRM system can collect information? A. accounting system B. order fulfillment system C. inventory system D. customer’s personal computer 2)Which of the following is a common marketing CRM metric? A. number of new prospective customers B. average number of service calls per day C. average time to resolution D. cost per interaction by marketing campaign 3)Which question below represents a CRM reporting technology example? A. Why did sales...
1.Which of the following changes would most likely occur in the Gotham housing market if the...
1.Which of the following changes would most likely occur in the Gotham housing market if the city were to add a network of bike paths? a.The supply curve would fall. b.The supply curve would rise. c.The demand curve would fall. d.The demand curve would rise. 2.Which of the following changes would most likely occur in the Gotham housing market if the city were to require developers to pay a tax on each new building? a.The supply curve would fall. b.The...