You are on page 1of 3

8/14/2019 Operating System | Benefits of Multithreading - GeeksforGeeks

Custom Search

COURSES Login

HIRE WITH US


Operating System | Bene ts of Multithreading
Prerequisite – Operating-System-Thread
The bene ts of multi threaded programming can be broken down into four major categories:

1. Responsiveness –
Multithreading in an interactive application may allow a program to continue running even if a part of it is blocked or is performing a
lengthy operation, thereby increasing responsiveness to the user.
In a non multi threaded environment, a server listens to the port for some request and when the request comes, it processes the
request and then resume listening to another request. The time taken while processing of request makes other users wait
unnecessarily. Instead a better approach would be to pass the request to a worker thread and continue listening to port.

For example, a multi threaded web browser allow user interaction in one thread while an video is being loaded in another thread. So
instead of waiting for the whole web-page to load the user can continue viewing some portion of the web-page.

2. Resource Sharing –
Processes may share resources only through techniques such as-
Message Passing
Shared Memory
Such techniques must be explicitly organized by programmer. However, threads share the memory and the resources of the
process to which they belong by default.
The bene t of sharing code and data is that it allows an application to have several threads of activity within same address space.

3. Economy –
Allocating memory and resources for process creation is a costly job in terms of time and space.
Since, threads share memory with the process it belongs, it is more economical to create and context switch threads. Generally
much more time is consumed in creating and managing processes than in threads.
In Solaris, for example, creating process is 30 times slower than creating threads and context switching is 5 times slower.
4. Scalability –
The bene ts of multi-programming greatly increase in case of multiprocessor architecture, where threads may be running parallel
on multiple processors. If there is only one thread then it is not possible to divide the processes into smaller tasks that different
processors can perform.
Single threaded process can run only on one processor regardless of how many processors are available.
Multi-threading on a multiple CPU machine increases parallelism.

References- Operating System concepts by Abraham Silberschatz, Peter B. Galvin& Greg Gagne

https://www.geeksforgeeks.org/operating-system-benefits-multithreading/ 1/3
8/14/2019 Operating System | Benefits of Multithreading - GeeksforGeeks

Recommended Posts:
Operating System | Multithreading
Operating System | Difference between multitasking, multithreading and multiprocessing
Operating System | Buddy System - Memory allocation technique
Operating System | Requirements of memory management system
Operating System | Semaphores in operating system
Operating System | Introduction of Operating System - Set 1
Operating System | Starvation and Aging in Operating Systems
Operating System | Introduction of System Call
Operating System | Kernel I/O Subsystem (I/O System)
Operating System | Unix File System
Operating System | Types of Operating Systems
Operating System | Thread
Functions of Operating System
Operating System | Microkernel
Operating System | Paging

aastha98
Sophomore at Netaji Subhas Institute of Technology

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your
article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you nd anything incorrect by clicking on the "Improve Article" button below.

Article Tags : GATE CS Operating Systems

Practice Tags : Operating Systems


3

To-do Done 2.6

Based on 5 vote(s)

Feedback/ Suggest Improvement Add Notes Improve Article

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.

Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.

Load Comments

https://www.geeksforgeeks.org/operating-system-benefits-multithreading/ 2/3
8/14/2019 Operating System | Benefits of Multithreading - GeeksforGeeks

5th Floor, A-118,


Sector-136, Noida, Uttar Pradesh - 201305
feedback@geeksforgeeks.org

COMPANY LEARN
About Us Algorithms
Careers Data Structures
Privacy Policy Languages
Contact Us CS Subjects
Video Tutorials

PRACTICE CONTRIBUTE
Courses Write an Article
Company-wise Write Interview Experience
Topic-wise Internships
How to begin? Videos

@geeksforgeeks, Some rights reserved

https://www.geeksforgeeks.org/operating-system-benefits-multithreading/ 3/3

You might also like