News for hackers. Stuff that matters.
Re:Windows 3.1 All Over Again by Lerc on Sunday September 24, 2017 @08:00PM (#15327173)
I tend to think of it as a pre-emption issue more than a concurrency or parralellism issue. Endless loops cause hangs. Being able to pre-empt things would solve a lot of the problem.

    10 print "mike is cool"
    20 goto 10
simply doesn't have a good analogue in javascript. Even in Web Workers a loop like that causes the worker to be unresponsive to events. The Shared Memory addition alows a rudimentary form of this by allowing a flag to make an aware program exit. It wouldn't be too hard to have a BASIC to worker compiler that compiled the above code to

    while (true) {
       print("mike is cool");
       if (shared_global_flag === true) break;
    }
There are a few javascript livecoding websites out there that update the code as you type. There is a problem with this. Broken (as half written code tends to be) javascript doesn't just fail to work, it breaks other things

for example

    var x=1;
    while (x<10) {
      output(x);
      x+=1;
    }
Typing this into a livecoding environment breaks because the while loop goes on forever until you type the code to increment x. It breaks everything because the while loop blocks you from being able to type the code that would get you out of the situation.

I don't see the wisdom of disaallowing something due to the specter of race conditions when its absence seems to cause a much easier to cause debilitating problem.

Re:Windows 3.1 All Over Again by greggman on Sunday September 24, 2017 @10:01PM (#15327597)
apparently codepen runs the code through a parser and inserts exit checks in all detectsble loops.

https://blog.codepen.io/2016/06/08/can-adjust-infinite-loop-...

Re:Windows 3.1 All Over Again by greggman on Sunday September 24, 2017 @10:04PM (#15327612)
as for why no races I think because it's basically impossible (or way too non performant) to write a JavaScript engine that can handle multiple threads deleting properties on objects. You'd have to lock on every delete.
Re:Windows 3.1 All Over Again by Lerc on Monday September 25, 2017 @12:29AM (#15328073)
That's the nature of JIT though, non-performant but working is ok for the bits that might cause trouble. JavaScript should just make fast the things it can.

I'd be ok for a light pre-emtion that would happen between javascript statements. Instead of genuain preemtion have the Javascript engine include break checks. A check of a flag and conditional branch (usually not taken) is not a huge expence. The cost can be especially ameliorated if you do the check only on statements that jump to earlier statements.

That fixes the problem of long running code stopping other things. It doen't need system level threads or parallelism, just a js engine doing spot checks.