What is pre-emptive multitasking?

Pre-empting in operating systems means taking the control of the operating system from one process and handing it over to another process.

Pre-emptive multitasking means sharing the operating system and resources between multiple tasks.

Explanation

A time-sharing condition enables pre-emptive multitasking. Each task is allocated a slice of time from the computing resources. The tasks may share the time, or the operating system may allocate an additional amount of time slices depending on the importance and priority of the tasks.

The operating system initiates an interrupt mechanism to withdraw resources from a process, and then allocates them to another process.

Figure 1 provides an example of how pre-emptive multitasking takes place when tasks are scheduled by priority. Initially, Task 1 with a low priority is executing. Task 2 with a higher priority arrives, and its execution begins while the execution of Task 1 stops. Task 3 with an even higher priority arrives and runs to completion, while the execution of Task 2 is halted and resumes only after Task 3 is completed. Execution of Task 1 resumes after Task 2 completes.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved