Assignment #2 - mam8684/Miguel-Mielgo-Assignment-1-INTRO-TO-CIS---CS1101200 GitHub Wiki

MULTI-THREADING !!!!


ABSTRACT

For the realization of this assignment, the matter to discuss is multi-threading. The first thing to work with will be introducing a formal definition about the topic in concrete. Furthermore, we will get in further detail about multi-threading in order to be able to establish the advantages and disadvantages of this process. Moreover, for the last part of the assignment a discussion about why multi-threading is useful in our daily lives as human-beings will be established.


1. Introduction

Since ancient times, one of the most nurture things about human-beings has always been the ability to perform more than one task at the same time. However, one of the most common mistakes people do is saying that multi-threading is more or less, the same thing as multi-tasking. According to the Oxford Dictionary (1), multi-threading is a technique by which a single set of code can be used by several processors at different stages of execution. In other words, multi-threading is a process that our computer processors do where, by just using a single set of code, these processors will work according to that code to accomplish different stages of execution. In addition to this, it should be highlighted that threading itself is not related to it. Therefore, in order to have the proper knowledge about all the technicalities, according to the Oxford Dictionary (2), threading is a facility for organizing a series of posts relating to the same subject as a linked sequence on an online forum. However, What is actually multi-threading? What does this process actually consist of and what are its steps? What are its advantages and disadvantages?


2. Methodology

To start with a good foot into this, it should be highlighted that multi-threading has 6 different types which are:

  • Cycle i: instruction j from thread A is issued.
  • Cycle i + 1: instruction j + 1 from thread A is issued.
  • Cycle i + 2: instruction j + 2 from thread A is issued, which is a load instruction that misses in all caches.
  • Cycle i + 3: thread scheduler invoked, switches to thread B.
  • Cycle i + 4: instruction k from thread B is issued.
  • Cycle i + 5: instruction k + 1 from thread B is issued.

Then, according to an article written by Triangles that comment about what this process consists of, "Each program is known as a process that is being executed. The operating system knows many software tricks to make a process run along with others, as well as taking advantage of the underlying hardware. Either way, the final outcome is that you sense all your programs to be running simultaneously. Running processes in an operating system are not the only way to perform several operations at the same time. Each process is able to run simultaneous sub-tasks within itself, called threads. You can think of a thread as a slice of the process itself. Every process triggers at least one thread on startup, which is called the main thread. Then, according to the program/programmer's needs, additional threads may be started or terminated. Multithreading is about running multiple threads within a single process." (3). In order to have this explanation more visual, we will include a graphic where the steps of multi-threading in a computer is shown:

Now that we know what actually is multi-threading and its steps, we should progress with our next stride:

2.1 Advantages of Multi-threading

2.2 Disadvantages of Multi-Threading

  1. User levels threads are not perfect solutions as with everything else.

  2. They are not well-integrated with the OS (Operating System).

  3. There is a lack of coordination between threads and operating system kernel.


3 . Results

Overall, after all this explanation now we can say what multi-threading and threading by itself is, the different types of multi-threading that exists, and the advantages and disadvantages of this process. After all, it should be clarified that multi-threading is really a useful tool nowadays four our daily lives as a lot of stuff that we do from our electronic device that we want them to be done at the same moment as others can work thanks to this.


4. Conclusions

To sum up with, multi-threading is useful as it lets systems execute multiple tasks at once and thus, things for human-beings will be less time-consuming and without taking apart the fact that it has a brilliant future above due to the fact that, multi-threading could be considered as a lately technological breakthrough in the computing world.


5. References

(1): Oxford . “Multithreading: Definition of Multithreading by Oxford Dictionary on Lexico.com Also Meaning of Multithreading.” Lexico Dictionaries | English, Lexico Dictionaries, www.lexico.com/en/definition/multithreading.

(2): Oxford. “Threading: Definition of Threading by Oxford Dictionary on Lexico.com Also Meaning of Threading.” Lexico Dictionaries | English, Lexico Dictionaries, www.lexico.com/en/definition/threading.

(3): Triangles. “A Gentle Introduction to Multithreading.” Internal Pointers, 6 Mar. 2019, www.internalpointers.com/post/gentle-introduction-multithreading.