In computing, preemption is an interrupt action while the task is being performed by a computer system, without requiring cooperation, and with the intent to continue the task at a later time. Such changes from executed tasks are known as context switches. This is usually done by a special task or part of a system known as a preemptive scheduler, which has the power to preempt , or interrupt, and then resume, other tasks within the system.
Video Preemption (computing)
Mode pengguna dan mode kernel
In any given system design, some operations performed by the system may not be conceivable. This usually applies to kernel functionality and service interruptions which, if not allowed to run to completion, will tend to result in race conditions resulting in deadlocks. Blocking scheduler from preempting task when processing kernel function simplifies kernel design at the expense of system response. The difference between user mode and kernel mode, which determines the level of privilege in the system, can also be used to distinguish whether a task is currently predictable.
Most modern systems have preemptive seeds , which are designed to allow tasks to be clarified even when in kernel mode. Examples of such systems are Solaris 2.0/SunOS 5.0, Windows NT, Linux kernel (2.6.x and later), AIX and some BSD systems (NetBSD, since version 5).
Maps Preemption (computing)
Preemptive multitasking
The term preemptive multitasking is used to distinguish multitasking operating systems, allowing task preemption, from cooperative multitasking systems where processes or tasks must be explicitly programmed to generate when they do not require system resources.
In simple terms: Preemptive multitasking involves the use of an interrupt mechanism that delays the process being executed and invokes the scheduler to determine which process to run next. Therefore, all processes will get a certain amount of CPU time at a given time.
In preemptive multitasking, the operating system kernel can also start a context switch to meet policy scheduling priority limits, so preempting tasks is active. In general, preemption means "previous foreclosure". When a high priority task at that point takes on a running task, this is known as preemptive scheduling.
The term "preemptive multitasking" is sometimes misused when the meaning is more specific, referring to a scheduling policy class known as time-shared scheduling, or time-sharing.
Preemptive multitasking allows the computer system to better guarantee every regular "slice" process of operating time. It also allows the system to quickly handle important external events such as incoming data, which may require immediate attention from one or another process.
At certain times, the process can be grouped into two categories: waiting for input or output (called "I/O bound"), and fully utilizing the CPU ("CPU bound"). In the initial system, the process will often "poll", or "busy waiting" while waiting for the requested input (such as disk, keyboard or network input). During this time, the process does not do a useful job, but still retains full control of the CPU. With the advent of preemptive interrupt and multitasking, this I/O bound process can be "blocked", or suspended, pending the arrival of required data, enabling other processes to take advantage of the CPU. Because the arrival of the requested data will result in an interruption, blocked processes can guarantee timely returns to execution.
Although the multitasking technique was originally developed to allow many users to share a single machine, it soon became clear that multitasking was useful regardless of the number of users. Many operating systems, from mainframes to single user personal computers and non-user control systems (such as those on robotic spacecraft), have recognized the usefulness of multitasking support for various reasons. Multitasking allows a single user to run multiple applications at the same time, or run a "background" process while maintaining computer control.
Time slice
The time periods that allow the process to run in preemptive multitasking systems are usually called time slices or quantum . Scheduler is executed once every time to select the next process to run. The length of each slice can be very important to balance the performance of the system vs the response process - if the time is too short then the scheduler will take too much processing time, but if it takes too long, the process will take longer to respond to the input.
An interrupt is scheduled to allow the operating system kernel to move between processes when the time slice ends, effectively allowing the processor time to be split among a number of tasks, giving the illusion that it deals with these tasks in parallel (simultaneously). Operating systems that control such designs are called multi-tasking systems.
System support
Currently, almost all operating systems support preemptive multitasking, including current versions of Windows, macOS, Linux (including Android) and iOS.
Some of the earliest operating systems available for home users with preemptive multitasking are Sinclair QDOS (1984) and Amiga OS (1985). Both run on the Motorola 68000-family microprocessor without memory management. The Amiga OS uses dynamic loading of the moveable code block ("hunks" in the Amiga jargon) to multitask first all processes in the same flat address space.
Early PC operating systems like MS-DOS and PC DOS did not support multitasking at all, but alternative operating systems like MP/M-86 (1981) and Concurrent CP/M-86 support preemptive multitasking. Other Unix-like systems including MINIX and Coherent provide preemptive multitasking on personal computers of the 1980s.
Later versions of DOS that natively support preemptive multitasking/multithreading include Concurrent DOS, Multiuser DOS, Novell DOS (later called Caldera OpenDOS and DR-DOS 7.02 and higher). Since Concurrent DOS 386, they can also run multiple DOS programs simultaneously on a DOS virtual machine.
The earliest version of Windows to support a limited form of preemptive multitasking is Windows 2.1x, which uses Virtual 8086 Intel 80386 mode to run DOS applications on 8086 virtual machines, commonly known as "DOS boxes", which can take precedence. In Windows 95, 98 and Me, 32-bit applications are made preemptive by running each in separate address spaces, but 16-bit applications remain cooperative for backward compatibility. In Windows 3.1x (protected mode), the kernel and virtual device drivers run preemptively, but all 16-bit applications are non-preemptive and share the same address space.
Preemptive multitasking is always supported by Windows NT (all versions), OS/2 (native apps), Unix and Unix-like systems (VDS, OS/360 and many other operating systems designed in academic and medium-to-large business markets.
Although there are plans to increase the multitasking of cooperatives found in classic Mac OS to preemptive models (and preemptive APIs exist in Mac OS 9, albeit in a limited sense), these are abandoned for the macOS, as hybrids of the old Mac System style and NeXTSTEP, are systems Mach-based kernel operation and partly derived from BSD, which always provides multitasking preemptive Unix-like.
See also
- Computer multitasking
- Cooperative multitasking
References
Source of the article : Wikipedia