

If a preempted process has not finished its work, the process must be rescheduled. At the center of this scheduling model is a fixed timeslice, the amount of time (e.g., 50ms) that a task is allowed to hold a processor until preempted in favor of some other task.
#Linux see process timeslice windows#
Unix popularized classic preemptive scheduling, which other operating systems including VAX/VMS, Windows NT, and Linux later adopted. Interactive desktop applications, such as browsers, tend to be I/O-bound.Ī good process scheduler has to balance the needs of processor-bound and I/O-bound tasks, especially in an operating system such as Linux that thrives on so many hardware platforms: desktop machines, embedded devices, mobile devices, server clusters, supercomputers, and more. Although an entire process might be characterized as either processor-bound or I/O-bound, a given process may be one or the other during different stages of its execution. As examples, crunching numbers is processor-bound, and accessing files is I/O-bound. A runnable process is one that is not currently blocked.Ī process is processor-bound (aka compute-bound) if it consumes mostly processor as opposed to I/O resources, and I/O-bound in the opposite case hence, a processor-bound process is mostly runnable, whereas an I/O-bound process is mostly blocked. The process can resume execution only after the event completes. A blocked process is awaiting the completion of some event such as an I/O event. Linux threads are sometimes described as lightweight processes, with the lightweight underscoring the sharing of resources among the threads within a process.Īlthough a process can be in various states, two are of particular interest in scheduling. Threads within a multi-threaded process remain related in that they share resources such as memory address space. If a process is multi-threaded with N threads, then N scheduling actions would be required to cover the threads. In a simplifying move, Linux turns process scheduling into thread scheduling by treating a scheduled process as if it were single-threaded.

10 command-line tools for data analysis in Linux.To schedule a process is to schedule one of its threads on a processor. A process has one or more threads of execution, which are sequences of machine-level instructions. Process scheduling is how the operating system (OS) assigns tasks (e.g., crunching some numbers, copying a file) to processors-a running process then performs the task. As such, a process must contend with other processes for shared system resources: memory to hold instructions and data, at least one processor to execute instructions, and I/O devices to interact with the external world. Linux inherits the Unix view of a process as a program in execution. Let's start with a quick review of some core technical terms. Let's dig into the details of what sets CFS apart from-indeed, above-other process schedulers. In any case, CFS breaks dramatically with what might be called "classic preemptive scheduling." Also, the "completely fair" claim has to be seen with a technical eye otherwise, the claim might seem like an empty boast. Completely fair scheduling (CFS), which became part of the Linux 2.6.23 kernel in 2007, is the scheduling class for normal (as opposed to real-time) processes and therefore is named SCHED_NORMAL.ĬFS is geared for the interactive applications typical in a desktop environment, but it can be configured as SCHED_BATCH to favor the batch workloads common, for example, on a high-volume web server. A scheduling class specifies which scheduling policy applies to which type of process. Linux takes a modular approach to processor scheduling in that different algorithms can be used to schedule different process types.
