Os 4 Thread 111129011744 Phpapp02.Unlocked

24
Vinay Arora CSED Threads Organized By: Vinay Arora Assistant Professor CSED, TU

description

Threads

Transcript of Os 4 Thread 111129011744 Phpapp02.Unlocked

Page 1: Os 4 Thread 111129011744 Phpapp02.Unlocked

Vinay Arora

CSED

Threads

Organized By: Vinay Arora

Assistant Professor

CSED, TU

Page 2: Os 4 Thread 111129011744 Phpapp02.Unlocked

Vinay Arora

CSED

Disclaimer

This is NOT A COPYRIGHT MATERIAL

Content has been taken mainly from the following books:

Operating Systems Concepts By Silberschatz & Galvin, Operating Systems: Internals and Design Principles By William Stallings

www.os-book.com

www.cs.jhu.edu/~yairamir/cs418/os2/sld001.htm

www.personal.kent.edu/~rmuhamma/OpSystems/os.html

http://msdn.microsoft.com/en-us/library/ms685096(VS.85).aspx

http://www.computer.howsttuffworks.com/operating-system6.htm

http://williamstallings.com/OS/Animations.html

Etc…

Page 3: Os 4 Thread 111129011744 Phpapp02.Unlocked

Vinay Arora

CSED

Thread

� Application - Set of Multiple Processes

� Process – An Executable File (.exe)

� Each PROCESS has its own Address Space, CPU Quota, Access to

Hardware Resources and Kernel Resources

� THREAD – Function Present within Executable File

� Each THREAD has its own PC, Stack , Registers

Page 4: Os 4 Thread 111129011744 Phpapp02.Unlocked

Vinay Arora

CSED

Process Thread View

Page 5: Os 4 Thread 111129011744 Phpapp02.Unlocked

Vinay Arora

CSED

Process View

Page 6: Os 4 Thread 111129011744 Phpapp02.Unlocked

Vinay Arora

CSED

Thread View

Page 7: Os 4 Thread 111129011744 Phpapp02.Unlocked

Vinay Arora

CSED

Processes & Threads

Page 8: Os 4 Thread 111129011744 Phpapp02.Unlocked

Vinay Arora

CSED

User Space & Kernel Space

Page 9: Os 4 Thread 111129011744 Phpapp02.Unlocked

Vinay Arora

CSED

Multicore Programming

� Multi-Core Systems putting pressure on programmers, challenges include

� Dividing activities

� Balance

� Data splitting

� Data dependency

� Testing and debugging

Page 10: Os 4 Thread 111129011744 Phpapp02.Unlocked

Vinay Arora

CSED

Concurrent Execution on a Single-core

System

Page 11: Os 4 Thread 111129011744 Phpapp02.Unlocked

Vinay Arora

CSED

Concurrent Execution on a Multi-core

System

Page 12: Os 4 Thread 111129011744 Phpapp02.Unlocked

Vinay Arora

CSED

Pure User Level

Page 13: Os 4 Thread 111129011744 Phpapp02.Unlocked

Vinay Arora

CSED

Pure Kernel Level

Page 14: Os 4 Thread 111129011744 Phpapp02.Unlocked

Vinay Arora

CSED

Combined

Page 15: Os 4 Thread 111129011744 Phpapp02.Unlocked

Vinay Arora

CSED

Combined Threads

Page 16: Os 4 Thread 111129011744 Phpapp02.Unlocked

Vinay Arora

CSED

Single & Multi Threaded Process

Page 17: Os 4 Thread 111129011744 Phpapp02.Unlocked

Vinay Arora

CSED

Benefits

� Responsiveness

� Resource Sharing

� Economy

� Utilization of MP Architectures

Page 18: Os 4 Thread 111129011744 Phpapp02.Unlocked

Vinay Arora

CSED

User Thread & Kernel Thread

� User Thread - Thread Management done by User-Level Threads Library

� Kernel Thread - Supported by the KERNEL

� Examples

� Windows XP/2000

� Solaris

� Linux

� Tru64 UNIX

� Mac OS X

Page 19: Os 4 Thread 111129011744 Phpapp02.Unlocked

Vinay Arora

CSED

Thread Library

� Three Primary Thread Libraries:

� Java Threads

� Pthreads

� Win32 Threads

Page 20: Os 4 Thread 111129011744 Phpapp02.Unlocked

Vinay Arora

CSED

Multi Threading Models

� Many-to-One

� One-to-One

� Many-to-Many

Page 21: Os 4 Thread 111129011744 Phpapp02.Unlocked

Vinay Arora

CSED

Many-to-One Model

� Many User-Level Threads mapped to Single Kernel Thread

� Examples:

� Solaris Green Threads

Page 22: Os 4 Thread 111129011744 Phpapp02.Unlocked

Vinay Arora

CSED

One-to-One Model

� Each User-Level Thread maps to KERNEL THREAD

� Examples

� Linux

� Solaris 9 and later

� Windows NT/XP/2000

Page 23: Os 4 Thread 111129011744 Phpapp02.Unlocked

Vinay Arora

CSED

Many-to-Many Model

� Allows many User Level Threads to be mapped to many Kernel Threads

� Allows the Operating System to create a sufficient number of Kernel

Threads

� Windows NT/2000

Page 24: Os 4 Thread 111129011744 Phpapp02.Unlocked

Vinay Arora

CSED

Thnx…