TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Erlang's not about lightweight processes and message passing

543 pointsby stevanover 2 years ago

34 comments

rvirdingover 2 years ago
OTP came much later than the design of the language.<p>The language was designed around our I ideas of what the problem really was and the best way of solving it. The massive and extremely lightweight concurrency were a critical part of attacking the problem which was&#x2F;is extremely concurrent. There are an enormous number of things going on in a switch which have to be handled concurrently, sometime over 10k calls plus running the switch. So the concurrency was fundamental. The error handling primitives were of course also a a critical part of the solution as fault tolerance was a critical part of the problem.<p>A lot of effort went in to working out what the concurrency and error handling should look like to be right for how to attack the issues and solve the problems. Fortunately we worked with a user group looking at designing a new architecture who tested using our ideas and came with extremely important feedback on the ideas, what was good or bad or just not necessary. They then became the first group to build a product using Erlang. It didn&#x27;t use OTP as it didn&#x27;t exist then.<p>OTP came later and is “just” a formalised, generic wrapper around these ideas. We had client-servers, state machines and the equivalent to supervisors in products before OTP was developed. Behaviours came with OTP. And in the beginning there were many different versions of OTP alive at the same time.<p>Behaviours could not have been developed as they are without lightweight processes and communication. OTP is of course fundamnetal to the distribution and use of the language as it does encapsulate most of of our original ideas in how Erlang should&#x2F;could be used to build systems.
评论 #34558886 未加载
评论 #34579490 未加载
hoshover 2 years ago
I think it is misleading to frame this as &quot;behavior&quot;. I think what we really have are battle-tested concurrency patterns, which then uses the language feature called &quot;behavior&quot; to implement. This collection of battle-tested concurrency patterns that has been in use for a long time, in a variety of settings, is called OTP. It&#x27;s why you&#x27;ll hear long-time Erlang folks talk about how, it&#x27;s really about OTP.<p>You can implement those same patterns, if you also have lightweight processes, messages, and message queues. There&#x27;s a Rust library that aims to do exactly that. The new WASM runtime (Firefly, formerly known as Lumen) aims to bring those patterns into the WASM ecosystem, potentially using this kind of concurrency pattern client-side.<p>What&#x27;s potentially novel is adding in newer concurrency patterns that are in use in the Kubernetes community -- use of selectors, services, scaling with replicasets -- so that, instead of a static supervision tree, it can be a dynamic supervision tree, spread out across the entire pool, even as that pool expands or shrinks.
评论 #34550649 未加载
评论 #34550174 未加载
评论 #34551151 未加载
评论 #34556160 未加载
评论 #34548535 未加载
finder83over 2 years ago
There&#x27;s a component that seems to be missing here which is preemptive task scheduling. I&#x27;ve not seen another non-OS system do it like the BEAM VM (the VM behind Erlang), though there may be something I&#x27;m not aware of. It really prevents a whole class of concurrency issues where a hung process can freeze or slow down the entire system.<p>For example, if you recreated gen_server in a cooperative concurrency environment, one gen_server could use up all of the CPU and have an impact on the performance of the rest of the system. Maybe the other threads (microthreads, not OS threads) would still respond in &lt;500ms, but if every request takes 500ms when they normally take 15ms you could essentially have outage-like conditions, particularly with upstream timeouts.<p>Instead, because BEAM is preemptive that one (or 10) hung gen_server doesn&#x27;t hang up everything else on a node. Sure at some point performance will degrade, but that point is much further down the line than in cooperative concurrency models. There was a fantastic talk by Sasa Juric that demonstrates this in Erlang. [1] Otherwise you run a higher risk of even the supervisors being starved for CPU time, particularly if you are launching hundreds of processes that are all locking the CPU.<p>It&#x27;s really the combination of the behaviors (OTP), the scheduler, lightweight threads, message passing, and immutability to me that makes the Erlang (Elixir for me) concurrency model so appealing.<p>Creating a language with the feel of a lisp, the environment of Smalltalk, and the concurrency of Erlang has been my dream for a long time.<p>[1] <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=JvBT4XBdoUE">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=JvBT4XBdoUE</a>
评论 #34550206 未加载
评论 #34555659 未加载
评论 #34551142 未加载
评论 #34552639 未加载
评论 #34550156 未加载
评论 #34549902 未加载
评论 #34556033 未加载
sb8244over 2 years ago
&gt; just like the concurrent code of gen_server<p>I found this a really interesting read, but this stuck out because it doesn&#x27;t jive with my mental model of gen_server.<p>gen_server is fully serialized. Even the code underpinning it is not concurrent.<p>Now I guess gen_server does expose some top level functions to simplify sending&#x2F;receiving a message into the process, but the process itself is serial.<p>And this is part of the genius of gen_server to me. You don&#x27;t need to think about your state concurrently because it processes a single message at a time. Your system executes concurrently, but the individual components do not.<p>Maybe that is what the post means and I misinterpreted it.
评论 #34547833 未加载
评论 #34547413 未加载
评论 #34548206 未加载
评论 #34556086 未加载
dmitriidover 2 years ago
The main insight is in Joe Armstrong&#x27;s thesis. &quot;Making reliable distributed systems in the presence of software errors&quot; <a href="https:&#x2F;&#x2F;erlang.org&#x2F;download&#x2F;armstrong_thesis_2003.pdf" rel="nofollow">https:&#x2F;&#x2F;erlang.org&#x2F;download&#x2F;armstrong_thesis_2003.pdf</a> (I think the original title was &quot;In the presence of <i>hardware</i> errors&quot;, emphasis mine)<p>All the other things flow from that thesis and understanding. You can recreate behaviours described in the repo doc using Erlang primitives very easily, and they are very hard to recreate in pretty much any other language.<p>Because Erlang is very much literally about lightweight processes and message passing. Only:<p>- every part of the system knows about lightweight processes and messages<p>- every part of the system is engineered around them<p>- the underlying VM is not only re-entrant in almost every single function, it&#x27;s also extremely resilient, and can almost guarantee that when something dies, only that process dies, and the rest of the system receives a guaranteed notification that this process dies<p>There are more, but without at least that you can&#x27;t really recreate Erlang&#x27;s standard behaviours. For example, you can&#x27;t recreate this in Go or Rust because `panic` will kill your entire program unconditionally.
评论 #34546019 未加载
评论 #34545930 未加载
评论 #34545861 未加载
评论 #34545807 未加载
评论 #34545715 未加载
mapcarsover 2 years ago
As someone who worked with Erlang for a few of years I still wonder if using parallel processing in program top level is worth it or not. Because there are many ways to process data efficiently using queues, pipelines, etc and being clear on when it happens rather than a &quot;wild west&quot; of Erlang where you need to manage processes, links, restarts, and it&#x27;s harder to focus on the business logic.
评论 #34546755 未加载
评论 #34546533 未加载
评论 #34554263 未加载
matthiaslover 2 years ago
Not important to the conclusion or reasoning... but Stevena&#x27;s post says:<p><pre><code> &quot;the whole team working on Erlang quit and started their own company.&quot; </code></pre> The same event as described in &quot;A history of Erlang&quot;:<p><pre><code> &quot;In December, most of the group that created Erlang resigned from Ericsson and started a new company called Bluetail AB.&quot; https:&#x2F;&#x2F;www.labouseur.com&#x2F;courses&#x2F;erlang&#x2F;history-of-erlang-armstrong.pdf </code></pre> &#x27;most of the group that _created_ Erlang&#x27; is not the same thing as &#x27;the whole team _working_ on Erlang&#x27;. Or, quantifying it, at the end of the &#x27;history&#x27; paper, there&#x27;s a list of 45 people under &#x27;implementation&#x27; and &#x27;tools&#x27;. Around 35 were at Ericsson in 1998. Of those, nine or ten quit to form Bluetail, and another two or three left for Bluetail later on.<p>(In 1998, there were two connected groups working on Erlang in the same building in Älvsjö, Stockholm. One was the computer science laboratory (CSLAB), where Erlang was <i>created</i>, the other was &quot;Open Systems&quot;, which had more of a development role. A significant part of CSLAB left. Almost all of &#x27;Open Systems&#x27; stayed. Many that stayed were already doing a stellar job on Erlang and many still are.)
评论 #34556965 未加载
revskillover 2 years ago
What i learn from Erlang, is, naming is hard.<p>What does `gen` mean in `gen_server` ?<p>Thanks for replies for &quot;Generic&quot;. So this article is not well organized in that case. With some simple naming explanation, it should be obvious to guess what the system does.<p>Abbreviation doesn&#x27;t save the writings.<p>Some more examples, in Ruby, instead of calling `implement Module`, it uses `include Module` . I do think include is not as clear as implement.
评论 #34546322 未加载
评论 #34546382 未加载
评论 #34551680 未加载
评论 #34560290 未加载
评论 #34546230 未加载
评论 #34546415 未加载
评论 #34546231 未加载
评论 #34546235 未加载
valenterryover 2 years ago
&gt; The application programmer writes sequential code, all concurrency is hidden away in the behaviour;<p>Yeah, until the business problem itself involves inherent concurrency, which usually happens much faster than people think. Or until I, as the non-expert, want to dig in to make changes or debug a problem.<p>This distinction into &quot;expert&quot; and &quot;lowlife (SCNR) using the expert abstractions&quot; is really one that doesn&#x27;t hold in practice most of the time.<p>I think it&#x27;s much better to embrace that concurrency is a cross-cutting-concern and reality is that it can happen on <i>any</i> level, so the language should better support reality.
评论 #34546985 未加载
practalover 2 years ago
Very interesting read. Also very timely for me (I am always amazed how HN often has posts that resonate strongly with what I am currently doing), as I am just now designing a programming language based on a generalisation of Algebra, which I call Abstraction Algebra. I think there is a strong connection to this post: Behaviours are just an abstraction algebra you program against. Switch out the algebra implementation against another one, and you can adapt the same program to different scenarios without changing the program itself.
评论 #34547592 未加载
评论 #34547158 未加载
评论 #34557593 未加载
adamddev1over 2 years ago
&gt; In 1998 Ericsson decided to ban all use of Erlang.<p>Does anyone know why?
评论 #34545884 未加载
评论 #34547481 未加载
评论 #34546221 未加载
评论 #34545836 未加载
lll-o-lllover 2 years ago
Fascinating! Long ago I came to the conclusion that multithreaded applications in the sense of shared memory protected by locks was simply too difficult for humans to reliably work with. As a result, it turns out I reinvented erlang behaviours in C++ (along with light processes and message passing in the form of Queues and Threads). I may have been influenced by erlang at the time. All of the behaviours listed were replicated. Convergent design I suppose.<p>So, you can probably create erlang behaviours in any language, but it requires building a framework and then training every developer in how to use it. There is probably value in having a standard version of erlang behaviours for a range of different languages.
评论 #34554564 未加载
notamyover 2 years ago
&gt; Please don&#x27;t share this repo or any of the linked to documents or repos just yet!<p>Oh no :P<p>Very interesting read though, thanks for sharing!
评论 #34545668 未加载
评论 #34545642 未加载
dominiclover 2 years ago
IMHO the differentiator is deeper yet everywhere engrained in OTP&#x2F;Behaviours and the famous &quot;Let it crash&quot; slogan. It is the OS-Style process and resource isolation. That is something you can&#x27;t port with a library into a language that doesn&#x27;t have it built-in. Lightweight processes, are not the same if they can crash each other, or messup some shared objects&#x2F;resources&#x2F;...<p>You can implement actor behaviours in go or node or even c, but without that lower level support it will never give you the stability guarantees that Erlang process isolation is giving.<p>To draw a weird comparison Elixir (with Erlang process isolation) brings two world together. First it&#x27;s a PHP&#x2F;Ruby level of fire-and-forget productivity because each http request is handled in an independent isolated process, which if it crashes won&#x27;t affect the system, but instead provide automatically a nicely debuggable crash log. And second it provides natively all distributed tools for long-lived systems. E.g. PubSub , Sessions and database connections don&#x27;t have to be rebuilt like in ruby&#x2F;PHP on a per request basis but can be their own long-lived processes.<p>If there would be a library that could bring this easy to use process isolation+communication e.g. to C programming it would be a game changer. But the best you get in all other languages I&#x27;m aware of is to use actual process isolation (fork multiple node&#x2F;ruby&#x2F;go processes) and then use some kind of IPC manually or redis or k8s...
jb3689over 2 years ago
To me the real amazing thing about Erlang is more the fact that these patterns based on queues and messages and supervisors scale so well. They are easy to implement on a small, single node application. You can compose them. You don&#x27;t need to complete reauthor your calls to start distributing them and fanning out responsibility across your nodes because you&#x27;ve been doing RPCs from the start. A multi-node application is not that much more difficult to reasonable than a single-node application
JustSomeNobodyover 2 years ago
I get that this is probably written for people familiar with Erlang, but a quick suggestion if I may:<p>In the Behaviors section you talk about behaviors being similar to interfaces in Go and give a Go example. But then you switch examples for Erlang. Maybe show the Joe&#x2F;Mike example written in Erlang and <i>then</i> say, here&#x27;s a more complicated example (the key-value example) that really describes behaviors better.
jerfover 2 years ago
There is a very common pattern in the world where people conflate <i>goals</i> with <i>results</i>. Of course, when I say that, it&#x27;s obvious that the two things aren&#x27;t the same, but the unexamined assumption that they are the same sneaks in anyhow when you aren&#x27;t looking, a cognitive shortcut hard to catch yourself making and harder yet to get in front of and deal with.<p>In the light of this statement, the answer to what I think is the thesis question of that entire piece:<p>&quot;This begs the question: why aren&#x27;t language and library designers stealing the structure behind Erlang&#x27;s behaviours, rather than copying the ideas of lightweight processes and message passing?&quot;<p>Is that while Erlang has a lot of good <i>goals</i>, the <i>results</i> of how they got there are simply not the state of the art. Or, to put it another way, language designers are not copying Erlang, and they are <i>correct</i> to not copy Erlang.<p>I respect Erlang a lot. They were a good 10-15 years ahead of their time. However, you will note that if you add 10-15 years to the creation date of Erlang, you still end up in the past. If Erlang were to come out today, fresh, nobody had seen it before, into an otherwise identical programming language environment, I would say it makes several mistakes.<p>One I&#x27;ve written about before is that Erlang is a non-Algol language for no reason: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7277957" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7277957</a> (Note the library mentioned in that post, suture, is now mature, and I use it all the time. It works for what I need.) But in the context of this post, that&#x27;s less critical.<p>The other major mistake I&#x27;d say it made if it came out in 2023 is that it is a totalizing environment. By that I mean that it has this built in implicit assumption that it is responsible for all the reliability in the system, and you don&#x27;t get Erlang&#x27;s features very conveniently if you don&#x27;t use it as the complete control backplane for your entire system. You run an Erlang cluster, and it bundles all the message passing, restarting, reliability, cluster management, software deploy, and everything into one system.<p>But for the world we live in today, that&#x27;s a price not worth paying. We don&#x27;t need the Erlang message bus to be the only message bus. The Erlang message bus is, frankly, not very good, and it&#x27;s actively terrible if you want to use it for one non-Erlang process to communicate to another. We don&#x27;t need the Erlang message bus. We have a dozen message busses, some in the cloud, some commercial, some open source, some that double as retention (Kafka), all of which scale better, none of which tie you to Erlang&#x27;s funky data types.<p>And then, within the matrix of those message busses, we don&#x27;t need Erlang&#x27;s restart capability. We have an abundance of ways to restart processes, from systemd, to kubernetes, to any number of other ways.<p>We don&#x27;t need Erlang clusters for redundancy any more. You just run multiple copies of a service against the message bus, on multiple systems for redundancy.<p>We don&#x27;t need Erlang&#x27;s behaviors. We have interfaces, traits, object orientation, and even just pushing that entire problem up to the OS process level, or writing a cloud function, and any number of ways of achieving the same goal.<p>Erlang&#x27;s software deploy is interesting, but we have a lot of options for it. The whole attempt to do live updates is interesting, but it also imposed a lot of constraints that systems that don&#x27;t have that need, which is the vast majority of them, don&#x27;t need or want. This is perhaps the space where the state of the art isn&#x27;t that far ahead of Erlang. It&#x27;s still a mess, despite all the churn in this space. But even so, with all the options available, you can probably find something better for your system than the Erlang way of upgrading software, even if it isn&#x27;t necessarily much easier.<p>The cognitive hazard that Erlang presents the community in 2023 is that it has some very good writing on the topic of reliability and its other goals, and then, naturally, one segues into the discussion of how Erlang solved the problem. And it was a very interesting solution for the time. I used Erlang for many, many years back when it was effectively the only solution to these problems.<p>But it isn&#x27;t the only solution anymore. The space has exploded with options. Unsurprisingly, the ones that a highly innovative pioneer tried out first are not the best, or the only. They chose well. Let me again emphasize my respect for the project. But it&#x27;s not on the cutting edge anymore.<p>Granted, the diversity of options does mean the real world has gotten quite chaotic, where you may have three message busses attaching systems implemented in a dozen different languages, but that&#x27;s something you can take up with Conway&#x27;s Law. Erlang couldn&#x27;t work with Conway&#x27;s Law without totally converting your entire company to it, which just isn&#x27;t going to happen.<p>The reason why language designers aren&#x27;t rushing to copy Erlang is that what was excellent and amazing in 2000 (and, again let me underline, I mean that <i>very seriously</i>, it was a cutting edge platform built with a lot of vision and moxie) is, in 2023, mediocre. Erlang is a mediocre language (Elixir is at least &quot;good&quot;, Erlang is mediocre), attached to a mediocre message bus, with a type system that doesn&#x27;t even reach mediocre, with a mediocre totalizing approach to system design where there&#x27;s a very significant impedence mismatch between it and the rest of the world, with an at-par-at-best VM (I won&#x27;t call that mediocre, but where it used to be head-and-shoulders above everything else in certain ways, it is now merely competitive), with mediocre standard libraries, and a mediocre product fit to its own stated goals. It just isn&#x27;t the best any more.<p>The state of the art right now is super chaotic. I can hardly get two systems deployed on the same infrastructure any more, because there&#x27;s always some reason <i>something</i> in that list has changed. But when the chaos settles and best practices emerge, something that I&#x27;d say is at <i>least</i> a good 5 years away, the result will clearly have Erlang inspiration in it for sure... but it won&#x27;t look a lot like Erlang on the surface.<p>What is worth copying has largely been copied. It doesn&#x27;t look exactly like Erlang, but this turns out to be a <i>good thing</i>.
评论 #34546250 未加载
评论 #34548091 未加载
评论 #34546551 未加载
评论 #34548414 未加载
评论 #34549623 未加载
评论 #34549290 未加载
评论 #34546442 未加载
评论 #34552261 未加载
评论 #34546876 未加载
评论 #34547475 未加载
评论 #34546816 未加载
评论 #34548900 未加载
评论 #34547322 未加载
评论 #34547004 未加载
brudgersover 2 years ago
I agree with the headline because uptime was the goal of Erlang.<p>Lightweight processes using message passing is how Erlang stays up (and perhaps ironically, let-it-crash is how Erlang avoids going down).<p>Lightweight processes and message passing are the architectural decisions that address the business problem Erlang was designed to solve.
natdempkover 2 years ago
Relevant, I’ve written a bit about the various actor models here including Erlang under process-based actors: <a href="http:&#x2F;&#x2F;dist-prog-book.com&#x2F;chapter&#x2F;3&#x2F;message-passing.html" rel="nofollow">http:&#x2F;&#x2F;dist-prog-book.com&#x2F;chapter&#x2F;3&#x2F;message-passing.html</a>
评论 #34546294 未加载
jFriedensreichover 2 years ago
It makes me sentimental to see some erlang code, truly miss writing erlang, as its probably the closest to how i think about systems. But it is so hard to justify using it when most of my problems can be solved with javascript edge workers. These days it&#x27;s rare for me to even come across a backend heavy project, yet something that would fit perfect to erlang. Does anyone else fell this way or is it because of my drift in the industry? When was the last project you started and thought this is perfect to solve with erlang?
评论 #34550932 未加载
ComputerGuruover 2 years ago
I don&#x27;t mean to disparage the article (quite the contrary, it&#x27;s quite the eye opener if you&#x27;re not accustomed to architecting your code in this fashion) but choosing go of all languages to mockup the ideas was a terrible choice. It&#x27;s syntax and type system are really quite the red-headed stepchild and for anyone unfamiliar with its syntax, its incredibly hard to make heads or tails of.<p>(And I say this as someone that&#x27;s at least passably familiar with go and have worked on&#x2F;contributed to golang projects in the past.)
评论 #34549888 未加载
评论 #34551219 未加载
samsquireover 2 years ago
I wrote a multithreaded message passing system in Java and I was trying to get async await to work<p>The thing I want to define with behaviours is observable effects on objects.<p>Such as interactions between tasks and objects between them. Not necessarily method calls but state interactions across multiple objects.<p>Some objects should be colocated on threads and send behaviours to arbitrary groups of objects. Think of it as a collection that responds to events.<p>I wrote a state machine serialization that looks like this. This defined a state progression between threads and async&#x2F;await state machine.<p>I think organised state machines would mean actor programming is so much easier to program.<p><pre><code> next_free_thread = 2 task(A) thread(1) assignment(A, 1) = running_on(A, 1) | paused(A, 1) running_on(A, 1) thread(1) assignment(A, 1) thread_free(next_free_thread) = fork(A, B) | send_task_to_thread(B, next_free_thread) | running_on(B, 2) paused(B, 1) running_on(A, 1) | { yield(B, returnvalue) | paused(B, 2) } { await(A, B, returnvalue) | paused(A, 1) } | send_returnvalue(B, A, returnvalue) </code></pre> I think this serialization is truly powerful and easy to understand.
eternalbanover 2 years ago
J2EE could have had all that but it was missing an OTP. [Java got the competing &#x27;application server&#x27; vendors competing themselves out of a massive market.] Components with well defined life cycles, request&#x2F;reply and message processing, dynamic remote interface binding, isolated execution environment, pure single threaded application level code (&#x27;business logic&#x27;), declarative composition ... that&#x27;s all in the specs.<p>Erlang is mainly about OTP. OTP delivered an opionated take on distributed components -- think of <i>Erlang on</i> OTP as <i>Ruby on</i> Rails -- and did it exceptionally well.<p>But one could still do this with Java btw. The specs are still there and they are solid.
peoplefromibizaover 2 years ago
Erlang isn&#x27;t, but the BEAM is.
评论 #34549777 未加载
worthless-trashover 2 years ago
One thing I like about &quot;behaviours&quot; is that I can immediately recognise, discard boiler plate, skim quickly, and see the difference from expected pattern just by knowing the behaviour that the process implements.
divs1210over 2 years ago
Without those lightweight processes that process messages sequentially from their inbox these behaviors won&#x27;t give the same concurrency guarantees.<p>I don&#x27;t know why the author is turning this into a competition of whether processes are more important or behaviors - they both are parts of a well designed system that work well together.<p>GenServers etc can&#x27;t be written equivalently in Go&#x2F;Java since goroutines and Java threads (even the new virtual threads) are not pre-emptive, whereas Erlang processes are truly independent.
ameliusover 2 years ago
Isn&#x27;t Erlang&#x27;s model a giant ball of microservices?
评论 #34547473 未加载
xwowsersxover 2 years ago
&gt; In 1998 Ericsson decided to ban all use of Erlang.<p>What&#x27;s the story there? Why did they decide to ban it?<p>EDIT: doh, this has been answered elsewhere in this thread.
throwawaymathsover 2 years ago
Wait till this person learns about links, monitors, call&#x27;s default automatic backpressure mechanism, etc...
lippingoffover 2 years ago
This is fucking cool, thanks for sharing
peter_d_shermanover 2 years ago
&gt;&quot;The next interesting behavior is supervisor. Supervisors are processes which sole job is to make sure that other processes are healthy and doing their job. If a supervised process fails then the supervisor can restart it according to some predefined strategy.&quot;<p>This is an interesting software pattern -- especially applied to having it entirely supported entirely inside of one programming language... We see this software pattern in such things as Windows Services (they restart automatically if they fail), Unix&#x2F;Linux daemons, as one of the original purposes of the original Unix &#x27;init&#x27; process, and in high-availability, mission-critical 24&#x2F;7 systems (databases, etc.).<p>Having all of that fault-tolerant infrastructure entirely inside of a programming language is indeed, somewhat novel.<p>But let&#x27;s work up what a given language must have as prerequisites to support this...<p>First, we need the ability to run multiple processes inside of a language. Many languages can accomplish this with threads, but of the languages that do this, many need additional cumbersome programming to guarantee thread safety...<p>So the language needs to support the notion of a threaded process inside of that code -- without having to code extra to support this threaded process.<p>Next, the language needs some form of communication between supervisor (process A) and supervised (process B) code. Message passing is the solution -- but that requires each process to have its own message queue.<p>And message passing requires interfaces...<p>Here we&#x27;re starting to sound like we&#x27;re duplicating a mini Operating System inside a language(!) (should the language have pipes, too?) -- and&#x2F;or that the complexity of most OS&#x27;s would be deeply mitigated by designing them inside of a language that supported these constructs...<p>Whatever the case, I think it&#x27;s a fascinating software pattern.<p>Yes, Go exists and supports features like this, Rust exists, and people are using it to write Operating Systems. And there are probably all other kinds of languages (both existing and existing in the future) that do&#x2F;will support some form of these constructs...<p>But there&#x27;s another interesting, purely academic, purely theoretical question here...<p>That is: <i>What is the simplest full-featured OS (processes, IPC, synchronization primitives, memory management, hardware resource management, syscalls, scheduling, etc.) that could be written in the smallest amount of lines of code if the language it was written in had intrinsic knowledge of all of those underlying constructs?</i><p>Anyway, a fascinating article about Erlang, and it definitely gave the impression that Erlang was a whole lot more than I thought it was... I will be checking out Erlang for future projects!
评论 #34555336 未加载
lippingoffover 2 years ago
This fucking rocks, great work and thanks for sharing.
cradover 2 years ago
Erlang vs OTP
didipover 2 years ago
These days, if you have Kubernetes, queues, and worker queues, does OTP still have an edge?
评论 #34551072 未加载
评论 #34558209 未加载
评论 #34551070 未加载
评论 #34549782 未加载