New top story on Hacker News: Show HN: Threadprocs – executables sharing one address space (0-copy pointers)

Show HN: Threadprocs – executables sharing one address space (0-copy pointers)
23 by jer-irl | 17 comments on Hacker News.
This project launches multiple independent programs into a single shared virtual address space, while still behaving like separate processes (independent binaries, globals, and lifetimes). When threadprocs share their address space, pointers are valid across them with no code changes for well-behaved Linux binaries. Unlike threads, each threadproc is a standalone and semi-isolated process. Unlike dlopen-based plugin systems, threadprocs run traditional executables with a `main()` function. Unlike POSIX processes, pointers remain valid across threadprocs because they share the same address space. This means that idiomatic pointer-based data structures like `std::string` or `std::unordered_map` can be passed between threadprocs and accessed directly (with the usual data race considerations). This accomplishes a programming model somewhere between pthreads and multi-process shared memory IPC. The implementation relies on directing ASLR and virtual address layout at load time and implementing a user-space analogue of `exec()`, as well as careful manipulation of threadproc file descriptors, signals, etc. It is implemented entirely in unprivileged user space code: < https://github.com/jer-irl/threadprocs/blob/main/docs/02-imp... >. There is a simple demo demonstrating “cross-threadproc” memory dereferencing at < https://github.com/jer-irl/threadprocs/tree/main?tab=readme-... >, including a high-level diagram. This is relevant to systems of multiple processes with shared memory (often ring buffers or flat tables). These designs often require serialization or copying, and tend away from idiomatic C++ or Rust data structures. Pointer-based data structures cannot be passed directly. There are significant limitations and edge cases, and it’s not clear this is a practical model, but the project explores a way to relax traditional process memory boundaries while still structuring a system as independently launched components.

March 23, 2026 at 11:08PM jer-irl 23 https://ift.tt/ZTlzoBA Show HN: Threadprocs – executables sharing one address space (0-copy pointers) 17 This project launches multiple independent programs into a single shared virtual address space, while still behaving like separate processes (independent binaries, globals, and lifetimes). When threadprocs share their address space, pointers are valid across them with no code changes for well-behaved Linux binaries. Unlike threads, each threadproc is a standalone and semi-isolated process. Unlike dlopen-based plugin systems, threadprocs run traditional executables with a `main()` function. Unlike POSIX processes, pointers remain valid across threadprocs because they share the same address space. This means that idiomatic pointer-based data structures like `std::string` or `std::unordered_map` can be passed between threadprocs and accessed directly (with the usual data race considerations). This accomplishes a programming model somewhere between pthreads and multi-process shared memory IPC. The implementation relies on directing ASLR and virtual address layout at load time and implementing a user-space analogue of `exec()`, as well as careful manipulation of threadproc file descriptors, signals, etc. It is implemented entirely in unprivileged user space code: < https://github.com/jer-irl/threadprocs/blob/main/docs/02-imp... >. There is a simple demo demonstrating “cross-threadproc” memory dereferencing at < https://github.com/jer-irl/threadprocs/tree/main?tab=readme-... >, including a high-level diagram. This is relevant to systems of multiple processes with shared memory (often ring buffers or flat tables). These designs often require serialization or copying, and tend away from idiomatic C++ or Rust data structures. Pointer-based data structures cannot be passed directly. There are significant limitations and edge cases, and it’s not clear this is a practical model, but the project explores a way to relax traditional process memory boundaries while still structuring a system as independently launched components. https://ift.tt/8iX095Y

Nhận xét

Bài đăng phổ biến từ blog này