Build1 distinct publisher3 min readUpdated
A dev.to walkthrough lays out the POSIX recipe behind HDFS short-circuit reads and points it at java.lang.foreign. The supplied text stops before the Java arrives.
The Engineer · Build desk
Compiled by The EngineerSomething wrong?How this is made
Setting up the segment is the cheap part. Three calls do it: shm_open for a named object and its descriptor [6], ftruncate to give that object a size [7], mmap to pull it into your own address space [8]. None of that shares anything. The sharing happens when the descriptor crosses a process boundary, and on Linux the post's route for that is a control message on a Unix domain socket [9].
That asymmetry decides how much a foreign-function binding buys you. Four named library functions appear as calls across the supplied listings [14]. The handoff step alone pulls in three C struct types and two uppercase macros, CMSG_SPACE and CMSG_FIRSTHDR [12]. Struct layouts are exactly what a header extractor is good for. Macros are not symbols in anything you can bind to, so in my reading the buffer-sizing and header-walking arithmetic is the piece a porter ends up writing and testing by hand, and it is also the piece that fails silently when the layout is wrong.
The error handling ports badly too. The three setup calls carry two different failure sentinels: -1 from shm_open and ftruncate, MAP_FAILED from mmap [13]. In C those are three perror-and-exit sites. Inside a long-lived JVM service they are three decisions about what a process that cannot map its own segment should do to an in-flight request.
It is worth being precise about the payoff, because the source is. What memory sharing removes is the extra syscalls and context switches a socket path would incur, plus the copying, and the post is explicit that data may still have to be loaded from disk if it is not already cached [3]. So the win tracks how much of your latency is copy and transport. A service that spends its time in a parser, or waiting on a device, still spends it there.
HDFS is the reference case, and reading it closely shows the harder dependency. The DataNode does not just hand out mappings: the driver first asks HDFS which DataNodes hold copies of the wanted input, then tries to launch tasks on those same DataNodes, and only then does the worker request short-circuiting and start working on the shared memory-mapped blocks [4]. The zero-copy read is the last step of a placement decision. Anything that wants the same effect needs the same authority over where its processes land, which for most services means a deliberate same-host deployment rather than a library call.
The cross-language case the post sketches, a Python notebook pushing predicates down to a high-performance engine that prepares partial results in memory and shares them back [5], is where the remaining design work sits. Both sides have to agree on a byte layout, and the guarantee on offer is only that changes are immediately visible to the other process [2]. Immediacy is not ordering. Who writes, who reads, and how either knows the other has finished is yours to build.
The post's stated goal is to do all of this in Java [10], with java.lang.foreign and jextract in the title [1]. The material supplied here breaks off inside the control-message snippet, at cmsg_type, before any Java appears [11]. What transfers today is the spec.
Follow any of these and your For You feed starts watching them — no settings page required.
Ranked by verification strength, evidence, and original report placement.
Shared memory segments are used by high-performance systems to achieve data locality; data may still need to be loaded from disk if not already cached, but the extra syscalls and context switches incurred by sockets are avoided, and there is no copying of data, which saves CPU cycles.
The Apache HDFS DataNode uses short-circuiting for zero-copy data locality for Apache Spark or MapReduce jobs: the driver asks HDFS which DataNodes store copies of the desired input, tries to launch tasks on those DataNodes, and the worker then requests short-circuiting and works directly on the memory-mapped blocks the DataNode shares with it.
The supplied text of the post breaks off inside the control-message code snippet, at the line setting cmsg_typ(e), without showing any Java code.
A dev.to post published by mishmash-io is titled "Sharing memory between processes with java.lang.foreign and jextract".
Shared memory lets one process modify a segment of memory with the changes immediately visible within another process; no networking and no TCP/IP stack is involved, the processes read and write exactly the same memory.
The post gives a cross-language scenario: a Python notebook DataFrame asks a database engine written in a high-performance language to do the heavy lifting in a predicate-pushdown manner, the engine prepares partial results in memory and shares that memory back with the notebook, where the researcher finalises the computation.
Evidence-backed comparisons of source perspectives and observed adoption signals. Read the methodology
Which Builder, Operator, and Investor concerns the observed source mix emphasized—not a truth score.
Evidence, demonstrated adoption, hype gap, incentives, and confidence are assessed independently, each on its own current evidence. How these are measured.
Primary code listings, but the headline half is missing
The mechanical claims are first-party and self-verifying: the supplied body shows the shm_open/ftruncate/mmap sequence with exact flags and error sentinels, and complete server- and client-side SCM_RIGHTS descriptor-passing snippets. Against that, the artefact the title promises - Java code using java.lang.foreign and jextract - is entirely absent, the performance rationale carries no measurement, and there is exactly one source with no corroboration.
No adoption signal in the cluster
The cluster contains no release, deployment, benchmark, pricing, licence, or usage disclosure. The HDFS DataNode short-circuit example is illustrative background inside a tutorial - no version, configuration, or deployment data - and the Python-notebook scenario is hypothetical, so there is nothing measurable to score.
Headline promises Java; body ships C
The substantive technical claims are modest and well-founded, so the gap is not in the argument but in the packaging: a title built on java.lang.foreign and jextract fronts a body that never leaves C and truncates before the Java arrives. The zero-copy performance framing is also asserted without measurement. Positive but small, because nothing in the body is overstated on its own terms.
Company developer-marketing on a dev platform, no product pitch
The post is published on a developer platform under a company account (mishmash-io), which carries a standard audience-building incentive. Mitigating it: the supplied text names no product, pricing, licence, or proprietary component, makes no competitive comparison, and confines itself to standard POSIX APIs and a public Apache example, so commercial pressure on the technical content is low.
Mechanics solid, story incomplete
Confidence is moderate: the checkable mechanics are internally consistent and match well-known POSIX semantics, and the cluster's central framing - that the descriptor handoff, not the mmap, is the hard part - is directly supported by the listings. It is held down by a single publisher, a truncated body, no adoption or benchmark data, and two ledger inventory claims that the body itself contradicts by undercounting macros and named calls.
build
Force the tool call, then hand Lightsail a long-lived key1 distinct publisher
build
A cache hit is a quota refund: semantic caching with trigrams and no vector database1 distinct publisher
build
Stop timing your GraphQL tests and start counting loader calls1 distinct publisher
build
Your 90% Cache Hit Ratio Is a Lagging Indicator. Alert on Cold Misses Per Key1 distinct publisher
Distinct publishers with included, body-backed reporting in this cluster.
dev.to
1 article · August 22, 2026