A thread is basic unit of CPU utilization .it is also called light weight process.it is sequence of instructions within process. A thread behaves like process within process but it does not have own PCB. multiple thread are created within process. The multiple thread allows multiple executions
Now days threads use in
- threads with python threads def
- threads definition
- threads java
- threads clothing
User level threads : user level thread are implemented in user libraries instead of system call. The thread switching need to call operating system
advantages:
- the user level thread are fast and efficient.
- they can be implemented on any operating system that does not support threads
- they are simple to manage .The switching between threads can be done without kernel
Disadvantages:
- there is lack of of coordination between threads and operating system kernel .The process get single time slice even if has large number of threads in it
- a multithread application with pure user level threads cannot take advantage of multi processing. The kernel assigns only one process to processor at a time
kernel level threads: kernel level threads are supported with kernel of operating system .All modern operating systems support kernel level threads
advantages:
- kernel has full knowledge of all threads. Therefore scheduler may decide to give more time to process with large number of threads than the process have small number of threads.
- kernel level threads are good for applications that are blocked frequently
Disadvantages:
- The kernel level threads are slow and inefficient.
- kernel must manage and schedule threads as well as process
csi503 operating system Q3 read here
0 Comments