Live data from Hacker News

Parallel – A command-line CPU load balancer written in Rust

github.com

61–65 of 65 posts

Re: Parallel – A command-line CPU load balancer written in Rust

#61
post #59

Earlier quoted context omitted.

Which proves my point. It's messy, inefficient and now you wrote code which is not composable as you have a global (and the only) signal handler.

I don't think it's less efficient than threads (but someone should test it!). It scales better. It's not composable, but it's not impossible to work around that if you can assume non-POSIX. Platforms with kqueue just get this right because kqueue can wait for processes. Linux will let you use a different signal to alert for process completion, so pick one of the realtime signals (which is its own game of global names…

[deleted]

Re: Parallel – A command-line CPU load balancer written in Rust

#62

Earlier quoted context omitted.

> The only thing you can do from a signal handler is flipping a static and only one signal handler can be set. This is false, you can call any async signal safe function. Incidentally write is one of them. Another trick is the close-on-exit pipe.

> This is false, you can call any async signal safe function. Incidentally write is one of them. Which malloc() is not. Anything that might internally allocate is out of the question. The list of functions that are safe to call in C alone is very limited and even then the question of errno arises.

why are you bringing up malloc?

Re: Parallel – A command-line CPU load balancer written in Rust

#63

Earlier quoted context omitted.

> This is false, you can call any async signal safe function. Incidentally write is one of them. Which malloc() is not. Anything that might internally allocate is out of the question. The list of functions that are safe to call in C alone is very limited and even then the question of errno arises.

why are you bringing up malloc?

Because you do not necessarily know which call will allocate memory in Rust and even in C it can be tricky. You literally can only go with the whitelisted functions.

Re: Parallel – A command-line CPU load balancer written in Rust

#64

Earlier quoted context omitted.

why are you bringing up malloc?

Because you do not necessarily know which call will allocate memory in Rust and even in C it can be tricky. You literally can only go with the whitelisted functions.

Yes, that's way you should, as I suggested, only call functions explicitly documented as asyc-signal-safe.

Re: Parallel – A command-line CPU load balancer written in Rust

#65
post #15

Not comparing it with the simpler, better moreutils parallel is really unfair.

I hope you wont take this the wrong way, but can you elaborate on why you feel Tollef's parallel (from moreutils) is better than GNU Parallel?

It was addressed elsewhere in the thread. My take is: 1/ it's written in C. 2/ it doesn't suffer from feature creep.

The code is 427 lines of C. GNU parallell is 10k+ lines of perl. Considering mmstick compares the loading times, it's easy to see where the difference comes from.

Post reply on HN