Hacker News new | ask | show | jobs
by cyberpunk 3361 days ago
Well, I was a bit dishonest there and you've called it.

Monitor/Link and Cast/Call are all built ontop of the regular message passing functionality of the language. The point I 'whitehat fibbed' to make stands though, python might be feasable as a syntax implementation but there's a _MASSIVE_ difference in the architecture of helloworld as a flask app and the same under cowboy; trying to get one to behave as the other makes no sense to me.

Implementing a python on beam makes no sense as to actually benefit from beam you'd need to write a lot of libraries to actually play with the environment and why would anyone bother?

And sorry but no, processes are not more or less threads. My laptop can do this:

     3> processes:max(250000).
     Max allowed processes: 262144
     Process spawn time=3.408 (15.644) microseconds
     Process teardown time=3.156 (1.552) microseconds
That created 250k procs then stored the pids of each in a list, then iterated though that list and killed those processes; I don't think you can do that with threads..

Preemptive scheduling is a big deal also.

1 comments

Yes, I know processes are different than threads, but the basic idea is similar -- a process is an execution context with its own stack and program counter and etc; so is a thread, but the etc differs. That python knows how to run in threads means it's at least got some of the basics that might enable it to run in multiple contexts, was my only point.

I agree that it would be a lot different architecture than a normal python application; but where there could be value, is if you wanted to write a distributed thing in python with all the nice properties you get from an erlang system, your choices now are either drop python (my preference!); write dist/otp yourself, but in python (hard, because how do you bolt on monitors, etc); write just enough erlang to coordinate python running as port commands (probably doable, but could be fragile).

I personally would love to run a little bit of perl on the beam, but i know it's crazy, so I don't mention it very often ;)

The "etc" is absolutely critical as it is shared memory: BEAM works the way it does specifically because it does not want to model shared memory, which means any implementation of threads over it will be an incredibly painful and certainly ludicrously slow simulation, and there is nothing in Python that really maps to the primitive BEAM offers.