|
|
|
|
|
by pjmlp
20 days ago
|
|
Nope, the goal is still there, multiple threads accessing a specific memory location, that happens to be mapped outside the process, or a variable holding a database connection that is shared across multiple threads, and there are no Sendable trait implementations that can prevent that. Threads and concurrency is not the same by the way, as Rob Pike puts it, "concurrency is not parallelism". |
|
Why did you start talking about multiple processes? That's a much less common way to do concurrency these days.
Process-shared memory is an OS-specific feature with wildly diverging semantics, and it's not possible to write a memory-safe portable abstraction over that in any language. Windows comes the closest with mandatory file locking. On Linux there's nothing you can do but pray. Hence, `mmap()` is fundamentally unsafe in Rust, and that's perfectly fine.