LINUX.ORG.RU

История изменений

Исправление vertexua, (текущая версия) :

Совершенно на другом уровне решено, да, очень хорошо.

P.S. Устал не много от срача о data race в Rust. Собеседник обычно уходит в глубины сложных алгоритмических багов и все еще спорит об этом как «ага, в Rust есть data race». Кратце: borrow checker, мьютексы как контейнеры, Send+Sync, это все очень хорошо помогает.

Safe Rust guarantees an absence of data races, which are defined as:

  • two or more threads concurrently accessing a location of memory
  • one of them is a write
  • one of them is unsynchronized

A data race has Undefined Behavior, and is therefore impossible to perform in Safe Rust. Data races are mostly prevented through Rust’s ownership system: it’s impossible to alias a mutable reference, so it’s impossible to perform a data race. Interior mutability makes this more complicated, which is largely why we have the Send and Sync traits (see below).

However Rust does not prevent general race conditions.

This is pretty fundamentally impossible, and probably honestly undesirable. Your hardware is racy, your OS is racy, the other programs on your computer are racy, and the world this all runs in is racy. Any system that could genuinely claim to prevent all race conditions would be pretty awful to use, if not just incorrect.

Исправление vertexua, :

Совершенно на другом уровне решено, да, очень хорошо.

P.S. Устал не много от срача о data race в Rust. Собеседник обычно уходит в глубины сложных алгоритмических багов и все еще спорит об этом как «ага, в Rust есть data race». Кратце: borrow checker, мьютексы как контейнеры, Send+Sync, это все очень хорошо помогает.

Safe Rust guarantees an absence of data races, which are defined as:

  • two or more threads concurrently accessing a location of memory
  • one of them is a write
  • one of them is unsynchronized A data race has Undefined Behavior, and is therefore impossible to perform in Safe Rust. Data races are mostly prevented through Rust’s ownership system: it’s impossible to alias a mutable reference, so it’s impossible to perform a data race. Interior mutability makes this more complicated, which is largely why we have the Send and Sync traits (see below).

However Rust does not prevent general race conditions.

This is pretty fundamentally impossible, and probably honestly undesirable. Your hardware is racy, your OS is racy, the other programs on your computer are racy, and the world this all runs in is racy. Any system that could genuinely claim to prevent all race conditions would be pretty awful to use, if not just incorrect.

Исходная версия vertexua, :

Совершенно на другом уровне решено, да, очень хорошо.

P.S. Устал не много от срача о data race в Rust. Собеседник обычно уходит в глубины сложных алгоритмических багов и все еще спорит об этом как «ага, в Rust есть data race». Кратце: borrow checker, мьютексы как контейнеры, Send+Sync, это все очень хорошо помогает.