Martin Sústrik

250bpm.com · Personal blog · on HN since 2011

Martin Sústrik, the main author of ZeroMQ, writes about C versus C++, structured concurrency, networking, and software culture.

What HN saysHN commenters credit him for ZeroMQ's quality, point to his structured concurrency post as the original explanation, and link his rationale for nanomsg.
126HN people shared it
70linked it in comments
183stories submitted
5.7Kstory points
3 months agolast shared
2011people per year2026

Most-shared posts

  1. 1
    Why should I have written ZeroMQ in C, not C++
    39 people · 1.3K points · first shared 2012 · 251 comments on HN
  2. 2
    Why should I have written ZeroMQ in C, not C++ (part II)
    15 people · 134 points · first shared 2012 · 156 comments on HN
  3. 3
    Structured Concurrency
    12 people · 164 points · first shared 2016 · 28 comments on HN
  4. 4
  5. 5
    TCP and heartbeats
    6 people · 6 points · first shared 2013 · 1 comments on HN
  6. 6
    Finish your stuff
    5 people · 818 points · first shared 2015 · 173 comments on HN
  7. 7
    Suicide by Culture
    4 people · 332 points · first shared 2017 · 193 comments on HN
  8. 8
    Software Licenses and Failed States
    4 people · 66 points · first shared 2016 · 48 comments on HN
  9. 9
    In the Defense of Spaghetti Code (2013)
    4 people · 58 points · first shared 2014 · 64 comments on HN
  10. 10
    Low Hanging Fruit of Programming Language Design
    3 people · 239 points · first shared 2017 · 210 comments on HN
  11. 11
    Let's stop kidding ourselves about APIs
    3 people · 87 points · first shared 2015 · 57 comments on HN
  12. 12
    The Cost of Abstraction (2016)
    3 people · 75 points · first shared 2016 · 61 comments on HN
  13. 13
    Advanced metaprogramming in C
    3 people · 63 points · first shared 2015 · 17 comments on HN
  14. 14
    EINTR and What It Is Good For (2012)
    3 people · 18 points · first shared 2012 · 6 comments on HN
  15. 15
    Does GPL hurt free software?
    3 people · 8 points · first shared 2012 · 8 comments on HN

What HN people wrote when they linked it

