Quick links
Latest articles
Internship
Members
New...
Algorithms
Discrete Mathematics
Big data
Languages
C
C++
C++ STL
Java
Data Structure
C#.Net
Android
Kotlin
SQL
Web
PHP
Python
JavaScript
CSS
Ajax
Node.js
Web prog.
Programs
C
C++
DS
Java
C#
Python
Aptitude
C
C++
Java
DBMS
Interview
C
Embedded C
Java
SEO
HR
CS Subjects
CS Basics
O.S.
Networks
DBMS
Embedded Systems
Cloud Computing
Machine learning
CS Organizations
Linux
DOS
More...
Articles
Puzzles
News/Updates

Home » Operating Systems

Threading in Operating System



In this article, we will learn about Threads in operating system, and Benefits of multithread programming. Multithread models are also prescribed in this article.
Submitted by Abhishek Kataria, on July 27, 2018

Threads

A thread is a unit of CPU utilization, which comprises the following parts that are program counter, register set, stack and a thread ID. Generally, it’s well known that the process is heavy weighted which means they consume lot more resources than the threads, and in this threads are light weighted. Basically, there are two types of threading process are there which are as follows:

  1. Single Threaded process:
    Traditionally if a process has a single thread of control then it is termed as a single threaded process.
  2. Multi Threaded process:
    If a process has multiple threads of control then it is termed as a Multithreaded process. It can be used to perform multiple tasks at a single time.
  3. Single and Multi Threaded process

Thread also plays a vital role in RPC which means Remote procedure call. It is used to call a function of some another program. The thread can also be used for the interprocess communication.

Benefits of Multi-Threaded programming

  1. Responsiveness:
    Since multithreading is an application which will allow a program to run even when a part of it is blocked. So it will increase the responsiveness to the particular user. For example suppose that a particular section is not responding in the above Multi-Threaded diagram instead of an entire process not responding, the two sections can respond to the user, which means Responsiveness.
  2. Resource sharing:
    It is a beneficial part in case of Multi-Threaded programming as it allows an application to have several different threads of venture within the same address space.
  3. Boom Throughput:
    Number of jobs completed per unit time is increased which is a favorable condition.
  4. Communication:
    As different threads have the same address space so it is very easier to communicate with the Multiple-Thread.
  5. Economy:
    As we know that threads share resources of the process for which they belong, by this it will be more economical to create threads for data and resource sharing.
  6. Utilization of the Multiprocessor architectures:
    The benefits of Multi-Threading can be increased in an architecture which means threads can be made to run in parallel on a different processor, thus there will increment in a concurrency level.


Multithreading Models

Generally, there are two types of threads which are user thread and another one is kernel thread. In this type of system, the user-level threads are supported above the kernel and managed without kernel support, whereas kernel threads are directly supported and managed by the help of an operating system. On the basis of it there are generally three types of model governed:

  1. Many to One model
    In this mapping is done between the many user-level threads to the one kernel thread. So in this, we have many user levels which are mapped with one kernel thread.
  2. Many to One model in OS
  3. One to One Model
    In this mapping is done between each user thread and the kernel thread.
  4. One to One Model in OS
  5. Many to Many Model
    It is a type of model in which it multiplexes many user-level threads to a smaller or equal number of kernel threads. In this, if we have four user threads than we can have either four or less than four kernel thread.
  6. Many to Many Model in OS





Quick links:
C FAQ(s) C Advance programs C/C++ Tips & Tricks Puzzles JavaScript CSS Python Linux Commands PHP Android Articles More...

Featured post:
Introduction to Linux (Its modes, Safety, Most popular Applications)
Linux Best Distribution Software (Distros) of 2018

Was this page helpful? Please share with your friends...

Are you a blogger? Join our Blogging forum.

Comments and Discussions



Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com (2015-2018), Some rights reserved.