suspected bug in timeout command

Rob Landley rob at landley.net
Wed Mar 2 06:01:39 UTC 2022



On 3/1/22 1:45 PM, Denys Vlasenko wrote:
> On Tue, Mar 1, 2022 at 6:52 PM Steffen Nurpmeso <steffen at sdaoden.eu> wrote:
>> David Laight wrote in
>>  <beb9e049aed1478a9b1ea22fac7af0a2 at AcuMS.aculab.com>:
>>  |From: Denys Vlasenko
>>  |> Sent: 01 March 2022 16:40
>>  |> On Tue, Feb 15, 2022 at 12:31 PM Rob Landley <rob at landley.net> wrote:
>>  |>> On 2/14/22 10:09 AM, Roberto A. Foglietta wrote:
>>  ...
>>  |> My memory is hazy on this, but IIRC kernel also actually has some
>>  |> defensive code to not immediately reuse pids which just died.
>>  |
>>  |The Linux krnel only has protection for code inside the kernel.
>>  |Basically there is a ref-counted structure that you need to send the
>>  |signal - not the pid itself.
>>  |I can't quite remember whether the pid itself can be reused even before
>>  |that structure is freed.
>>  |
>>  |NetBSD does guarantee not to reuse a pid for a reasonable number
>>  |of forks after a process exits.
>>
>> ...which might be fruitless with 16-bit pids, define "reasonable".
>> Matt Dillon of DragonFly BSD (crond etc.) made, after implementing
>> some DBSD kernel optimizations (iirc), tests with statically
>> linked programs and... quoting myself
>>
>>   i remember Matthew Dillon's post on DragonFly BSD users@[1], where
>>   he claims 450000 execs per second for a statically linked binary,
>>   and about 45000 execs per second for a dynamic one, with DragonFly
>>   5.6 on a threadripper.
> 
> What's relevant is how many fork's you can do per second. Not execs.

Back when Ingo Molnar was cleaning up the thread spawn/exit code in the kernel I
vaguely remember he benchmarked his last optimization pass at 2 million/second
on some big SMP system, but that was quite a while ago (I want to say 2004?) It
was the eventual follow-up to this line of optimization work:

https://lwn.net/Articles/8131/

Of course all those did was call clone() and immediately exit(), and it was
threads not processes so avoided most of the VM setup work and copying the file
descriptor table and so on. (And was before the current namespace stuff.)

Rob


More information about the busybox mailing list