thread management
DESCRIPTION
how operating system works's....TRANSCRIPT
[email protected] 0315-4632432 1
2
BS-TELECOMMUNICATION
THREADS MANAGEMENT
Submitted To: Engr.Mr Atta
submitted By: Adeel Akhtar
[email protected] 0315-4632432
[email protected] 0315-4632432 3
WHAT IS A THREAD? process:
• an address space with 1 or more threads executing within that address space, and the required system resources for those threads
• a program that is running thread:
• a sequence of control within a process• shares the resources in that process
[email protected] 0315-4632432 5
ADVANTAGES AND DRAWBACKS OF THREADS Advantages:
• the overhead for creating a thread is significantly less than that for creating a process
• multitasking, i.e., one process serves multiple clients
• switching between threads requires the OS to do much less work than switching between processes
[email protected] 0315-4632432 6
Drawbacks:
• not as widely available as longer established features
• writing multithreaded programs require more careful thought
• more difficult to debug than single threaded programs
• for single processor machines, creating several threads in a program may not necessarily produce an increase in performance (only so many CPU cycles to be had)
[email protected] 0315-4632432 7
USER THREADS
Thread management done by user-level threads library
Examples
- POSIX Pthreads
- Mach C-threads
- Solaris threads
THREADS
Kernel Threads• Supported by the Kernel
• Examples
- Windows 95/98/NT/2000
- Solaris
- Tru64 UNIX
- BeOS
- Linux
[email protected] 0315-4632432 8
MULTITHREADING MODELS
Many-to-One
One-to-One
Many-to-Many
THREADS
How do user and kernelthreads map into each other?
[email protected] 0315-4632432 9
MANY-TO-ONE
Many user-level threads mapped to single kernel thread.
Used on systems that do not support kernel threads.
Examples:Solaris Green
ThreadsGNU Portable
Threads
THREADS
[email protected] 0315-4632432 10
ONE-TO-ONE
Each user-level thread maps to kernel thread.
Examples
- Windows 95/98/NT/2000
- Linux
THREADS
[email protected] 0315-4632432 11
MANY-TO-MANY
In this model, the library has two kinds of threads: bound and unboundbound threads are mapped
each to a single lightweight process
unbound threads may be mapped to the same LWP
Probably the best of both worlds
Used in the Solaris implementation of Pthreads (and several other Unix implementations)
[email protected] 0315-4632432 12
BS-TELECOMMUNICATION
For slide making and composing feel free to contact..
[email protected] 0315-4632432