3. 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
adeel_tc@hotmail.com 0315-4632432 3
5. 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
adeel_tc@hotmail.com 0315-4632432 5
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)
adeel_tc@hotmail.com 0315-4632432 6
7. THREADS
Thread management done by user-level threads library
Examples
- POSIX Pthreads
- Mach C-threads
- Solaris threads
• Supported by the Kernel
• Examples
- Windows 95/98/NT/2000
- Solaris
- Tru64 UNIX
- BeOS
- Linux
adeel_tc@hotmail.com 0315-4632432 7
9. THREADS
Many user-level threads
mapped to single kernel
thread.
Used on systems that do
not support kernel
threads.
Examples:
Solaris Green Threads
GNU Portable Threads
adeel_tc@hotmail.com 0315-4632432 9
10. THREADS
Each user-level thread maps to kernel thread.
Examples
- Windows 95/98/NT/2000
- Linux
adeel_tc@hotmail.com 0315-4632432 10
11. In this model, the library has two
kinds of threads: bound and
unbound
bound 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)
adeel_tc@hotmail.com 0315-4632432 11