The Great Symbian

Anything under the sun goes here!

Showing posts with label OS5. Show all posts
Showing posts with label OS5. Show all posts

WINDOWS XP THREAD


Implements the one-to-one mapping
Each thread contains
- A thread id
- Register set
- Separate user and kernel stacks
- Private data storage area
The register set, stacks, and private storage area are known as the context of the threads
The primary data structures of a thread include:
- ETHREAD (executive thread block)
- KTHREAD (kernel thread block)
- TEB (thread environment block)

LINUX THREADS
- Linux refers to them as tasks rather than threads
- Thread creation is done through clone() system call
- clone() allows a child task to share the address space of the parent task (process)

JAVA THREADS
- Java threads are managed by the JVM

- Java threads may be created by:
  • Extending Thread class
  • Implementing the Runnable interface


  • Thread Library schedules user-level threads to run on LWP
  • Thread management done by user-level Threads Library
  • The Thread Library is responsible for scheduling user threads on the available schedulable entities; this makes context switching of threads very fast, as it avoids system calls. However, this increases complexity and the likelihood of priority inversion, as well as suboptimal scheduling without extensive (and expensive) coordination between the userland scheduler and the kernel scheduler.

MANY-TO-ONE MODEL

• Many user-level threads mapped to single kernel thread.

• Used on systems that do not support kernel threads.




ONE-TO-ONE MODEL

• Each user-level thread maps to kernel thread.
• Creating a user thread requires creating the corresponding kernel thread.

• Windows NT/2000, OS/2




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.

• Solaris 2 , IRIS, HP-UX










• Supported by the Kernel

• Slower to create and manage threads than are user threads

• If a thread performs a blocking system call, then the kernel can schedule another thread in the application for execution.• Multiple threads are able to run in parallel on multiprocessors.

• Examples
- Windows NT/2000
- Solaris 2
- Tru64 UNIX
- BeOS
- Linux

• Thread management done by user-level threads library

• Fast to create and manage threads

• If the kernel is single-threaded, then any user-level thread performing a blocking system call

will cause the entire process to block

• No need for kernel intervention

• Drawback : all may run in single process. If one blocks, all block.

• Examples
- POSIX Pthreads
- Mach C-treads
- Solaris UI-threads

  • Responsiveness

- Can run even if one thread blocked or bus

- Web browser example – one thread per client

  • Resource Sharing
  • Economy

- Creating and context switching threads is low cost

- Solaris 2 : creating 30x, context switch 5x slower for procs

  • Utilization of MP ArchitecturesF Run each thread on different CPU


  • A thread, also called a lightweight process (LWP), is the basic unit of CPU utilization.

  • It has its own program counter, a register set, and stack space.

  • It shares with the pear threads its code section, data section, and OS resources such as open files and signals, collectively called a task.

  • Single-threaded process has one program counter specifying location of next instexecuteO Process executes instructions sequentially, one at a time, until completion
  • Multi-threaded process has one program counter per thread

FEEDS

Add to Google Reader or Homepage

Click2Sell

Buy

How To Learn Photoshop in Just 2 Hrs

Chatbox

Click Here

About this blog