So I would say:
- pointers internal to a module can use a simple shared_ptr (node_ptr_base);
- pointers shared across modules can use a cyclic-safe shared_ptr (node_ptr);
- iterators are simple raw pointers and the compiler will prevent you from incrementing / decrementing shared_ptr anyway.


Phil Bouchard

C.: (819) 328-4743

Fornux Logo

On Aug 5, 2021, at 3:01 PM, Phil Bouchard via Std-Proposals <> wrote:

On 8/5/21 2:48 PM, Miguel Ojeda wrote:
On Thu, Aug 5, 2021 at 8:25 PM Phil Bouchard <> wrote:
- The memory manager has the property of being deterministic so no new random race conditions are involved, as such with garbage collector.
That is a no then. Rust guarantees the absence of data races and UB in general.

Root Pointer is thread safe as shown in my examples. I'll read more about the data races later, but general race conditions aren't gone with Rust:

- The only drawback is that sizeof(root_ptr) = sizeof(void *) x 4... but can be shrink to sizeof(void *) x 3;
So every pointer in the kernel would be triplicated? That is far from
ideal, even before discussing time costs.

Each one of them is derived from the other so you can use it as a simple shared_ptr, or cyclic-safe shared_ptr. The latter is just sizeof(void *) x 2. Kernel programmers should be smart enough to use a unique type for iterators. My implementation is just very generic.

Rust allows us to have more guarantees, without such a cost.


Phil Bouchard
Founder & CTO
C.: (819) 328-4743

Fornux Logo
Std-Proposals mailing list