On 7/18/18 1:58 AM, John Carter wrote:
On Friday, 13 July 2018 at 13:15:39 UTC, Steven Schveighoffer wrote:

But it doesn't scale if you use OS processes, it's too heavyweight. Of course, it depends on the application. If you only need 100 concurrent connections, processes might be OK.

I think you may have fallen for Microsoft FUD.

In the Early Days of Windows Microsoft was appalling Bad at multiple processes....

Rather than fix their OS, they cranked up their Marketing machine and Hyped threads as "Light Weight Processes".

Wikipedia [1] seems to have a lot of references to "Light weight processes" from Unixy sources. Seems more like a good definition of thread than FUD.

Unixy land has had "COW" (Copy on Write) page handling for years and years and process creation and processes are light weight.

That depends on how much memory has to be marked as COW. It's definitely more heavyweight than thread creation, which does none of that.

There are very very few Good reasons for threads, but threads being "light weight processes" is definitely not one of them

Interesting, but I wasn't talking about using threads, vibe.d uses fibers, and can scale much better than using processes or threads alone.

See dconf presentations from Vladimir Panteleev [2] and Ali Chereli [3] to see why I was drawn to this conclusion.

Besides, using processes if you are ONLY going to read from the shared state makes some sense, but as soon as you need to change the shared state, you need to devise some mechanism to communicate that back to the main process. With threads/fibers, it's trivial.

With web services, most of the time the shared state you want elsewhere anyway (to make it persistent), so it's a better fit for processes than most program domains.

-Steve

[1] https://en.wikipedia.org/wiki/Light-weight_process
[2] https://www.youtube.com/watch?v=Zs8O7MVmlfw
[3] https://www.youtube.com/watch?v=7FJYc0Ydewo

Reply via email to