Python Asynchronous Programming - 1 - Process vs Threads

preview_player
Показать описание
In order to understand asynchronous programming better we are going to cover some basic concepts. In this video we learn about process and threads and how they are different from each other.

- Processes are isolated and canot share memory with other processes
- A process can have 1 thread or multiple threads that share the systems resources.

Next video - Synchronous vs Asynchronous

Рекомендации по теме
Комментарии
Автор

you are wrong here, even python don't support simultaneously run multithreads ( CPU tasks, you can run i/o task simultaneously ) together so that you don't end up with race condition. in your example here you created 2 threads but as CPU can use by multiple threads, CPU cores assign to both of threads but different time. even that loop threads not completed with his task CPU will assigns to other tasks and CPU will save its state. Now when that threads comes again it will execute from their, and also meanwhile CPU used by other threads like which includes print statement. that's the reason we can see print statement. that doesn't mean we running both the threads together!

smle_with_me
Автор

Thank you! It's very well explained.

TheHeroIsRisingUp
welcome to shbcf.ru