Rust Threading Basics 🦀 Rust Tutorial

Поділитися
Вставка
  • Опубліковано 28 вер 2024

КОМЕНТАРІ • 23

  • @AryungChen
    @AryungChen 11 місяців тому +1

    Awesome !! Is it possible to have a tutorial about RC, ARC, ...combine with thread or mutex scenarios/example?

    • @TrevorSullivan
      @TrevorSullivan  11 місяців тому +1

      Good idea!!! I will have to prioritize that topic

    • @AryungChen
      @AryungChen 11 місяців тому

      @@TrevorSullivan thank very much... It's so great for series of rust tutorial. Clear, basic and easy to understand.

  • @a.lstudio4514
    @a.lstudio4514 Рік тому +6

    The best rust course in the world, the ultimate in simplicity and explanation ❤

    • @TrevorSullivan
      @TrevorSullivan  Рік тому +1

      Thank you! I am doing my best to provide quality Rust learning materials. 🦀 Rust on! 🦀

  • @severgun
    @severgun Місяць тому

    why work for main thread was in loop? It should be out of it

  • @Qwerty-of4ox
    @Qwerty-of4ox Рік тому +1

    I have a doubt here. As you have shown the CPU usage, like 3 CPU Cores were completely utilised when running two spawned threads and a main thread. So my doubt is, is Rust doing multi-processing in the background? I mean spawned threads should be running in a single process / core right? unless you specify you want to do multi-processing? So running each thread in a separate core makes it multi-processing right? I mean in Python when I try multi-threading it does create multiple threads but all of them run in a single CPU core, unless I bring the multi-processing
    By the loving the series. Hoping more videos especially on Tokio, Actix and maybe some small Rust Projects using these crates.

    • @TrevorSullivan
      @TrevorSullivan  Рік тому +1

      Yes that's considered multi-processing! Rust is simply creating more threads. The operating system kernel is responsible for scheduling those threads on various CPU cores. One interesting thing you could explore is restricting a process to use specific CPU cores. On Linux systems, you'd use the "nice" utility to specify which CPU cores a process can use. On Windows, it's called "process affinity." Thanks for your question and kind comments!

  • @vikinggeorge7007
    @vikinggeorge7007 10 місяців тому

    I know how threads work, but what's the difference between Tokio threads and Std threads?

    • @TrevorSullivan
      @TrevorSullivan  10 місяців тому

      Threads are just threads. In Rust, building async functions requires having an "executor" to drive the async function calls (Futures) to completion. Tokio just makes it easy to run async in a multi-threaded context. You're more than welcome to create and manage threads yourself though. It just depends on what you're trying to accomplish.

  • @ERAYKAAN850
    @ERAYKAAN850 Рік тому +2

    i started with the course (i am at the 3. video) and i like it thanks! Can you please not stop doing this (: Could you explain ownership too?

    • @TrevorSullivan
      @TrevorSullivan  Рік тому

      Great topic! Yes, I will cover borrowing and ownership. 🙂

  • @MoaresOliveiradaSilva
    @MoaresOliveiradaSilva 8 днів тому

    I wanted to see how to use the multiple threads to count the 500_000_000_000 together and ending quickly

  • @ImranKhan-br5dv
    @ImranKhan-br5dv 5 місяців тому +2

    now i understand what is multithreading and the importance of this in rust

    • @TrevorSullivan
      @TrevorSullivan  5 місяців тому

      I'm so happy you're learning! Thank you

  • @samzeng9918
    @samzeng9918 Рік тому +2

    Excellent lessons,thanks for your work!

    • @TrevorSullivan
      @TrevorSullivan  Рік тому

      Thanks for joining me for the journey! 🦀Rust on!🦀

  • @VickyGYT
    @VickyGYT 5 місяців тому

    I must say Golang has much superior parallel and concurrency support

    • @Morbsel
      @Morbsel 4 місяці тому

      These are just the basics lol

  • @anjonsarker2374
    @anjonsarker2374 Рік тому

    Brilliant

  • @johnnielondon9840
    @johnnielondon9840 11 місяців тому

    Really clear tutorial and style. Thanks for taking the time to publish all this content. A question - what extension are you using in VScode for syntax hinting? I’d like to try that. Thanks again!

    • @TrevorSullivan
      @TrevorSullivan  11 місяців тому

      Thank you so much! I'm using the Rust Analyzer extension.