在Linux下,有没有比C语言延迟更低的语言? (除了汇编器)
我一直在研究各种语言(主要是函数式语言),它们在吞吐量和并发性方面具有巨大的潜力。然而,对于延迟敏感的应用程序(我的意思是响应小于 1 毫秒的事件的潜力)似乎超出了它们的范围。
我可以用 C 语言做到这一点,但我想知道是否有任何东西可以提供低延迟和高并发性,或者它们(正如我怀疑的那样)是相互排斥的吗?
注意:在上一个问题中,对“互斥”位进行了很多讨论 - 但我认为它是正确的 - 如果您需要极低的延迟,则无法获得大量并发。我绝对希望在这一点上被证明是错误的! :-)
I've been looking at various languages (mostly functional) that offer some great potential for throughput and concurrency. However, for latency sensitive applications (by which I mean the potential to respond to an event < 1ms) seems to be beyond them.
I can do this in C, but I was wondering if anything had come along offering low latency and high concurrency, or are they (as I suspect) mutually exclusive?
Note: In a previous question there was a lot of discussion over the "mutually exclusive" bit - but I think it stands - if you need extremely low latency, you cannot get massive concurrency. I would absolutely love to be proven wrong on this! :-)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
C 和 asm 之间的差异不太可能成为响应延迟的主要因素。毕竟,在到达您的代码之前,系统必须首先在 Linux 内核中运行相当多的 C 代码,以便在您的进程中进行调度。您最好执行一些操作,例如打开线程中断处理程序、设置实时优先级以及禁用可能导致系统管理模式陷阱的 BIOS 功能。
The difference between C and asm is unlikely to be a major factor in response latency. After all, before reaching your code, the system will have to run a fair bit of C code in the Linux kernel first, in order to schedule in your process. You'd be better off doing things like turning on threaded interrupt handlers, setting real-time priorities, and disabling BIOS features that may cause system-management-mode traps.
你所说的延迟是什么意思? C 只不过是便携式汇编程序。大多数 C 指令直接映射到处理器指令。与其他语言相比,C 的开销非常小。如果您指的是 DSP 编程中的延迟,您可能需要检查输入和输出时间,而不是处理本身。
What do you mean by latency? C is not much more than portable assembler. Most C instructions are directly mapped to processor instructions. C overhead is very minimal, compared to other languages. If you mean latency as in DSP programming, you probably need to check input and output times, not processing itself.
Erlang 似乎是大佬们用来做这样的事情的语言。
Erlang seems to be the language that the big guns use for stuff like this.