[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#12738: 'sort' wastes cpu-cycles of all available cpus
From: |
Jim Meyering |
Subject: |
bug#12738: 'sort' wastes cpu-cycles of all available cpus |
Date: |
Fri, 26 Oct 2012 11:42:31 +0200 |
Schwidom, Frank wrote:
> In some situations sort wastes cpu-cycles of all available cpus.
>
> $ sort --version
> sort (GNU coreutils) 8.7
...
> but, if i use:
>
> # seq 1 1000000 | sort -n | less
>
> and while im not scrolling to the bottom in 'less'
> sort uses all cpus
>
> top:
> 9421 root 20 0 447m 109m 660 R 2295 0.9 3:12.72 sort
>
> in this case, sort is already done sorting (it took and sorted
> the whole input and 'less' displays values).
> but it takes a lot of cpu-cycles on all cpus.
>
> if i scroll to the bottom, 'less' takes all values of the sort output
> and sort will end; this is ok.
Thank you for the report.
However, your version of sort is quite old and
that bug was fixed almost two years ago:
(from "NEWS")
* Noteworthy changes in release 8.8 (2010-12-22) [stable]
** Bug fixes
sort with at least two threads and with blocked output would busy-loop
(spinlock) all threads, often using 100% of available CPU cycles to
do no work. I.e., "sort < big-file | less" could waste a lot of power.
[bug introduced in coreutils-8.6]
The latest release is coreutils-8.20.