wisemonkeys logo
FeedNotificationProfileManage Forms
FeedNotificationSearchSign in
wisemonkeys logo

Blogs

Threads

profile
Sarvo Singh
Aug 14, 2024
0 Likes
0 Discussions
172 Reads

Definition

Within a process, a thread is a single sequence stream. Because threads have certain characteristics of processes, they are frequently referred to as lightweight processes. Every thread is associated with a single process. A process may have several threads if the operating system allows multithreading. However, threads are only useful if there are several CPUs; otherwise, two threads must context switch for each CPU.

 

Need for Threads

-Threads run in parallel improving the application performance. Each such thread has its own CPU state and stack, but they share the address space of the process and the environment.

-Threads can share common data so they do not need to use inter-process communication. Like the processes, threads also have states like ready, executing, blocked, etc.

- Similar to a process, a thread can be given priority, with the highest priority thread being scheduled first.

- A Thread Control Block (TCB) is unique to each thread. Similar to the process, the thread experiences a context transition, and the contents of its register are saved in (TCB). Since threads share resources and address space, synchronization is also necessary for the thread's multiple actions.


Components of Threads

  • Stack Space:
  • Register Set
  • Program Counter

Types of Threads

User Level Thread:

It is a type of thread that is not created using system calls. The kernel has no work in the management of user-level threads. User-level threads can be easily implemented by the user. In case when user-level threads are single-handed processes, kernel-level thread manages them. Let’s look at the advantages and disadvantages of User-Level Thread.


Kernel Level Thread:

It is a type of thread that can recognize the Operating system easily. Kernel Level Threads has its own thread table where it keeps track of the system. The operating System Kernel helps in managing threads. Kernel Threads have somehow longer context switching time. Kernel helps in the management of threads.

 

Multithreading

A thread is also known as a lightweight process. The idea is to achieve parallelism by dividing a process into multiple threads. For example, in a browser , multiple tabs can be different threads. MS Word uses multiple threads: one thread to format the text, another thread to process inputs, etc. More advantages of multithreading are discussed below.

Multithreading is a technique used in operating systems to improve the performance and responsiveness of computer systems. Multithreading allows multiple threads (i.e., lightweight processes) to share the same resources of a single process, such as the CPU, memory, and i/o devices.

 


Comments ()


Sign in

Read Next

FREE VERSION OF G-MAIL

Blog banner

GraphX:- A graph processing tool

Blog banner

File management

Blog banner

10 Problems you face if you are an Otaku

Blog banner

The Power of Forensic Watermarking in the Fight Against Content Piracy

Blog banner

Not anti-social, but pro-solitude

Blog banner

How can denial-of-service(Dos) attacks be prevented?

Blog banner

A Weekend at Oak Tree Hotel: The Best Hotel Experience in Arcadia, Florida

Blog banner

Raising mental health burden: A global and Indian perspective

Blog banner

Career v/s Job : Choose your passion

Blog banner

File system implementation

Blog banner

The Bold Digital Marketing Moves That Made Durex India’s Second-Largest Condom Brand

Blog banner

MEMORY MANAGEMENT

Blog banner

MySQL

Blog banner

Deadlocks in Operating System

Blog banner

Topic: Sessions in Operating system

Blog banner

Understanding Suicidal Thoughts and Self-Harm: Recognising the Signs and Finding Hope

Blog banner

Importance of education

Blog banner

AutoML: The Future of Automated Data Science

Blog banner

Way to make your meal healthier.

Blog banner

Indian Culture and Tradition

Blog banner

Why Moms Are Choosing Customised School Accessories Over Generic Products?

Blog banner

All you need to know about Cassandra

Blog banner

Internet of Things and cyber security

Blog banner

Number Guessing game --lisp

Blog banner

Modern Operating System

Blog banner

Virtual Machine

Blog banner

Different types of scam Fraud

Blog banner

Why Progressive Web Apps (PWAs) Are Replacing Traditional Websites

Blog banner

Expert System In AI

Blog banner

Article on IT development trends

Blog banner

Top 5 Post-Wedding Skin Care Tips

Blog banner

COMFORT IS ALL ABOUT FASHION

Blog banner

Modern operating system

Blog banner

Top 10 Logos and their meanings

Blog banner

An Approach To Spyware Detection And Removal

Blog banner

Importance of Website

Blog banner

What is the point of living if we can die at any moment of our lives ?

Blog banner

Are Social Media Paid Campaigns Worth It?

Blog banner

Cyber Forensics

Blog banner

An Overivew Of Cache Memory

Blog banner

Royal enfield

Blog banner