Switching the CPU to another Process requires saving the state of the...
Context Switching involves storing the context or state of a process so that it can be reloaded when required and execution can be resumed from the same point as earlier. This is a feature of a multitasking operating system and allows a single CPU to be shared by multiple processes.
View all questions of this test
Switching the CPU to another Process requires saving the state of the...
Context Switch
A context switch is the process of switching the central processing unit (CPU) from one process to another. When a process is interrupted and another process is scheduled to run, the state of the current process needs to be saved, and the state of the new process needs to be loaded. This entire process is known as a context switch.
Process Blocking
Process blocking refers to a situation where a process is unable to proceed further due to various reasons, such as waiting for user input, waiting for a resource, or waiting for another process to complete its task. When a process is blocked, it cannot move forward until the particular condition or event it is waiting for is fulfilled.
Time Sharing
Time sharing refers to the concept of dividing the CPU's time among multiple processes, allowing each process to execute for a small amount of time before switching to another process. This technique ensures that all processes get a fair share of the CPU's time and that no process monopolizes it.
Explanation
When a CPU needs to switch from executing one process to another, it must save the state of the current process and load the state of the new process. This is necessary to ensure that the new process starts from where it left off and that the previous process can resume its execution later.
During a context switch, the CPU saves the current process's state, including its program counter, registers, and other relevant information, into memory or the process control block (PCB). The PCB contains all the necessary information about a process, such as its priority, memory allocation, and resource usage.
Once the state of the current process is saved, the CPU loads the state of the new process from its PCB. This includes restoring the program counter, registers, and other relevant information. The CPU then starts executing the new process from where it left off.
The context switch allows for efficient multitasking and time sharing among different processes. It ensures that each process gets its fair share of the CPU's time and prevents any single process from monopolizing system resources.
In conclusion, when the CPU switches from one process to another, it saves the state of the old process and loads the state of the new process. This process is known as a context switch. Therefore, the correct answer is option 'B' - Context Switch.
To make sure you are not studying endlessly, EduRev has designed Railways study material, with Structured Courses, Videos, & Test Series. Plus get personalized analysis, doubt solving and improvement plans to achieve a great score in Railways.