Exploring Concurrency Pitfalls: Rust vs. C++ and Go

  Рет қаралды 7,554

Ardan Labs

Ardan Labs

18 күн бұрын

Welcome to the Rust: Safe at Any Speed series, Episode 6! A series of short videos on Rust and its diverse advantages when it comes to speed and security. Watch now to learn about Memory Safety, Avoiding Vulnerabilities with Clear Intent, and Data Races, and how Rust keeps your data safe!
In this episode, we explore data races in concurrent programming, comparing Rust's approach with C++ and Go. We demonstrate the chaos data races can cause and how Rust's compiler prevents them. We delve into Rust's atomic operations, mutexes, and interior mutability, showcasing their effectiveness in concurrent programming. Additionally, we highlight Rust's avoidance of null pointers, error handling mechanisms, and strict aliasing rules. Despite its imperfections, Rust's safety features make it a valuable tool for building reliable systems.
Whether you're a seasoned developer or just starting your journey, this episode offers invaluable insights into mastering memory safety and building reliable software systems. Tune in now to embark on a journey toward safer and more efficient programming practices!
Things you will learn in this video:
- The significance of understanding data races in concurrent programming.
- Demonstrations of chaos caused by data races and how Rust's compiler prevents them.
- Rust's avoidance of null pointers and its error handling mechanisms.
----
The clips from this series are from our October 2024 KZbin Live-Stream, 'Rust: Safe At Any Speed', with instructor Herbert Wolverson.
----
What are your thoughts on Rust's approach to concurrency and memory safety compared to other languages you've used?
Share your experiences and solutions in the comments below!
Comment below or tweet us on twitter & let us know your thoughts, we want to hear from you! ~ If you found this video helpful, hit that like button & subscribe for more content like this.
----
Access our online courses → www.ardanlabs.com/education/
Attending a live training → www.ardanlabs.com/live-traini...
Other Links:
Website: www.ardanlabs.com/
Github: github.com/ardanlabs
Twitter: / ardanlabs
#rust #rustprogramming #education #tutorials #tips

Пікірлер: 27
@kevinkkirimii
@kevinkkirimii 15 күн бұрын
I find GO wait groups syntax very straight forward especially coming from Java.
@josephcopenhaver6604
@josephcopenhaver6604 16 күн бұрын
9:20 to 9:51 appeared blank (black screen) and silent for some reason.
@Rogueixpresents
@Rogueixpresents 16 күн бұрын
segmentation fault there
@KX36
@KX36 11 күн бұрын
deadlocked.
@kamertonaudiophileplayer847
@kamertonaudiophileplayer847 13 күн бұрын
Your video is a very on time. I just finished a blog exactly about the same problem in C++, Java and Rust. I am only learning Go, so you somewhere surpasses me.
@miriamramstudio3982
@miriamramstudio3982 14 күн бұрын
Great video. Thanks.
@ardanlabs
@ardanlabs 13 күн бұрын
We're glad you liked it!
@felixinit
@felixinit 12 күн бұрын
I tried, but it is advanced for me at this point. Looks relly interesting. Definitivamente lo revisaré más adelante en mi desarrollo profesional.
@kamertonaudiophileplayer847
@kamertonaudiophileplayer847 13 күн бұрын
Do not forget that you can use volatile stead of Mutex in C++.
@mk72v2oq
@mk72v2oq 12 күн бұрын
No you can't. Volatile has nothing to do with synchronization and you will get the same inconsistent results.
@kamertonaudiophileplayer847
@kamertonaudiophileplayer847 12 күн бұрын
@@mk72v2oq Strange, what's purpose of volatile then? I use it widely in a multithreading programming, and you ruined my career.
@yurcchello
@yurcchello 12 күн бұрын
@@mk72v2oq why not? for primitive data types volatile must be enough
@maxbd2618
@maxbd2618 12 күн бұрын
volatile is for like telling the compiler not to touch a particular variable that might change values and you don't want optimization to possibly interfere with it, its not related to thread safety at all im pretty sure
@mk72v2oq
@mk72v2oq 12 күн бұрын
@@maxbd2618 yeah, it only tells the compiler not to put intermediate value into a CPU register and always fetch it from RAM. It could help in certain scenarios, but: 1. Volatile variables still use regular (non-atomic) instructions, which means that the concurrent access will likely bork it. 2. Volatile also doesn't prevent the value to be cached by CPU cores (private L1/L2 caches for each core), which completely throws away any possibility to use it for synchronization.
@KhaledKimboo4
@KhaledKimboo4 13 күн бұрын
What a waist of time an entire video to show rust mutex wrapper that you can make even with python as if it's a hell of a feature of rust.
@andreiterec7606
@andreiterec7606 13 күн бұрын
In Python, C++ and Go you still can access the data without locking the mutex, even with the wrapper. You can lock the mutex and store a pointer to the data and use it later without locking the mutex again. You can't do that in safe rust
@KhaledKimboo4
@KhaledKimboo4 13 күн бұрын
@@andreiterec7606 who cares, I want that freedom and responsibility, how does stuffing boilerplate code into std library constitute as a feature is beyond me. How hard is it for go team to deliver such wrapper in stdlib literally 1hour . I love rust and I dislike it's overly hyped community
@aGFteg
@aGFteg 13 күн бұрын
This isn’t “just a wrapper” and can be done in Go in one hour. That’s an entire language design, it requires RAII which go doesn’t have. It requires explicit unboxing (or deref in rust). And more languages feature. Let’s not disrespect Rust just because it’s getting hype (which after using multiple languages over the years, Rust deserves this hype)
@maxbd2618
@maxbd2618 12 күн бұрын
ong you won't catch me explicitly creating a mutex in C++ and forgetting to use it
@lufenmartofilia5804
@lufenmartofilia5804 11 күн бұрын
chamomile my friend. C.H.A.M.O.M.I.L.E 😅
@awksedgreep
@awksedgreep 12 күн бұрын
There’s nothing better than concurrency in OTP/Erlang/Elixir.
@maxbd2618
@maxbd2618 12 күн бұрын
true
how can memory safe code STOP HACKERS?
7:43
Low Level Learning
Рет қаралды 108 М.
The Absolute Best Intro to Monads For Software Engineers
15:12
Studying With Alex
Рет қаралды 564 М.
КАХА и Джин 2
00:36
К-Media
Рет қаралды 4,1 МЛН
어른의 힘으로만 할 수 있는 버블티 마시는법
00:15
진영민yeongmin
Рет қаралды 9 МЛН
zig is the future of programming. here's why.
9:34
Low Level Learning
Рет қаралды 186 М.
Harder Than It Seems? 5 Minute Timer in C++
20:10
The Cherno
Рет қаралды 89 М.
Build a CRUD REST API with Rust Axum | Tutorial
19:41
cudidotdev
Рет қаралды 2,9 М.
Rust: When C Code Isn't Enough
8:26
CodeAhead
Рет қаралды 151 М.
Why i think C++ is better than rust
32:48
ThePrimeTime
Рет қаралды 267 М.
C++ vs Rust: which is faster?
21:15
fasterthanlime
Рет қаралды 371 М.
How Rust rose to dominance (by accident)
11:01
Let's Get Rusty
Рет қаралды 32 М.
Mind-bending new programming language for GPUs just dropped...
4:01
My Rust Program is Slow
6:30
chris biscardi
Рет қаралды 46 М.
Can THIS win Sebastian Lague's Chess challenge?
10:11
Game Tech Explained
Рет қаралды 196 М.
КАХА и Джин 2
00:36
К-Media
Рет қаралды 4,1 МЛН