Threads Flashcards
Kernel Level Thread
Kernel level thread is within the kernel, all modern operating systems use this because it allows the kernel to perform multitasking
Pro’s
- kernel routines can be multi-threaded
- if a kernel level thread is blocked, another thread of the same process can be scheduled
Con’s
- slower to dread and manage than user level thread
- to transfer control from one thread to another you have to switch to kernel mode
User Level Thread
User level thread is above the kernel and doesn’t use the kernel
Pro’s
- easy and fast to create than kernel level thread
- can be run on any OS
Con’s
- the entire process is blocked once user level thread performs blocking operation
- multithreaded application cannot use multi programming to their advantage
Multitasking
Running on a single cord
The computer gives the appearance of multitasking by allocating a slice of its time to different tasks. Pre-emotive multitasking gives higher priority tasks more time, whereas corporative multitasking, the operating system never initiated context switch from a running process to another. The processes are executed fairly, in running order and must work together for the system to work
E.g. computers - running different applications
Pro’s:
- Saves time as users don’t have to wait
- memory security: process can only use its allocated space
Con’s:
- need high speed processor
- cooling system for cpu because it gets hot from programs running
Multithreaded
Running on a single cord
Multithreaded processes have two parts inside the same task that do things in parallel. The schedular gives its time to one thread and its time to another to make it look like it’s doing it at the same time. All threads share the same resources like memory
Pro’s:
- It can wait without affecting other activities
- activities fail/succeed independently
Con’s:
- need more support from threads
- May need a lot of space for stack block of threads
Multi processing
Running on a multiple cords
Multiprocessing is when you have more than one cpu cord allowing the processor to do more that one thing at once
Pro’s:
- short response time
- cpu is used a lot and never becomes idle
Con’s:
- dues to high load of task, longs jobs have to wait longer
- tracking all tasks and processes can be difficult to handle
Multithreading module
One to one:
Separate kernel is created to handle each thread
One to many:
Many user level threads are mapped to a single kernel
Many to many:
Multiplexes any number of user threads onto equal or smaller number of kernel level threads