강좌 & 팁
이전 커널 변경을 보다 보니 재밌는게 있어서 소개합니다.
1.1. Timerless multitasking
In the prehistory of computing, computers could only have one task running at one time. But people wanted to start other tasks without waiting for first one to end, and even switch between tasks, and thus multitasking was born. First, multitasking was "collaborative", a process would run until its own code voluntarily decided to pause and allow other tasks to run. But it was possible to do multitasking better: the hardware could have a timer that fires up at regular intervals (called "ticks"); this timer could forcefully pause any program and run a OS routine that decides which task should continue running next. This is called preemptive multitasking, and it's what modern OSs do.
But preemptive multitasking had some side effects in modern hardware. CPUs of laptops and mobile devices require inactivity to enter in low power modes. Preemptive multitasking fires the the timer often, 1000 times per second in a typical Linux kernel, even when the system is not doing anything, so the CPUs could not save as much power as it was possible. Virtualization created more problems, since each Linux VM runs its own timer.In 2.6.21, released in April 2007, Linux partially solved this: the timer would fire off 1000 times per second as always when the system is running tasks, but it would stop completely the timer when the system is idle. But this is not enough. There are single task workloads like scientific number crunching or users of the real-time pachset whose performance or latency is hurt because they need to be temporally paused 1000 times per second for no reason.
This Linux release adds support for not firing the timer (tickless) even when tasks are running. With some caveats: in this release it's not actually fully tickless, it still needs the timer, but only fires up one time per second; the full tickless mode is disabled when a CPU runs more than one process; and a CPU must be kept running with full ticks to allow other CPUs to go into tickless mode.
For more details and future plans, it's strongly recommended to read this LWN article: '(Nearly) full tickless operation in 3.10' and the Documentation.
Code: (merge commit)
원문이 좀 기네요.
내용을 간단히 설명하면 이렇습니다.
" 1초에 1000번씩 아무런 이유없이 깨어나서 뭔가를 해야하는 거 안하면 안되나요? "
" 1초에 1000번씩 일을 못하고 멈춰야 하는 것은 성능에 문제가 있습니다!!! "
네... 이런 등등의 이유로 idle 시간에 잠드는 걸로 만족하지 못하고 tick 자체를 없애기 위한 패치입니다만...
완전히 없앤것은 아니고 타이머가 필요는 합니다만 일초에 한번씩만 합니다.
완전히 tickless 는 CPU 가 두개 이상일 경우는 비활성화된다고 합니다
개인적으로 저는 이런 동작 모드가 필요하고 매우 좋아합니다만.....
그 구현의 복잡성을 생각하면 이 패치가 안정되어 활성화와 함께 배로 사용할수 있는 날이 오기를 기다리겠습니다.
패치 되었다고 여러분의 사용하는 시스템에서 바로 쓸수 있을 것이라고 생각하시는 분은 없겠죠?
인용문은 http://kernelnewbies.org 에서 가져왔습니다.