0% found this document useful (0 votes)
62 views20 pages

Name: Abubakr & Haseeb Tariq Subject: Operating System Topic: Threads Types & Its Issues

This document discusses different types of threads - user level threads and kernel level threads. User level threads are managed by user level libraries and do not require kernel involvement for context switching. Kernel level threads are known to and managed by the kernel. The document outlines benefits and disadvantages of each type, such as user level threads being faster but providing less coordination, while kernel level threads allow better scheduling but are slower.

Uploaded by

Bilal Khan Rind
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views20 pages

Name: Abubakr & Haseeb Tariq Subject: Operating System Topic: Threads Types & Its Issues

This document discusses different types of threads - user level threads and kernel level threads. User level threads are managed by user level libraries and do not require kernel involvement for context switching. Kernel level threads are known to and managed by the kernel. The document outlines benefits and disadvantages of each type, such as user level threads being faster but providing less coordination, while kernel level threads allow better scheduling but are slower.

Uploaded by

Bilal Khan Rind
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Name: Abubakr & Haseeb Tariq

Subject: Operating System


Topic: Threads Types & its Issues
Thread

A Thread is a basic unit of


CPU utilization, consisting
of a program counter, a
stack, and a set of registers,
( and a thread ID. )
Traditional ( heavyweight )
processes have a single
thread of control - There is
one program counter, and
one sequence of
instructions that can be
carried out at any given
time.

Benefits of multi threading


There are four major
categories of benefits to
multi-threading:
• Responsiveness One
thread may provide
rapid response while
other threads are
blocked or slowed
down doing intensive
calculations.
• Resource sharing - By
default threads share
common code, data,
and other resources,
which allows multiple
tasks to be performed
simultaneously in a
single address space.
• Economy - Creating
and managing threads
( and context switches
between them ) is
much faster than
performing the same
tasks for processes.
Scalability, i.e. Utilization of
multiprocessor
architectures - A single
threaded process can only
run on one CPU, no matter
how many may be
available, whereas the
execution of a multi-
threaded application may
be split amongst available
processors.
User level thread (ULT)

Is implemented in the user


level library, they are not
created using the system
calls. Thread switching
does not need to call OS
and to cause interrupt to
Kernel. Kernel doesn’t
know about the user level
thread and manages them
as if they were
singlethreaded processes
Advantages of ULT

• Can be implemented on an OS
that does’t support
multithreading.
• Simple representation since
thread has only program
counter, register set, stack
space.
• Simple to create since no
intervention of kernel.
• Thread switching is fast since
no OS calls need to be made.
Disadvantages of ULT

• No or less co-
ordination among the
threads and Kernel.
• If one thread causes a
page fault, the entire
process blocks
Kernel Level Thread
(KLT)

Kernel knows and manages


the threads. Instead of
thread table in each
process, the kernel itself
has thread table (a master
one) that keeps track of all
the threads in the system.
In addition kernel also
maintains the traditional
process table to keep track
of the processes. OS kernel
provides system call to
create and manage
threads.
Advantages of KLT

• Since kernel has full


knowledge about the
threads in the system,
scheduler may decide to
give more time to
processes having large
number of threads.
• Good for applications
that frequently block
Disadvantages of KLT

• Slow and inefficient.


• It requires thread control
block so it is an
overhead.

You might also like