Skip to main content

Single-Threading VS. Multi-Threading

A printer that is printing a set of documents would perform best utilizing a single-­threaded process. In this instance, the printer is developing the documents in the order they were queued. There is no need to have additional threads added to the process because the printer is only going to allow the documents to print in order. This example may be different if the printer could print several jobs at once because the printer would need to assign specific jobs to certain print heads and may even need to add custom finishes to certain documents.


An application that allows the graphical user interface (GUI) to remain responsive while processing a large number of files would best be done utilizing a multi­threaded process. The reason this example needs to be conducted with a multi­threaded process is because the main thread is being used to process the large number of files. At the same time the files are being processed an additional thread is needed to ensure that the GUI remains responsive to other requests. Silberschatz et al. 2014 states that "If a process has multiple threads of control, it can perform more than one task at a time." Thus, making this a perfect example of multi­threading.


A Python webserver that listens for requests, reads them, and pushes the data in the database would best perform utilizing a multi­threaded process. Multi­threading is used best in this example because the webserver is having to perform multiple tasks simultaneously. If the webserver were operating on a single thread, the process would take much longer as the program can only perform one task at a time. For example, if the webserver were pushing the data into the database it would not be able to listen for a new request until that process was finished.


A shell program that closely monitors its own working space, such as open files, environment variables, and current working directory would perform best using a single-­threaded process. In this example the program is self­-contained meaning is does not need to rely on any additional outside resources so running it in single thread makes the most sense. If the program were calling for additional resources, there may be a need to switch to multi­threading as the program would not be able to pull resources and perform its function at the same time.


A program that calculates a large number of payments where each calculation is independent of other payment calculations would best perform using a single­-threaded process. This example is similar to the calculator example I have provided below where there is no need for additional threads because there is only one task being performed. Each payment is made by itself where there is no relationship between additional payments so there is no need for the program to associate them.


An example that uses a single thread would be the calculator on your computer. This program takes the numerical data that the user inputs and calculates what the result will be. In this example there is no need for additional threads as there is only one function being performed at a given time even though the user may be entering numerous equations.


An example that would require a multi­threaded solution would be if an individual wanted to edit videos or photographs utilizing video and photo editing software. These types of programs perform numerous tasks at once to aid in the editing process so the need for multi­threading is imperative. This is especially true for video editing because as changes are being made to the video, the program is constantly updated and changing the file properties at the same time.


An example that can either be single or multi­threaded would be the use of an internet browser utilizing only one tab. This example of course is specific to which type of URL the user is connected to and would only utilize a single thread if there were not numerous processes the page would have to load. On the other hand, the web browser could be multi­threaded if there were numerous pages that were running “where multiple tabs can be different threads.” (GeeksforGeeks, 2021)

References:

Silberschatz, A., Galvin, P.B., & Gagne, G. (2014). Operating System Concept Essentials (2nd
ed.). Retrieved from https://redshelf.com/

GeeksforGeeks. (2021, June 28). Thread in operating system. GeeksforGeeks. Retrieved January
10, 2022, from https://www.geeksforgeeks.org/thread­in­operating­system/


Comments

Popular posts from this blog

Peering Points and the Network Application Interface

According to Gibb (2019), “Peering is a method that allows two networks to connect and exchange traffic directly without having to pay a third party to carry traffic across the Internet.” Utilizing a peering point allows users to send a receive data directly to one another without the need to route through other computer networks. Doing so allows for a quicker, more efficient, and safer form of communication.  Researching the total number of active Internet Exchange Points (IXP) proved difficult as it was hard to pinpoint an accurate number. However, according to Rosas (2021), “as of January 2021, of the 630 registered IXPs, 229 are in Europe, 126 in North America, 140 in Asia-Pacific, 96 in Latin America and the Caribbean (LAC), and 39 in Africa.” These numbers are constantly changing as new IXPs are added, and some are removed.  Finding a definitive number of Internet Service Providers (ISP) globally was also difficult to accomplish. Most sources seem to point to the Nations Encyclop

VLAN Aggregation for Efficient IP Address Allocation

The project I chose to summarize on the Internet Engineering Task Force (IETF) website was RFC: 3069, VLAN Aggregation for Efficient IP Address Allocation. Within this project, the authors point out how inefficiently a Virtual Local Area Network (VLAN) allocates IP addresses along with their proposed solutions. I have also attached a diagram showing how the network would look pertaining to this project. Currently, an IP subnet would be made for each existing customer by understanding how many hosts they currently need and may need in the future. Based on that total number, the IP subnet and gateway address would change according to how many hosts the customer requested. For example, if a customer has indicated that they need ten hosts, and they only use five, the additional five that are not in use cannot be used by another customer. An illustration of this is shown below. The proposed solution to this problem is to allocate IP addresses under the same IP subnet and gateway address uti

Access Lists and Capabilities

To implement an access matrix, we must first understand what it is. An access matrix is a protection model within an operating system consisting of objects and domains. The access matrix determines which processes interact with objects within the domain. Objects within the domain can consist of both hardware and software. The lists below show the advantages and disadvantages of access lists associated with objects, and capabilities with domains.  Access lists associated with objects Advantages  Corresponds directly to the user’s needs.  Easy revocation and review of access.  Disadvantages  Difficult to determine access rights for a domain.  Takes time to search the domain for access rights.  Capabilities with domains Advantages  Useful for localizing information for a process.  Secured against unauthorized access.  Disadvantages  Inefficient at the revocation of capabilities.  Does not correspond directly to the user’s needs.  Even though each implementation has its own strengths and w