Asynchronous Programming in Python
When we talk about program execution, “asynchronous” means that the program doesn’t wait for a particular process to complete, but carries on regardless. An example of asynchronous programming is a program writing to a log file: Although it’s possible it might fail (for instance, because the log filled up the disk space), most times it doesn’t, and you can write your program to call the log routines asynchronously (or ‘fire and forget,’ as I call it). Asynchronous execution means the main program runs a little faster. Your logging code should be written so that if it does fill the disk, it just stops logging rather than crashing. Running asynchronous code usually involves threading if it’s a single core; with multi-core, it might get handled by another process running on a different core. A single core can only read one set of instructions at a time and execute. It’s like reading a book; you can only read one book at a time. If you’re reading one book, and someone passes you a...