Hello and welcome to Golang programming language course in this session.
We want to talk about concurrency concept.
Concurrency.
Concurrency means that the application has more than one thing to do at the same time.
It's about creating multiple process, executing independently.
Applications might be dealing with lots of processes together to accomplish the intended behavior.
First, we define an exemption.
Imagine I am reading this tutorial and my phone is ringing.
I will start reading and answer the phone, and then I start reading again.
Now I am dealing with two jobs, reading and answering phone.
Why sometimes is Slice, which is said to be concurrent?
JOTS Point to note here is that these two words reading and answering are not being done at the same
time when things are being done at the same time.
It's called parallelism teens watching TV and eating fruits.
So concurrency is dealing with multiple things at once and does not need to be done at the same time
with some time a work and parallelism.
I am doing multiple things.
At the same time is a subset of this concurrency and parallelism that turns concurrency and parallelism
are used in context of multi-threaded programs.
However, there are quite different.
Concurrency applications.
Concurrency means that multiple processes or threads are making progress concurrently, while only one
third is executed at the time by the CPU.
These stories can be sorted in and out as required.
This means that no thread is actually completed totally before another is scheduled.
So all the threads are executing concurrently.
Let's assume that you have a single core system.
Multiple task needs to be accomplished, but we have a constraint where at any moment in time, only
one test can be executed in the single core, available in a concurrent execution model.
There is context switching between the tasks, so the application is dealing with multiple tasks but
not executing them together.
As we have only one executing core.
The context switching is so quick between the tasks that it feels like the tasks are running.
At the same time, the factor of parallel execution is missing during the execution as we have a single
core system.
We cannot have parallel processes running together in the restoration above concurrency without parallelism.
There are two tasks that need to execute concurrently at any moment in time.
Only one task is running and there is a constant switch between the tasks.
Parallelism applications.
In cases where we are working with senior corps, we have resource constraints.
If we add more cause to the system, we will have more resources for the application and can be enable
multiple tasks to execute at the same time on different course in the illustration above.
If you have two tasks that are running together at any moment in time, the tasks are executing in parallel
of different course while working with goal line.
We can scale up the application from concurrent to parallel execution easily.
This capability can go.
Land can be achieved with ease in order not to prolong the time of decision.
We will finish it and we will continue the content in the next session until next session.
Goodbye.