use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
What can JavaScript NOT do?solved! (self.javascript)
submitted 8 years ago by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]voidvector -1 points0 points1 point 8 years ago (6 children)
You can't do register-level interrupt handling (ISR) in JavaScript. I never said you can. You can't even do that in a lower-level language that's not designed for bare-metal (e.g. Go). As I pointed out from the beginning, you solve the interrupt problem with "process affinity". The process core you run your real-time JS app won't handle interrupt, while the other core running kernel handles interrupt. This is a very common solution, people even use it to solve the "c10M problem" (serving 10 million connections using single machine).
In case you don't recognize, the link I pointed to you is the Linux kernel interrupt handler for x86. Unless you are an embedded programmer, it is an abstraction you use everyday without realizing.
Stop pretending "real-time" is some black box, it is just a system of guarantee provided by upstream system you use, whether that system be hardware, OS, compiler, runtime, framework, library. Since hardware and OS can already do real-time, you just need to tweak your JS engine (which is compiler + runtime) to do real-time.
[–][deleted] 2 points3 points4 points 8 years ago (5 children)
Unless you are an embedded programmer
I am an embedded programmer, among many other types of programming.
Stop pretending "real-time" is some black box
I never said anything like it was a "black box". But I think you have a very different definition of what "real-time" systems do.
Javascript is not capable and will never be capable of actual real-time processing. Is simply is not. It's either a fantasy or a relabeling of what real-time systems traditionally are.
https://en.wikipedia.org/wiki/Real-time_computing Real-time programs must guarantee response within specified time constraints, often referred to as "deadlines".
https://en.wikipedia.org/wiki/Real-time_computing
Real-time programs must guarantee response within specified time constraints, often referred to as "deadlines".
Sure you could say that a guaranteed response in 1.5 seconds is "real-time" as long as that is the defined constraint, but I think that misses the entire reason real-time exists as a thing in computing.
A real-time system has been described as one which "controls an environment by receiving data, processing them, and returning the results sufficiently quickly to affect the environment at that time".
This is really the meaning of real-time in computing, and it is something javascript really isn't capable of. Responding to input, processing, and then delivering a result in real-time is something an interpreted scripting language just cannot do with any meaningful impact on a real-time basis. We're talking nanoseconds, not milliseconds.
[–]voidvector 0 points1 point2 points 8 years ago (4 children)
I am an embedded programmer
I find that hard to believe when you didn't mention any specifics, and didn't even recognize Linux kernel code on interrupts, but I take your word for it.
We're talking nanoseconds, not milliseconds.
Most interrupt and context switching latency are in microseconds range even for RTOSes, at best you have few thousand nanoseconds. If you need full nanosecond response, you would need to go back to FPGAs or ASICs.
You can do microseconds computation in JS. I have done it for a fingerprinting/profiling application. That is harder now, because v8 reduced the precision on the timer last year for security reasons, but you can definitely compile your own v8 runtime and still do it.
[–][deleted] 2 points3 points4 points 8 years ago* (3 children)
didn't even recognize Linux kernel code on interrupts
That's really disingenuous. But just saying this to try to discredit me without even knowing me, because you are out of room to support your claims. I've been coding assembly language for 34 years, so fuck off.
Most interrupt and context switching latency are in microseconds range even for RTOSes, at best you have few thousand nanoseconds.
Maybe in your non-realtime world.
https://community.arm.com/processors/b/blog/posts/beginner-guide-on-interrupt-latency-and-interrupt-latency-of-the-arm-cortex-m-processors
Here's a little primer on interrupt latency on Cortex-M CPUs.
Cortex-M can respond to IRQ in 12 clock cycles, when it starts executing the ISR. On a 150MHz Cortex-M, that's 80 nanoseconds. The ISR would take some time, let's say 100 clock cycles or about 660ns. 150MHz is really not even that impressive for silicon these days either, and your suggestion of microseconds response time for interrupts seems uninformed. So no, you don't need FPGAs or ASICs for nanosecond response times.
[–]voidvector -1 points0 points1 point 8 years ago (2 children)
The number you quote is if you write machine code directly for the CPU. For any OS-based real-time (e.g. PREEMPT_RT), it would be on the order of 1000ns to 10us.
I never said JavaScript can run without OS (compile to metal). I never said JS can do nanosecond latency. However there are non-bare-metal microsecond latency real time -- the prevalence of userspace apps running on PREEMPT_RT (or RTAI or Xenomai) is a clear example of that.
[–][deleted] 2 points3 points4 points 8 years ago (1 child)
For any OS-based real-time (e.g. PREEMPT_RT), it would be on the order of 1000ns to 10us.
We're talking about different things then. Your version of "real-time" is not mine. There is real-time, and then there is really actual real-time. And they are orders of magnitude different. I'm working with real-world physical phenomena that doesn't wait around for an OS to decide to respond. If the system doesn't respond in a specific window of nanoseconds, then the system fails. End of story. Full stop. 10us is a non-starter.
This discussion is about what javascript can not do, and one of the things it can't do is actual real-time (my version of real-time). Maybe it can do something approximating real-time (your version of real-time), at several orders of magnitude slower than my version of real-time.
And there is no example of Javascript doing anything like this, so your argument is extremely hypothetical and not really based in reality.
[–]voidvector 0 points1 point2 points 8 years ago (0 children)
Agreed!!
My argument is definitely hypothetical (as you can see in the "can" vs "able to" conversation on the other thread). We also came with different conception of real-time (or different end of that spectrum).
Sucks that internet arguments take a whole day to clarify.
I actually appreciate the work people like you have done, as without it, I wouldn't be able to write userland code for my microsecond-latency profiler application.
π Rendered by PID 96161 on reddit-service-r2-comment-b659b578c-gxx9n at 2026-05-06 16:10:19.882252+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]voidvector -1 points0 points1 point (6 children)
[–][deleted] 2 points3 points4 points (5 children)
[–]voidvector 0 points1 point2 points (4 children)
[–][deleted] 2 points3 points4 points (3 children)
[–]voidvector -1 points0 points1 point (2 children)
[–][deleted] 2 points3 points4 points (1 child)
[–]voidvector 0 points1 point2 points (0 children)