Urgenthomework logo
UrgentHomeWork
Live chat

Loading..

CPT304 Week 2 Assignment Single vs Multi-Threading

Threads are small sets of instructions that can be scheduled and executed by CPU and run independently of a parent process. These threads can be either single or multi-threaded. A single thread will process one command at a time, and a multithread process allows multiple parts of the program to be executed at the same time.

Today we will be discussing several scenarios that will work better with either a single or multithread solution

An application that allows the graphical user interface (GUI) to remain responsive while processing a large number of files will work better with a multi-threading solution. Multi-threading will work in this situation. There can be one thread that listens to the request and a second thread that process the request allowing that first thread to continue to monitor for a new request.

A Python web server that listens for requests reads them and pushes the data in the database. In this scenario, multi-threading would work best because the server could listen for request and the process that request to the next thread while continuously listening for a new request.

A shell program that closely monitors its own working space, such as open files, environment variables, and current working directory. Single threading will work in this situation because, in this shell environment, it needs to monitor things carefully, and a single thread allows that to happen.

An example is a program that calculates a large number of payments where each calculation is independent of other payment calculations. This example should use single threading because it is a program that is taking payments, and these payments should stay in a particular order single threading would only allow the fees one at a time.

A printer that is performing the job of printing a set of documents

Scenario One: the Most effective solution is a single-threaded process. Programs that are sequential and that waits on the users’ input is a single-threaded process. An example of that is the credit card authorization. Credit Card authorizations, in the beginning, were initially based on the single-threaded model. Another example would be some of the tax websites. These sites require you to put your information in with a particular order without your taxes being completed. (Hamid, Nasir, Ming, & Hassan, 2008)

Scenario Two is the most effective solution is a multi-threaded process. A parallelized application, for example, a grid multiplication where different parts of the grid will be completed in parallel. Internet browsers that help multi-threading can have numerous windows when you are using Word and in which, spell-check, and a reaction from the keyboard, arranging, and so forth occurs simultaneously or concurrently. (Christensson, 2008)

Scenario three is the most effective solution is either a single-threaded or multi-threaded process. Multi-threading is a convenient solution for actualizing increasingly successful network communication. It is a great tool to be used when implementing network diagnostic and information security programs. In particular, the program is never again restricted to handling socket operations one at a time; they can now be handled concurrently in separate threads. (Foster, 2005).

Multi-threading gives the options of scalability and improves the performance of an application, whereas a single-threaded application will only perform all operations one after the other. When deciding if either option should be used, this would depend on the needs and the use of a particular app. This would determine the need for a single or multi-threaded process. Each application doesn’t perform the same task, and therefore a precise analysis should be done to state what the requirements are for the application. (Silberschatz, 2014). Essential comprehension of threads helps prepare us to handle implementing it in networking.

Works Cited

Christensson, P. (2008, September 26). Multi-threading. Retrieved from Techterms: https://techterms.com/definition/multithreading

Foster, J. C. (2005). Sockets, Shellcode, Porting, & Codin. In J. C. Foster, Sockets, Shellcode, Porting, & Coding (pp. 99-144). Syngress.

Grossman, D. (2015). Fork-join parallelism with a data-structures focus. Science direct.

Hamid, S. H., Nasir, M. H., Ming, W. Y., & Hassan, H. (2008). Improving Response Time of Authorization Process of Credit Card System Using Multi-Threading and Shared-Memory Pool Techniques. Journal of Computer Science, 151-160.

Silberschatz, A. G. (2014). Operating system concepts essentials. (2nd ed.). Retrieved from https://redshelf.com/.

Resources

  • 24 x 7 Availability.
  • Trained and Certified Experts.
  • Deadline Guaranteed.
  • Plagiarism Free.
  • Privacy Guaranteed.
  • Free download.
  • Online help for all project.
  • Homework Help Services

Testimonials

Urgenthomework helped me with finance homework problems and taught math portion of my course as well. Initially, I used a tutor that taught me math course I felt that as if I was not getting the help I needed. With the help of Urgenthomework, I got precisely where I was weak: Sheryl. Read More

Copyright © 2009-2023 UrgentHomework.com, All right reserved.