Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
Computer Engineering
Department
GANDHINAGAR INSTITUTE OF
TECHNOLOGY
Operating System(2140702)
Threads, Concept of Multithreads,
Benefits of threads, Types of threads
Prepared By:
Darji Mit
Threads
A threads is a flow of execution through the
process code, with its own program counter,
System register and stack. A thread is also called
a light weigth process. Threads provide a way to
improve application performance through
parallelism.
Each thread belongs to exactly one process and
no thread can exits outside a process.
Threads .ppt
Concept of Multithreads
• Some operating system provide a combined
user level thread and Kernel level thread
facility.
• Multiple threads within the same application
can run in parallel on multiple processors and
a blocking system call need not block the
entire process.
1.Many to many relationship.
2.Many to one relationship.
3.One to one relationship.
Many to Many
 The many-to-many model multiplexes any number of user
threads onto an equal or smaller number of kernel threads,
combining the best features of the one-to-one and many-to-
one models.
Many to one
• In the many-to-one model, many user-level threads are all
mapped onto a single kernel thread. Thread management is
handled by the thread library in user space, which is efficient
in nature.
One to one
 Each user thread maps to one kernel thread. provides more
concurrency, if one thread makes a blocking call another
thread is allowed to run. Creating user thread requires
creating coorresponding kernel thread.
Benefits of Threads
Responsiveness
Resource Sharing
Economy
Types of Threads
User Level
Thread (ULT)
Kernel level
Thread (KLT)
User Level Threads (ULT)
• User level thread implement
in user level libraries, So
Thread switching does not
need to call operating system
and to cause interrupt to the
kernel.
• in fact, the kernel knows
nothing about user level threads
and manages them as if they
Were singel-threaded process.
Advantages of ULT:
• User level threads does not reqquire modification to
operating system.
• Easy to represent and manage.
• User level thread can run on any operating system.
• User level threads are fast and efficient
Disadvantages of ULT:
• there is a lack of coordination between threads and operating
system kernel
• ULT require non-blocking system call.
Kernel Level Threads (KLT)
In this method, the
kernel knows about
and manages the
threads. No runtime
system is needed in
this case. Operating
system kernel provides
system call to create
and manage threads
Advantages of KLT:
• Kernel can simultaneously schedule multiple threads from the
same process on multiple processes.
• If one thread in a process is blocked the kernel can schedule
another thread of the same process.
• Kernel routines themselves can multithreaded.
Disadvantages of KLT:
• kernel thread are generally slower to ccreate and manage
that the user threads.
• Kernel requires Thread Control Block(TCB) for each thread in
the pool, hence complexity increases.
Threads .ppt

More Related Content

Threads .ppt

  • 1. Computer Engineering Department GANDHINAGAR INSTITUTE OF TECHNOLOGY Operating System(2140702) Threads, Concept of Multithreads, Benefits of threads, Types of threads Prepared By: Darji Mit
  • 2. Threads A threads is a flow of execution through the process code, with its own program counter, System register and stack. A thread is also called a light weigth process. Threads provide a way to improve application performance through parallelism. Each thread belongs to exactly one process and no thread can exits outside a process.
  • 4. Concept of Multithreads • Some operating system provide a combined user level thread and Kernel level thread facility. • Multiple threads within the same application can run in parallel on multiple processors and a blocking system call need not block the entire process. 1.Many to many relationship. 2.Many to one relationship. 3.One to one relationship.
  • 5. Many to Many  The many-to-many model multiplexes any number of user threads onto an equal or smaller number of kernel threads, combining the best features of the one-to-one and many-to- one models.
  • 6. Many to one • In the many-to-one model, many user-level threads are all mapped onto a single kernel thread. Thread management is handled by the thread library in user space, which is efficient in nature.
  • 7. One to one  Each user thread maps to one kernel thread. provides more concurrency, if one thread makes a blocking call another thread is allowed to run. Creating user thread requires creating coorresponding kernel thread.
  • 9. Types of Threads User Level Thread (ULT) Kernel level Thread (KLT)
  • 10. User Level Threads (ULT) • User level thread implement in user level libraries, So Thread switching does not need to call operating system and to cause interrupt to the kernel. • in fact, the kernel knows nothing about user level threads and manages them as if they Were singel-threaded process.
  • 11. Advantages of ULT: • User level threads does not reqquire modification to operating system. • Easy to represent and manage. • User level thread can run on any operating system. • User level threads are fast and efficient Disadvantages of ULT: • there is a lack of coordination between threads and operating system kernel • ULT require non-blocking system call.
  • 12. Kernel Level Threads (KLT) In this method, the kernel knows about and manages the threads. No runtime system is needed in this case. Operating system kernel provides system call to create and manage threads
  • 13. Advantages of KLT: • Kernel can simultaneously schedule multiple threads from the same process on multiple processes. • If one thread in a process is blocked the kernel can schedule another thread of the same process. • Kernel routines themselves can multithreaded. Disadvantages of KLT: • kernel thread are generally slower to ccreate and manage that the user threads. • Kernel requires Thread Control Block(TCB) for each thread in the pool, hence complexity increases.