Rust Threading Basics 🦀 Rust Tutorial

Поделиться
HTML-код
  • Опубликовано: 12 сен 2024

Комментарии • 22

  • @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! 🦀

  • @ImranKhan-br5dv
    @ImranKhan-br5dv 4 месяца назад +2

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

    • @TrevorSullivan
      @TrevorSullivan  4 месяца назад

      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!🦀

  • @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. 🙂

  • @AryungChen
    @AryungChen 10 месяцев назад +1

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

    • @TrevorSullivan
      @TrevorSullivan  10 месяцев назад +1

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

    • @AryungChen
      @AryungChen 10 месяцев назад

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

  • @Qwerty-of4ox
    @Qwerty-of4ox 11 месяцев назад +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  11 месяцев назад +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!

  • @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.

  • @severgun
    @severgun Месяц назад

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

  • @VickyGYT
    @VickyGYT 4 месяца назад

    I must say Golang has much superior parallel and concurrency support

    • @Morbsel
      @Morbsel 4 месяца назад

      These are just the basics lol

  • @anjonsarker2374
    @anjonsarker2374 Год назад

    Brilliant

  • @vikinggeorge7007
    @vikinggeorge7007 9 месяцев назад

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

    • @TrevorSullivan
      @TrevorSullivan  9 месяцев назад

      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.