Explain how contextswitching is performed for userlevel thre
Solution
contex swithch:
-->It is a process of storing and restoring the state of a process or thread so that execution can be resumed
from the same point at a later time.
-->Contex switch is two types.
-->switching from one process to another is called contex switch.
1)multi processing -- Related to multiple process
2)multi tasking --related to single process multiple programs
-->In this CPU time is shared among running process.when running time for a process
expires,a new process has to be loaded for execution.
-->Commmly we use multi tasking,by defining multiple threads in our program.
-->Thread uses the same memory so memory utilization is there.
-->Thread is light weight process because it shares code,data,heap and open files with the parent process.
---------------------------------------------------------------------------------------------------------------------------------------------------
1)Open file discriptors -- usefull when we want \"Thread specific\" offsets.
2)stack pointer -- used to context swithcing between threads
3)priority -- thread schedular will take priority which thread to execute first
4)Stack memory -- each thread have seperate stack memory
