03 Handout 1
03 Handout 1
03 Handout 1
Multithreading
Multithreading pertains to the ability of an operating system (OS) to support
multiple, concurrent paths of execution within a single process. The use of
multicore systems to provision applications with multiple threads affects the
application design and performance. The potential performance benefits of a
multicore system may also be subjected to the ability of a multithreaded
application to effectively exploit the parallel resources available to the
application. Moreover, an object-oriented multithreaded process is an efficient
Figure 3. A pure kernel-level thread. means of implementing a server application (Stallings, 2018).
Source: Operating Systems: Internal and Design Principles (9th ed.), 2018 p. 184
Below are some of the general characteristics of multithreading (Gregg, 2021):
Combined User-Level and Kernel-Level Approach • The memory overhead in multithreading is small. It only requires an extra
Some operating systems provide a combined user-level thread and kernel- stack, register space, and space for thread-local data.
level thread facility. Thread creation is performed completely in the user space, • The central processing unit (CPU) overhead is small since it uses
so is the scheduling and synchronization of threads within an application. application programming interface (API) calls.
Multiple user-level threads from a single application are then mapped onto • The communication within the process and with other processes are
specific kernel-level threads. faster.
• The crash resilience in implementing multithreading is low. Any bug can
In this combined approach, multiple threads within the same application can crash the entire application
run in parallel on multiple processors, and a blocking system call does not
• The memory usage is monitored via a system allocator, which may incur
block the entire process. If properly designed, the combined approach should
some CPU contention from multiple threads, and fragmentation before the
also combine the advantages of the pure user-level threads and the kernel-
memory is reused.
03 Handout 1 *Property of STI
student.feedback@sti.edu Page 3 of 4
IT2106
The following are some examples of multithreaded applications:
• An application that creates thumbnails of photos from a collection of
images
• A web browser that displays images or texts while retrieving data from the
network
• A word processor that displays texts and responds to keystrokes or mouse
clicks while performing spelling and grammar check
In a Windows OS, threads within the same process can exchange information
through their common address space and access shared resources of the
process. Threads in different processes can exchange information through
some shared memory that has been set up between two (2) processes
References:
Gregg, B. (2021). System performance: Enterprise and cloud (2nd ed.). Pearson Education, Inc.
Silberschatz, A., Galvin, P. & Gagne, G. (2018). Operating systems concepts (10th ed.). John Wiley & Sons, Inc.
Stallings, W. (2018). Operating systems: Internal and design principles (9th ed.). Pearson Education Limited