skrebbel · 2026-07-22
Fwiw, not that it mattes a lot, I think most of that sense of quality in ZeroMQ is due to the very tasteful efforts of its main author, Martin Sustrik (https://www.250bpm.com/). Pieter Hintjens sortof stewarded the project but, I believe, didn't code all that much on it. I did use the Xitami webserver in anger or years back in the early 2000s though, and that very much was Pieter's work! It was amazing!
eimrine · 2024-08-02
It is hard to judge about companies which are naturally sharing some anti-academic attitude, so it is more decent to analyze some information from FOSS movement. It quickly becomes noticeable that there are no such language as "C/C++" and one of my favorite writings in the field of C programming language is [1]. I believe most software of GNU movement keeps using C as their base language until something more persuading will be shipped and I consider both Rust and C++ as not that beautiful C replacements because of too much overhead. For example, neither PL from three mentioned ones can not do templates which are not a PITA when dealing with more than one data type. IMO (inspired by Lisp of course) this feature is more important than RAII or borrowing which effectively works only with tree-shaped data structures. [1] http://250bpm.com/blog:4
thesuperbigfrog · 2024-07-15
ZeroMQ was followed by nanomsg (https://nanomsg.org/) and nng (https://nng.nanomsg.org/) Some of Martin's rationale here: https://250bpm.com/blog:23/index.html ZeroMQ is still widely used and popular, but I am not sure if it is still actively developed.
ibraheemdev · 2021-06-01
> I highly recommend reading the "What is structured concurrency?" section with understanding. I think this is a big deal. The idea was originally introduced and explained in more depth here: https://250bpm.com/blog:71/
senkora · 2020-11-08
If anyone’s curious about the Swiss system, here’s a guide that I believe I found on HN that explains it in great detail: https://250bpm.com/blog:161/
pcr910303 · 2020-05-03
This is a follow up post from this post[0], which was on the front page[1] a few days ago. This article has some interesting discussions about the difference between C and C++ programmers - especially about the object-oriented data structures and encapsulation. [0]: http://250bpm.com/blog:4 [1]: https://news.ycombinator.com/item?id=22932837
sevensor · 2018-10-03
> Metaprogramming is an antipattern in C. Yet we often see passionate arguments in its favor, as for instance from Sústrik (http://250bpm.com/blog:56) and Tatham (https://www.chiark.greenend.org.uk/~sgtatham/mp/) and a person on the internet who recommends replacing LAPACK with preprocessor macros (http://wordsandbuttons.online/outperforming_lapack_with_c_metaprogramm… Would you care to comment on its enduring popularity?
jmaygarden · 2018-04-12
Here’s a few of my personal favorite insane nostalgics: * Donald Knuth: http://tex.loria.fr/litte/knuth-interview * Linus Torvalds: http://harmful.cat-v.org/software/c++/linus * Martin Sústrik: http://250bpm.com/blog:4
lucozade · 2017-12-21
libmill, the pre-cursor to libdill, was directly inspired by an implementation of nanomsg written in go (called mango I believe). Martin had struggled with the state machine approach he had been using and the coroutine approach of golang was a lot easier to reason about in practice. libdill was a development on libmill in two main ways: it was more idiomatically C and it supports structured concurrency. The latter is, in my opinion, very interesting. Martin has a blog post on it [0]. BTW I've got all this from following the nanomsg threads and reading Martin's blog. I'm not an active participant, so I may have some details wrong, but I think it's fairly accurate. [0] http://250bpm.com/blog:71
fizixer · 2016-02-22
In support, I would mention the following: [1] Mike Acton's talk: https://www.youtube.com/watch?v=rX0ItVEVjHc [2] ZeroMQ article: http://250bpm.com/blog:4 [3] Cat-V harmful page: http://harmful.cat-v.org/software/c++/
beagle3 · 2015-12-19
> code rot or software rot — only sets in when changes are made, either to the code itself or to any of its dependencies. "dependencies" is so vast here, that this definition (and following discussion) is completely useless. A web browser "depends" on web standards - Netscape 3 rotted not because of changes, but because it didn't even support HTML4 and the web moved on. Older games "depended" on hardware CGA/EGA/VGA quirks, or CPU timings, that were not replicated in later models. Year2K bug is "rotten" because 30 years have passed. The dependency is on the calendar year needed to operate in. And while we're talking about software as an organism, I believe Martin Sústrik's "Software Component's Reproductive System" essay[0] deserves more attention. [0] http://250bpm.com/blog:51
kbody · 2015-07-17
I've been using Babel to experience the ES6/7 world and it's a great experience to use async/await among else. Like others have said the error handling is not ok, however I want to focus on another related thing. The use of try{}catch{} for handling errors. Awaken by a section on Pragmatic Programmer and a post [1] of ZeroMQ's Martin Sústrik on (C) error handling. It seems logical to me that try/catch should be used for unexpected behavior and not for expected "falsy" results which is a core case for their current use on ES6/7. It is convenient to use try/catch compared to past alternatives, but it doesn't feel nor is designed right. Instead of just going with it, until we get terribly tired of it and do something, it's still early enough to have a proper solution in place. Not sure if any committee is working on this or something else is planned. [1]: http://250bpm.com/blog:4
2bluesc · 2015-07-02
I will soon be making a library and will be used on micrcontrollers and PCs. I'd like to use C++ but past experiences suggest that using C and writing a C++ wrapper later will save me frustration with things like code size and manual memory management. If I could turn off a number of features, C++ would be great. I keep flashing back to blog posts [0][1] written by the ZeroMQ author trying to settle on C being the way to go. [0] http://250bpm.com/blog:4 [1] http://250bpm.com/blog:8
cookrn · 2015-04-03
I thought this project was interesting because it was created as a follow-up to 0MQ with the changes long discussed on the author's blog. * http://250bpm.com/blog:4 (Why I should have written 0MQ in C instead of C++ Part 1) * http://250bpm.com/blog:7 (Does GPL hurt free software?) * http://250bpm.com/blog:8 (Why I should have written 0MQ in C instead of C++ Part 2) * https://github.com/nanomsg/nanomsg
calineczka · 2013-11-15
It is worth looking at Sustrik next project: http://nanomsg.org/ which is still in alpha version. ZMQ rewritten. He's got awesome blog http://250bpm.com/blog where he mentions lot of things that he decided to do differently in nanomsg and the reasons behind it. Check out: http://250bpm.com/blog:23 (I hate ZMQ contexts) and http://250bpm.com/blog:22 (how we are doomed to rewrite protocols on top of existing protocols and solving same problems again). His other blog posts are also of a great quality.
ynniv · 2012-09-14
Because resumption wasn't actually necessary for such a context inquiry, they removed it and found a significant speed increase in that part of the system. s/resumption/exceptions/ and you have a secret to performance in Java. If this is the core reason for termination-only exceptions in C++, Stroustrup made a huge mistake: he presumed that the best exception handling for mature, stable code was the best exception handing for all code. But then he also threw in a lot of features that cripple the language from ever being able to create truly mature, stable code (see http://www.250bpm.com/blog:4). Now the most stable, mature libraries are written in C. C++ exceptions are then unreachable code, and a properly optimized programmer will never use them.
utopcell · 2024-02-25
Coroutines. What a lovely concept! It's a joy to watch all the CppCon videos about C++ coroutines, primarily by Microsoft folks. "Negative-cost abstraction" is such a nice hook phrase. Friends at Meta mentioned to me a couple years ago that they started using c++ coroutines, which ended up being a big mistake because they had to face compiler implementation bugs, which must have been nasty to track down. At Google, we are eagerly waiting for the brilliant folks that are working on properly integrating them in google3/ to tell us when the time has come to use them. This article uses Duff's device [1] to motivate structured gotos via macros as an implementation strategy for C coroutines. Duff wanted to loop-unroll this: do { *to = *from++; } while (--count > 0); which he did in this way (shortened for brevity) : int n = (count + 3) / 4; switch (count % 4) { case 0: do { *to = *from++; case 3: *to = *from++; case 2: *to = *from++; case 1: *to = *from++; } while (--n > 0); } That is to say, he realized that he could use `case` statements (almost) anywhere in a `switch` block. The connection with coroutines is simple: One can wrap the whole function body with a switch statement, use a static variable for holding the location of the latest coroutine return, and label all co-returns with a `case` statement: #define coBegin static int state = 0; switch (state) { case 0: #define coReturn(x) do { state…
withoutboats3 · 2024-02-05
This is interesting and makes sense. It's worth mentioning that the original use of structured concurrency (by Sustrik) was really about dealing with the problem of cancellation-friendly virtual threads: https://250bpm.com/blog:71/ > I don't think yielding needs to be visible to the user in any meaningful way; why does it need to be? It's an interesting question. Users definitely want coroutines they can yield themselves - this is was iteration is all about, for example, and there are other similar patterns (the entry API is ultimately a kind of coroutine). At the same time, the highest performance low level interfaces for asynchronous IO are ultimately just asynchronous iterators & asynchronous sinks over shared memory ring buffers, io-uring is the most famous example but there are others like AF_XDP. I think you're right that a kind of cancellable virtual thread ultimately would have analogous affordances to a future. But a future is just a specific class of coroutine (that yields a unit type), so if you will have the coroutine mechanism for the rest of the system, why would you not extend it to include IO instead of adding a separate mechanism to erase the fact that IO is happening? What you also get from this is that if a function yields the bottom type you know it doesn't perform IO.
rektide · 2023-06-11
I love this idea a lot. It has huge promise. There's a constellation of ideas around returning to the file system & destructing data, using flatter data & the file system to file data that have so much promise and hope. Using git as a next layer to syndicate. 9p is a well known pointer into this universe. There's less discussion/clarity around how an app or how a network ought become file system oriented, about what flat data architectures would be, but these humble ideas you have here I think show exceeding promise, are clear & reasonable a start that any dev of any language can see & grok (which is huge) & follow a long with. The sense is self evident. One other humble pointer I might drop might be Hull: the alternative to shell that I'll never have time to implement. https://250bpm.com/blog:153/ I love how such a community as these could form & if things take a turn badly, folks can fork. They can abandon one host & shift to another instance to bave discussions on.
ghoward · 2021-11-03
Funny you ask that, because I am making a programming language! (1) Structured concurrency, best explained at [1], [2], [3], and [4]. More on this later. (2) Extensibility. Most people think that this means macros. It doesn't. However it's done, as curryst said, languages are not perfect, and extending a language is important. See "Growing a Language" by Guy Steele, Jr. [5] More on this later. (3) Like many other posts, having real-world units like feet, meters, pounds, kilograms, etc., for calculations and type checking, but the default number type should also be a BigRational. (4) Ranged types, like Ada, allowing programmers to explicitly limit the range a type can be, eliminating errors. For example, a type that is used in the denominator of a division could be restricted to being not zero, and you don't need to worry about divide-by-zero for those divisions. (5) Consistency, a massively underrated feature. The use of something in the language should be the same everywhere. This simplifies learning and makes it easier to understand features you haven't seen yet. (6) Design-by-Contract and other formal methods "in the small". It should be possible to use formal methods on little pieces of code. Even if you can't go so far as to prove them correct, it should be easy to increase your confidence that they are. (7) Conditions and restarts instead of exceptions. Conditions and restarts come from Lisp, and it is one of the greatest ideas in computer science that almost…
akkartik · 2021-01-23
> How is the current "notion of IP for software" not sustainable? The only reason the "notion of IP for software" is a thing is that our intuitive notions of ownership don't quite work. We can't sell software without sources because nobody wants to allow a stranger to run arbitrary code on their computers. We can't sell software with sources because it's too easy to copy. We can't give away software with sources for free because people gotta eat. So IP is a hack that slips into a gap just because there’s nothing better. But it's not a great hack. https://250bpm.com/blog:82 makes a compelling argument that licenses exist only to help CYA companies consume software without risk. All of the software on my computer is owned by others, and yet nobody bears any liability for security holes. It's hard to discuss licenses, because "IANAL". But any time spent looking into licenses quickly uncovers stuff that's only there because nobody has tried to fight it in court yet. Licenses apply to a single snapshot of code, but software has a life cycle and needs a supply chain and governance structure (https://monetize.substack.com/p/a-holistic-vision-of-open-source) > how is setting up a situation that seems to be asking for a tragedy of the commons more sustainable? I think a lot about the tragedy of the commons (https://news.ycombinator.com/item?id=4359257#4361596), but it's not clear to me how people putting things made of bits in a digital commons that anybody can use creates any…
acqq · 2020-11-26
Haven't seen, but thanks. Lived and worked while following some of the ideas mentioned. E.g. at the whole bottom of the page in some comment is a link to: "Why should I have written ZeroMQ in C, not C++ (part II)" https://250bpm.com/blog:8/ where the author writes "Let's compare how a C++ programmer would implement a list of objects..." and then "The real reason why any C++ programmer won't design the list in the C way is that the design breaks the encapsulation principle" etc. I have indeed more than once used intrusive data structures in non-trivial C++ code, and the result was easy to read, and very efficient. There I really didn't care about some "thou shalt not" "breaking the encapsulation principle" because whoever thinks at that level of "verbot" 100% of times is just wrong. The "encapsulation principle" is an OK principle for some levels of abstraction, but nobody says that one has to hold to it religiously (exactly my point before). I would of course always make an API which would hide what's behind it. But where I implement something ("the guts" of something), I of course have my freedom to use intrusive elements, if that solves the problem better. I have even created some "extremely intrusive" stuff (with a variable number of intrusive links in the structures). It worked perfectly. Insisting on doing anything as "ritual" all the time is just so, so wrong.
rootlocus · 2015-07-28
You can read some excellent material on the subject here: http://250bpm.com/blog:4 I'm far from being a fan of Casey. I find that he makes strong statements based on weak arguments. He's overly hateful of Microsoft and C++, despite him using Visual Studio and a C++ compiler. He tries to be pedantic but makes a fair share of mistakes. Some of his architecture design choices left me with a straight face wtf expression. C++ has it's flaws, that's widely known and accepted by the community. It's even highlighted in the "Effective C++" books. Unfortunately, the best advice given is "don't do that". I believe a vast majority of C++ users will gladly switch to a new language that offers the same level of abstractions at a comparable speed (maybe Go or Rust). For now, C++ users have to understand the language well enough to avoid its many traps and pitfalls. Moreover, new versions of the standard add to this burden. I know of no project built entirely using C++14. People will always have to deal with legacy code. OOP is just another programming paradigm C++ supports. You're not required to use it, and you're not even paying for it if you're not using virtual methods. Sure, C++ allows you to do a lot of funky things from overloading operators to implicit conversions but that's another of those things everybody agrees should not be used unless explicitly necessary. OOP facilitates encapsulation and polymorphism which are great tools when designing software systems. C has its…
harry8 · 2015-02-14
>> If you use C or C++ and genuinely don't care about performance you performed a premature optimisation in the choice of these languages. Any JVM language would be suit your needs better in some way. >That is a surprising statement, especially since you don't necessarily have any idea what my needs are. Look we've probably exhausted this discussion and are talking past eachother, but I do want to point out that this is a simple misunderstanding. I meant "you" in the sense of the archaic english "one" "If one uses C or C++ and one does not care about performance one has performed a premature optimisation." It sounds terribly old-fashioned expressed like this but I guess the meaning is clearer given the way "you" is overloaded to mean you singular (you yourself), you plural (you and your admirers) and you in the sense of 2. here: http://dictionary.reference.com/browse/you "one; anyone; people in general" I obviously have no knowledge or opinion about choices made specifically by yourself, and we are in total agreement that holding an opinion on such would be ridiculous in the extreme. You might find this interesting, it highlights the problem I'm talking about with exceptions by a guy who has done it in c++ with amazing success, likes the language and appreciates its defects as well as its strengths: http://250bpm.com/blog:4 Where you are writing those pieces of code in your program that caused you to rationally choose C or C++ as your language (ie has to perform &…
e12e · 2013-11-16
Reminds me about the last few paragraphs of: http://250bpm.com/blog:22 Especially: "Obviously, the right solution would be implement a new transport protocol directly on top of IP protocol, one that would provide desired functionality — failure detection and/or multiplexing — directly, without duplicating the features. And, as a matter of fact, the above was already done. The protocol built directly on top of IP with both heartbeating and multiplexing is called SCTP and is available out of the box in most operating systems. And here comes the problem: SCTP is not used, even for projects where those features are needed. Instead, they are lousily re-implemented on top of TCP over and over again." (Not necessarily saying that SCTP would be the best fit for games, more the general point -- that there's room for more than just TCP and UDP on top of IP -- and also that that might not work, due to firewalls and routers refusing to route anything that's not TCP or UDP).
MetaCosm · 2013-08-19
I think a lot of people HAVE made the case convincingly, at least well enough for me. I have worked in major C++ shops that ban the use of exceptions (and enforce it). Just to add another person who regrets exceptions to the big pile, http://250bpm.com/blog:4 (The ZMQ Author) "Thus, the error handling was of utmost importance. It had to be very explicit and unforgiving. C++ exceptions just didn't fill the bill. They are great for guaranteeing that program doesn't fail — just wrap the main function in try/catch block and you can handle all the errors in a single place. However, what's great for avoiding straightforward failures becomes a nightmare when your goal is to guarantee that no undefined behaviour happens. The decoupling between raising of the exception and handling it, that makes avoiding failures so easy in C++, makes it virtually impossible to guarantee that the program never runs info undefined behaviour. With C, the raising of the error and handling it are tightly couped and reside at the same place in the source code. This makes it easy to understand what happens if error happens..."
robocat · 2026-02-14
Link about problems of shrinking population demographics: https://www.250bpm.com/p/life-at-the-frontlines-of-demographic
svilen_dobrev · 2025-05-03
Here another two of Sustrik's gems.. Anti-social Punishment: https://250bpm.com/blog:132/ Technocratic Plimsoll Line: https://250bpm.com/blog:176/ seems lesswrong has all of them, older and newer: https://www.lesswrong.com/users/sustrik?from=post_header
mananaysiempre · 2023-10-12
Structured concurrency as commonly understood requires children to not outlive parents, recursively. For example, if A spawns B spawns C, then B cancels for C with timeout 30s, then 5s later A cancels B with timeout 5s, then the timeout for C must be effectively reduced by 20s[1]. But the issue here is more basic than timeouts. If we are to use process groups in the example, then B must be a process group leader for C and simultaneously belong to the process group led by A, which is impossible on Unix—that’s what TFA means by “[the] process group mechanism [is] one-level deep”. Close but no cigar. (On the other hand, no reason this can’t be an extension to—I would even say a rationalization of—the process group mechanism. It doesn’t exist right now, though.) [1] https://250bpm.com/blog:71/

Keyboard shortcuts

/Search
j kNext / previous blog
EnterOpen selected blog
vVisit the blog site
fFollow / unfollow
lSwitch grid / list view
dSwitch dark mode
g hHome
g pTop posts
g tTopics
g fFollowing
g lLiked
g yHistory
g qFAQ
EscBack / close