http://qs321.pair.com?node_id=809088


in reply to Re^3: Standard way to convert timezone in multithreaded script
in thread Standard way to convert timezone in multithreaded script

The security concerns you name are completely irrelevant. Any user who can execute code can hog all cores of a system, any time they want to, by starting processes that do so (unless you restrict them with something like ulimit, which works just as well on threaded processes). The kernels job is to keep the system running responsive enough so that other user processes and the system in general run well. Try running the line I sent, it'll work on a single-core system just as well. If you're running a reasonably modern version of Linux you may experience some slowdown on certain other applications, but your system should not grind to a halt, nor show real signs of unresponsiveness. That's the kernel doing its job, no reason to panic, business as usual.

So all the talk about hijacking, injecting etc. completely misses the point of a multi-user system, yes you can do all these things with threads (if you're root), just as you could with processes. But no, it isn't a problem (if it were, by your reasoning, system security would be impossible on a single-core machine). The kernel only allows you as much access as the system policy dictates, and the system administrator sets system policy. You may have a point that multi-threaded apps can make things harder for the system administrator by obscuring what they're doing, because most Linux tools are built primarily with the multi-process model in mind. But, honestly, in over a decade of sysadmining multi-user systems I have never found this to be a problem.

BTW, the nodes you link to aren't really pertinent to a discussion about threads vs. processes today, they're from 2003 (only the last one, which contains very little helpful discussion on the topic, is from 2006), a time when most people were still running Perl 5.6 and (if on Linux) a 2.4 kernel. Lots of things have changed since then, and any serious discussion on the topic would have to take these changes into account (I have no desire to hold such a debate, I find it pretty pointless).


All dogma is stupid.