thread management

13
[email protected] 0315-4632432 1

Upload: ayaan-adeel

Post on 01-Nov-2014

3 views

Category:

Design


0 download

DESCRIPTION

how operating system works's....

TRANSCRIPT

Page 1: Thread management

[email protected] 0315-4632432 1

Page 2: Thread management

2

BS-TELECOMMUNICATION

THREADS MANAGEMENT

Submitted To: Engr.Mr Atta

submitted By: Adeel Akhtar

[email protected] 0315-4632432

Page 3: Thread management

[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

Page 4: Thread management

[email protected] 0315-4632432 4

SINGLE AND MULTITHREADED PROCESSES

THREADS

Page 5: Thread management

[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

Page 6: Thread management

[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)

Page 7: Thread management

[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

Page 8: Thread management

[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?

Page 9: Thread management

[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

Page 10: Thread management

[email protected] 0315-4632432 10

ONE-TO-ONE

Each user-level thread maps to kernel thread.

Examples

- Windows 95/98/NT/2000

- Linux

THREADS

Page 11: Thread management

[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)

Page 12: Thread management

[email protected] 0315-4632432 12

Page 13: Thread management

BS-TELECOMMUNICATION

[email protected]

For slide making and composing feel free to contact..

[email protected] 0315-4632432