Onetask androi12/30/2023 ![]() When an interruption occurs then the process in the running state should be stopped and the CPU should handle the interrupt before doing something else.In this case, the execution of the running process should be stopped and the higher priority process should be given the CPU for execution. When a process of high priority comes in the ready state.Context switching can happen due to the following reasons: So, the context of the process should be saved before putting any other process in the running state.Ī context is the contents of a CPU's registers and program counter at any point in time. But in reality, it should continue from that point where it left the CPU in its previous execution. If you are not saving the context of any process P then after some time, when the process P comes in the CPU for execution again, then the process will start executing from starting. You have to save the context of that process. You can't directly switch a process from the running state to the ready state. The processes are switched so fastly that it gives an illusion to the user that all the processes are being executed at the same time.īut the context switching process involved a number of steps that need to be followed. It is one of the essential features of the multitasking operating system. In this phenomenon, the execution of the process that is present in the running state is suspended by the kernel and another process that is present in the ready state is executed by the CPU. What is Context Switching?Ī context switching is a process that involves switching of the CPU from one process or task to another. In this blog, we will learn about the concept of Context Switching in the Operating System and we will also learn about the advantages and disadvantages of Context Switching. So, these process switchings are done with the help of Context Switching. Sometimes, the process might be using a round-robin scheduling algorithm where after every fixed time quantum, the process has to come back to the ready state from the running state. If the running process wants to perform some I/O operation, then you have to remove the process from the running state and then put the process in the I/O queue. In the Operating System, there are cases when you have to bring back the process that is in the running state to some other state like ready state or wait/block state.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |