Rust: Send Data between Threads

  Рет қаралды 10,190

The Dev Method

The Dev Method

Күн бұрын

#rust #thread #data
Threads or actors communicate with one another by sending messages containing data
The Rust Standard Library provides an implentation of Channels.
A Channel is concept where one thread sends data to another thread.
Links
The Rust Programming Book
Chapter 16 Section 2
doc.rust-lang....

Пікірлер: 17
@LucidGR
@LucidGR 7 ай бұрын
This channel deserves a tone of subscribers. Great job!
@bissbort
@bissbort Жыл бұрын
Love your teaching style and your channel, please keep up the good work. I hope your popularity will grow with Rust's 🦀!
@rsalmei
@rsalmei 3 ай бұрын
What font do you use? Very nice.
@Gabriel250100
@Gabriel250100 Жыл бұрын
The next topic will be great, I'm coding an app which uses shared state and it's hard to work with library structs that aren't Send+Sync. Nice video as always
@user-uf4lf2bp8t
@user-uf4lf2bp8t Ай бұрын
Thats a bad library if their types use some !Send cell and they don't have a feature to make it into a mutex instead. Same thing if they use exclusively Rc with no Arc feature
@job4753
@job4753 Жыл бұрын
Great video once again!
@roopeshsaravanan8609
@roopeshsaravanan8609 9 ай бұрын
Your 5000th subscriber ❤
@danraine9009
@danraine9009 Жыл бұрын
Awesome video, if you were trying to utilise threads to the maximum level would you need to do some sort of logic to get the users specs of machine and how many threads their system is capable of etc? I honestly don't have any experience with threads or really much knowledge of the underlying processes of a CPU etc and if it does differentiate between machines etc... Is this knowledge needed? and if so do you have any places to look to learn more about these ideas? Thanks for the videos I've only recently found your channel but everything I have watched so far has been really valuable.
@TheDevMethod
@TheDevMethod Жыл бұрын
Improving execution performance can get really technical and expansive really fast. There’s even techniques like loop unrolling to help speed up the current process of execution rather than trying to use threads. This article could give you ideas of what to look into next blog.mineiros.io/how-to-use-multithreading-and-multiprocessing-a-beginners-guide-to-parallel-and-concurrent-a69b9dd21e9d
@danraine9009
@danraine9009 Жыл бұрын
@@TheDevMethod Awesome response thank you, I am very new to this area so apologies if my question wasn't great I'm just trying to get as much information as possible. Keep up the great work :)
@736939
@736939 Жыл бұрын
OK, but where to use it? Is there some design patterns in message passing?
@adaum79
@adaum79 Жыл бұрын
Nice vídeo
@marcel2023
@marcel2023 Жыл бұрын
What happens if that thread you are sending messages to, is really busy. Will messages be dropped or will the sending wait. Is there some sort of acknowledge?
@TheDevMethod
@TheDevMethod Жыл бұрын
The docs explain that the send method returns a Result that can be a SendError doc.rust-lang.org/std/sync/mpsc/struct.Sender.html#method.send. And that error comes from the receiver that disconnected while sending. doc.rust-lang.org/std/sync/mpsc/struct.SendError.html.
@songz9781
@songz9781 Жыл бұрын
I mostly work with async runtimes in Rust - which is usually within the “futures” crate. The mpsc channel has back pressure support and let you define either the channel should have certain size of a buffer or “unbounded” channel that put developer in charge of make sure the channel won’t be crowded. Hope this helps.
@nothingtoospecial777
@nothingtoospecial777 Жыл бұрын
what's the theme?
@TheDevMethod
@TheDevMethod Жыл бұрын
Ayu
Rust: Shared-State Concurrency
7:06
The Dev Method
Рет қаралды 12 М.
Message Passing With Rust MPSC Channels 🦀 Rust Tutorial
30:52
Trevor Sullivan
Рет қаралды 5 М.
GIANT Gummy Worm Pt.6 #shorts
00:46
Mr DegrEE
Рет қаралды 110 МЛН
ДЕНЬ УЧИТЕЛЯ В ШКОЛЕ
01:00
SIDELNIKOVVV
Рет қаралды 3,2 МЛН
哈哈大家为了进去也是想尽办法!#火影忍者 #佐助 #家庭
00:33
Rust: Weak References
19:40
The Dev Method
Рет қаралды 4 М.
Rust Data Modelling Without Classes
11:25
No Boilerplate
Рет қаралды 174 М.
Lifetimes in Rust Explained with Examples
6:56
cudidotdev
Рет қаралды 293
You Should Really Know These Traits in Rust
18:36
Oliver Jumpertz
Рет қаралды 14 М.
Rust Scoped Threads 🦀 Rust Tutorial
23:36
Trevor Sullivan
Рет қаралды 4,9 М.
Use Arc Instead of Vec
15:21
Logan Smith
Рет қаралды 147 М.
Async Rust Is A Bad Language | Prime Reacts
28:46
ThePrimeTime
Рет қаралды 98 М.
Why It (Mostly) Doesn't Matter How You Code In Rust
22:57
Oliver Jumpertz
Рет қаралды 14 М.
I spent six months rewriting everything in Rust
15:11
chris biscardi
Рет қаралды 431 М.
Choose the Right Option
18:14
Logan Smith
Рет қаралды 71 М.
GIANT Gummy Worm Pt.6 #shorts
00:46
Mr DegrEE
Рет қаралды 110 МЛН