Kernel level threads take a longer time to context switch since OS will have to save and reload each and every TCB (Thread Control block) where as in user level no kernel intervention threads simply context switch more efficiently.
But there are disadvantages such as since OS sees the user leve threads as a whole process it will not give a large portion of CPU time for execution if a thread is blocked the whole process goes to the waiting state
please correct my answer if im wrong
godlovesu49@hotmail.com
thanks
regards
yo
Context switching between kernel threads typically requires saving the value of the CPU registers from the thread being switched out and restoring the CPU registers of the new thread being scheduled.
When a context switch occurs, the kernel saves the context of the old process into its Program Control Block and loads the saved context of the new process scheduled to run.
•No special support needed from the kernel (use any Unix) •Thread creation and context switch are fast (no syscall) •Defines its own thread model and scheduling policies
In any environment, in order to execute a privileged instruction you have have to switch from user mode to kernel mode, hence a context switch.
1- State of current process is Saved. 2-Restore State of incoming process.
Context means ,in terms of computers, the status of various general purpose registers having some process specific data values and even some other structures dependent on computer hardware,i.e. PCB etc. Now what context switch means ,""switching from one status of registers set to another status of registers set."" This context may be of a process or thread etc. Now when we are talking about any type of context switching,,it means we are requesting the KERNEL to save the current context anywhere,and fetch the next context for us.. It requires a mode switch between user mode to kernel mode, so that required switching may be performed in right order.... Isn't it simple ,,or what.
AnswerThe thread library function performs the following actions to context switch between user level threads:1. Copy all live registers to Thread control Block (TCB)2. Restore the state of the thread to run next i.e. (copy the values of live registers from (TCB) to registers)3. Move to the next thread to execute
macro-kernel based operating systems like windows and Linux device drivers are part of kernel ..to interact withkernel need not switch to kernel mode...speed is high
If it really is the switch itself which is leaking, then it cannot be fixed, and needs to be replaced. On the other hand, if the leak is at the threads where it screws into the block, then a fix that may work is to remove the swith, clean the threads on the switch, and in the block opening, wrap the switch threads with teflon plumber's tape, and replace the switch into the block, tightening it firmly. Hope this helps.j3h.
In the past (and perhaps currently as well) it has used round-robin, at one time 1 second but since updated to .1 seconds. It may also have other features such as preemptive abilities. Priority fair scheduling.
Basically, there are three types of kernel: - Monolithic Kernel- Micro Kernel- ExoKernel Monolithic:As the name itself suggests, the kernel has every services like, FS Management, MM, Process Management, etc. in the kernel space. It does not run as a separate process. So, as you guess, there is no context switching, when you ask for a service. But, the probability of a monolithic kernel getting struck is more. Because, if there is a bug in the kernel itself, nothing can rescue it. Linux and Windows are good examples of Monolithic kernel. Linux, being a monolithic kernel, you can insert modules into the kernel dynamically using insmod command. Micro Kernel:Micro kernel runs all the services as a daemon in the user space. So, if a problem occurs in any of the service, the kernel will be able to decide what to do next. But, you pay-off the time to switch to a service in this type of kernel. Micro kernels are some what difficult to design and build than the monolithic kernel. There are always a discussion over the internet, talking about the advantage and disadvantages of monolithic and micro kernel. Exo Kernel:Exo kernel is not yet stabilized. It's under design and research. The user mode processes running in this type of kernel has the ability to access kernel resources like process tables, etc directly.
Answer# 11. reason - the control blocks for processes are larger than for threads (hold more state information), so the amount of information to move during the thread switching is less than for process context switching 2. reason - the major reason is that the memory management is much simpler for threads than for processes. Threads share their memory so during mode switching, memory information does not have to be exchanged/changed, pages and page tables do not have to be switched, etc. This makes the thread context switch much cheaper than for processes. In case of processes the memory pieces (pages) need to be exchanged, etc. (Will talk about the details in few weeks). 3. reason - threads do not have to worry about accounting, etc, so do not have to fill out all the information about accounting and other process specific information in their thread control block, so keeping the thread control block consistent is much faster 4. reason - threads share files, so when mode switch happens in threads, these information stay the same and threads do not have to worry about it (similar to accounting information) and that makes the mode switch much faster.answer 2## Process :Generally heavy weight by, the PCB holds kernel objects the values generally referred as state information. A application can be divided into two types in design phase: 1.Process - may affect application/program architecture 2.Threads - didn't affect architecture Threads typically are spawned for a short-term benefit where as process for long-term even the thread share its own process address space is never larger than 4GB. A single process may hold "n" threads so exchanging value between process; then the CPU spend most of its time for swapping it leads to thrasing definitely. Threads easily exchange their locale variables within its scope but exchange value between process stolen more CPU cycles.