Time slice, cpu time slice

Source: Internet
Author: User

Time slice, cpu time slice

Timeslice is also called "quantum" or "processor slice) it is a period of CPU time allocated by the time-sharing operating system to each running process at a micro level (in the preemption kernel, it is the time from the process running until it is preemptible ). Modern operating systems (such as Windows, Linux, and Mac OS X) Allow multiple processes to run simultaneously-for example, you can open the music player to listen to music while browsing the Web page in a browser and downloading files. In fact, since a computer usually has only one CPU, it is never possible to run multiple tasks simultaneously. These processes "look like" and run at the same time. In fact, the time slice is usually very short (5 ms-800 ms on Linux), and the user will not feel it.

The time slice is allocated to each process by the scheduling program of the operating system kernel. First, the kernel assigns an equal initial time slice to each process, and then executes the corresponding time for each process in turn. When all processes are in the time slice depletion state, the kernel re-calculates and allocates time slices for each process.

Time slice allocation

Generally, the length of time slice allocated to all processes in a system is not equal, although the initial time slice is basically equal (in Linux, the initial time slice is not equal, the system calculates the interaction between each process by measuring the duration of the process in the "Sleep" and "running" state, interaction and the superposition of the preset static priority (Nice value) of each process is the dynamic priority, and the proportional scaling of the dynamic priority is the length of the time slice to be allocated to that process. Generally, in order to get a fast response speed, the time slice allocated to processes with strong interactivity (tends to be IO-consuming) is longer than that of processes with weak interactivity (tends to be CPU-consuming.

Our public account

Wuguiyunwei.com

QQ group: 602183872 technical exchanges

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.