What are Multithreading Models? Elaborate on at least three different types and the service each provides.
What are the 5 areas that present challenges in programming for multicore systems. What challenges do they present?
Multithreading is a process whereby many threads are executed at a go. The central processing unit consists of a component that allows more than one instruction to be executed simultaneously. However, the central processing unit supports multiple threads of up to ninety-six threads (Jose et al.,2018). There are three types of multithreading, the many to many models, many to one model, and one to one model.
The many to many models are considered the best multithreading model, where the number of kernel threads depends on the type of the machine. The many to many models entail many user threads mapped to an equal number of or fewer kernel threads. The many to many thread model allow as many user threads as possible. Also, the kernel threads can run either as a multiprocessor or in parallel (Nasri et al.,2021). The many to many are considered the most efficient since it does not have any disadvantage.
The many to one model allows mapping many user threads on one kernel thread, hence thread management becomes easier. The many to one model cannot run in parallel because only a single thread can access the single kernel at a time. Another model type is the one to one model that maps one user thread to each kernel thread. Like many to many, the model can run both parallel and multiprocessor (Jose et al.,2018). The main (Nasri et al.,2021) disadvantage is that the user thread must match or correspond to a kernel thread. Also, restrictions are placed on the number of kernel threads to be used to avoid burdening the system.
The five areas that represent challenges in programming for multicore systems include data splitting, data dependency, balance, debugging and testing, and dividing activities.
Dividing activities: The challenge posed is difficulty in identifying areas that can be divided into separate and identifying subtasks that can be implemented parallelly.
Data splitting: There should be balance when dividing tasks into subtasks (Kusiak, 2019). Also, the data manipulated by the task should be well divided and balanced for easy accessibility.
Balance: When dividing the tasks into sinks, the process should uphold equality, where these subtasks should be equal and able to perform the same amount of tasks. In case the sub-task sare, not balance, performance issues may arise because the multicore system may not be able to promote performance compared to the single-core system.
Data dependency: Subtasks depend on other sub-tasks for data; hence the process manager should synchronize data (Kusiak, 2019). If data is not properly examined and synchronized, dependency if data may not run smoothly, hence performance issues.
Testing and debugging: Testing and debugging tasks, especially concurrent ones, becomes more challenging than testing and debugging single-threaded applications, especially when subtasks are run parallelly.
The main challenge is experienced when scheduling algorithms that promote parallel computation and modification of multi-threaded programs to work well in a multicore system (Kusiak, 2019). Another challenge is that the user threads share a single memory, hence easy to cause performance issues and slow data access. Multithreading requires more memory to enhance smooth communication between processes. Another challenge is that the algorithms are sequential, where the performance of the next step depends on the previous step’s results. Despite the challenges, multithreading is critical, especially in doing many things in a single process. For instance, encoding different parts of a video in
Jose, B. A., Xue, B., Shukla, S. K., & Talpin, J. P. (2018). Programming Models for Multi-Core Embedded Software. In Multi-Core embedded systems (pp. 299-338). CRC Press.
Kusiak, A. (2019). Fundamentals of smart manufacturing: A multi-thread perspective. Annual Reviews in Control, 47, 214-220.
Nasri, M., Hafidi, I., & Metrane, A. (2021). Multithreading parallel robust approach for the VRPTW with uncertain service and travel times. Symmetry, 13(1), 36.