On Wed, 14 Jan 2004, Andrew Edwards (Olympic Shaver Centre) wrote: > Could anyone clarify the level of support for Pentium 4 hyperthreading > in 5.2? I understand that the kernel is now smp aware by default but > does it handle the logical cpu's of hyperthreading in the same manner as > it would a physical cpu? > > I ask as for the best part my machine rarely goes above 50% cpu > utilisation. However using -j2 when building the kernel or world for > example will give me nearer full use, which I can appreciate as it > generates concurrent processes that likely get divided over the two > logical cpu. > > Not being fully aware of the technical bits to hyperthreading is the > above scenario as good as it can be and is making good use of the cpu, > i.e if I run a single cpu heavy process, whereas without hyperthreading > I would see 100% usage now I only see around 50%. Part of the problem here is actually in the measurement -- when one hyperthreaded virtual CPU is idle, the other virtual CPU has more computational resources, and so will actually run faster. The FreeBSD kernel can only measure the utilization in terms of wall clock time, not underlying computational units, so it reports you have two CPU's, one idle, and one at 100% (i.e., 50%). In practice, you could easily be using 75% or more of the resources of the total silicon with your program. You might well not be able to utilize the full resources of the CPU without paralellism in your program, which would require writing the program to use parallelism (threading or multiple processes). Depending on the task, this may or may not be more efficient, since you may blow out shared cache resources with a larger working set, as well as paying the costs of synchronization. The real question is: do you get your work done faster from a wall clock perspective, and that depends on the workload and the efficiency of the FreeBSD kernel. We're working on making the FreeBSD kernel more efficient with SMP (one of the big goals for the 5.x branch), but it's definitely still a work in progress. If you just want to see 100%, you can disable hyperthreading so that the virtual CPU is simply kept idle the same as it might be now, but FreeBSD won't count it towards accounting. :-) Robert N M Watson FreeBSD Core Team, TrustedBSD Projects robert_at_fledge.watson.org Senior Research Scientist, McAfee ResearchReceived on Wed Jan 14 2004 - 10:09:56 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:38 UTC