Asynchronous Vs Multithreading Vs Multiprocessing (Concept and Code)

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ม.ค. 2025

ความคิดเห็น • 5

  • @redcrafterlppa303
    @redcrafterlppa303 8 หลายเดือนก่อน +1

    Multi threading on a single core isn't useless. Take the onions and tomatoes example. You could be making tomato sauce for a large kitchen and you need to continuously make sauce. Dicing all onions, then all tomatoes then making the sauce and then delivering it makes everyone wait. If you dice a few onions, a few tomatoes, make some sauce and deliver it you can serve customers continuously instead of in 1 go.
    The same goes for the operating system and multiple programs. You want the video to continue to play and be able to control the mouse and keyboard, even on 1 core. Multiple threading more specifically context switching makes that possible.

  • @lacasadepapel9365
    @lacasadepapel9365 6 หลายเดือนก่อน

    what is the difference between asynchronous and multiprocessing? since they are both parallel?

  • @aakashyadav2430
    @aakashyadav2430 8 หลายเดือนก่อน

    awesome!!
    it's been so long..

  • @redcrafterlppa303
    @redcrafterlppa303 8 หลายเดือนก่อน +1

    10:40 you are mixing language implementation details with the concepts you are presenting. Multi threading can run on multiple cores in parallel. In fact it was designed to be. The problem is that python is a poorly designed language that cannot utilize multi core cpus in 1 process. This has nothing to do with multi threading.
    The difference between multi threading and multi processing is that with multi processing you create multiple processes that each are full programms being scheduled by the operating system. These processes have nothing shared between them. While multi threading shares the heap between all threads.

  • @redcrafterlppa303
    @redcrafterlppa303 8 หลายเดือนก่อน +1

    12:30 you are mixing async vs sync with multi processing vs threading. Both have nothing to do with each other and make the example meaningless and confusing.
    Multi processing is almost always unnecessary and slow. Multi threading is way cheaper and faster. This is just a python problem not something between threading and processing. In any other language threading is faster.