Hi, everyone. In the last videos we talked about concurrency, parallelism and concurrency versus parallelism. In this video, we're going to be talking about synchronous and asynchronous coding patterns. So when you write a C, c++ Python code in a functional programming language kind of a way, what happens? So in our analogy, these are functions, function one function to function three and function four, right, and then the size of the function or the size of the rectangular block, says that how much time this function takes versus how much time this function takes. So let's say this function is bigger than this function, which means that function one takes more time to finish and function two.
So if you say function one, then function to function three, then function four. In a standard synchronous programming paradigm function one is going to execute and then function 234 are going to wait for function one to complete. When it completes, function two is going to run, three and four are going to wait. Then function three is going to run Food is going to wait. And then finally four is going to run. So, if you take a look at the timing, then it takes a lot of time for this execution to actually complete.
Now taking a look at asynchronous programming paradigm, take a look at this. So, if rather rather, executing these functions in one in the order of 123, and four, we execute these at the same time in an asynchronous fashion, look what happens. So, function 123 and four are running simultaneously in a concurrent kind of a way, right? So it might be like this, it might be like this. Right? So function one runs function two and three, are executed at the same time.
They don't need to worry about if function one has been is being called or has returned something or not. They're called irrespective with function one, function four is also being called at the same time asynchronously. So all of these four options are running asynchronously, they don't need to wait for these other functions and they have no idea about these other functions. And to, to have them get the idea about the other functions is what is known as inter process communication. So let's say I have this function to which needs something from function one, and as well as it needs something from function four. So, it can take those things in in a process, which is called IPC or inter process communication.
And then if you take a look at this, the timing is nowhere near close to the synchronism packet. So asynchronous patterns are really good when you're looking at web development or when you're looking at bulk tasks or tasks which take a lot of time so that you don't have to wait for those tasks to happen. You can do this in a fire and forget manner. So fire means calling a function and then forgetting means that okay, you call it a function, you don't need to worry about the completion of the phone. You can immediately start calling other functions. And you don't have to worry about them being completed as well.
But as soon as all of these functions are completed, you can run another function which would say that okay, return zero or something like that. done right. So this is a synchronous pattern versus a synchronous design pattern. So, in the next video we are going to be delving into go and how to implement and how to do go routines and asynchronous programming paradigm in golang in a practical kind of way, so stay tuned and see you guys in the next video.