Date: Tue, 12 Jun 2012 14:03:10 +0200 (CEST) From: Oliver Fromme <olli@lurza.secnetix.de> To: freebsd-stable@FreeBSD.ORG, momchil@xaxo.eu Subject: Re: ULE Scheduler Message-ID: <201206121203.q5CC3AA2002709@lurza.secnetix.de> In-Reply-To: <861ulkkflm.wl%momchil@xaxo.eu>
next in thread | previous in thread | raw e-mail | index | archive | help
Momchil Ivanov <momchil@xaxo.eu> wrote: > I was just curious why both processes are hopping around, > because I would naively think that should not happen. I'll try to explain ... There are always many more processes and threads being executed beside the two CPU-bound ones that you see at the top of the top(1) display. For example, there are at least 15 threads inside the kernel (see "ps -auxww") that are scheduled every now and then. Or look at "vmstat -i" output to see the interrupt statistics: Several hundred times per second, the interrupt handlers have to be executed. So, what happens is that an interrupt occurs (from a hardware clock, from a hard disk controller, from an input device, or anything else). Then your process is _removed_ from the core on which it is currently executing, and the interrupt handler starts executing. The same can happen on the second core at the same time, because different kernel threads can execute simultaneously (if they don't share resources). Now, if the interrupt handler on one of the two cores is done, your own process has a chance to be scheduled again. In this moment, it does not matter at all on which core it is going to be executed. The only difference is cache contents, but the first-level-caches are usually too small anyway. The ULE scheduler takes a lot of information into account when making the decision, including cache affinity (the 4BSD scheduler doesn't know about that at all). All of that happens several hundreds times per second. You don't have a chance to see it with a tool like top(1). > > Have you read Daniel Kalchev's reply in this thread? > > He explained very well why that's not a problem usually. > > No, I haven't received that one. Ok, I've appended it below. Best regards Oliver -------- begin of quoted text -------- From: Daniel Kalchev <daniel@digsys.bg> Subject: Re: ULE Scheduler Date: Thu, 7 Jun 2012 12:19:43 +0200 (CEST) Message-ID: <4FD07EA0.8020401@digsys.bg> On 07.06.12 11:16, Momchil Ivanov wrote: > Though, it was strange seeing both processes hopping around... I will > probably go back to the 4BSD scheduler if my laptop does another > self-shutdown in the next few days as Doug suggested. You never run just two processes on FreeBSD, ever. The kernel too runs multiple threads. However small the CPU usage of the other processes is, they must run from time to time, kicking out at least one of your CPU intensive processes, possibly kicking them out both, as well. When that happens, and they are queued to run again it does not matter much on which core they ran before, because chances are it's cache will be invalidated anyway. Also, different CPUs have different cache affinity. ULE is supposed to be aware of this, while the 4BSD scheduler is not. In any case, on an older single/dual core CPU there is rarely any difference between both schedulers. Differences might appear in modern multi-core CPUs.. Daniel -------- end of quoted text -------- -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M. Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung: secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün- chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd "What is this talk of 'release'? We do not make software 'releases'. Our software 'escapes', leaving a bloody trail of designers and quality assurance people in its wake."
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206121203.q5CC3AA2002709>