This video should be one of the initial videos of this Playlist. When we have already learnt about the mutex, this video isn't much useful at this point. Anyways, the video was good. It was just not correctly placed.
May be the 5th video in this Playlist.. Thanks for taking the feedback in a positive way and actually willing to act upon it. Few are so humble to do this. Really appreciate 👍
@@13taras I want to elaborate more. If you study computer architecture and operating systems, you will be introduced to the concept of "atomic operations". These are operations that are indivisible. They are done at once. The processor cannot partition them. Now, for simple architectures (and designs), almost all operations are like this. But for more complex architectures (and designs) like x86, some operations can literally be interrupted in the middle when the OS scheduler switches threads. Atomic operations cannot be divided. A mutex is an atomic object. It is one that is acted upon only by atomic operations. This is why it is impossible for it to be locked by two threads/processes at the same time. If one thread executes the operation to lock it, it is impossible to interrupt that operation and that thread will lock it before the OS switches execution to any other thread. Hope that helps.
Hi Sir, Could you also start making videos on pthreads. When it comes to linux system programming pthreads are considered more than C++ threads. If possible also a video on difference between C++ and pthreads.
Sir, Shall we use mutex to synchronize data b/w process ?? Bcz each process has its own memory space....Please any one answer to this ...I was asked this in interview
Using mutex guarantees that no other process enters while some process is accessing the critical section That is the data is synchronized.i.e. Data changed is in the flow and and no race condition is happening. Every process has its own memory space. And any of the process might access the Critical Section (1/1000000) times the cpu speed.
Title is a bit misleading, because I thought you would talk about OS Processes (PID, TGID, etc) vs threads (like POSIX threads), but video is good anyway, thanks.
Hi, so I tried this in my own machine which supports 2 threads per each core but the results are as follows: Case 1: Single threaded process Time taken: 5 Seconds Case 2: 2 Threads, one for Even sum and another for odd Sum Time Taken: 7 Seconds Can anyone please explain this behaviour?
It would be better if this video be at the beginning of the Playlist
Yaa may be correct.
got the same impression
Great video, hope to see more. Your explanation is very clear and concise.
Awesome, thank you!
Hi brother I have a decent knowledge on c++ but I want to become an expert how do I get started.Thanks in advance.
More practice!!!
Learn more design patterns and implement in your own way and with different problems.
go through boost library.
This video should be one of the initial videos of this Playlist. When we have already learnt about the mutex, this video isn't much useful at this point. Anyways, the video was good. It was just not correctly placed.
What place exactly, i will move there.
Thanks.
May be the 5th video in this Playlist..
Thanks for taking the feedback in a positive way and actually willing to act upon it. Few are so humble to do this. Really appreciate 👍
Pleasure..
Is it ever possible to have a situation where thread1 and thread2 happen to lock mutex at the exactly same time and cause a deadlock in this example?
No
@@CppNuts Thanks!
@@13taras I want to elaborate more. If you study computer architecture and operating systems, you will be introduced to the concept of "atomic operations". These are operations that are indivisible. They are done at once. The processor cannot partition them. Now, for simple architectures (and designs), almost all operations are like this. But for more complex architectures (and designs) like x86, some operations can literally be interrupted in the middle when the OS scheduler switches threads. Atomic operations cannot be divided. A mutex is an atomic object. It is one that is acted upon only by atomic operations. This is why it is impossible for it to be locked by two threads/processes at the same time. If one thread executes the operation to lock it, it is impossible to interrupt that operation and that thread will lock it before the OS switches execution to any other thread. Hope that helps.
@@m0st4fabeder Thank you
How do I do it with process though?
Could you please make a video on semaphore ? Please
Yeah sure it is there in my list but right now I am busy with data structure and algorithms.
Hi Sir,
Could you also start making videos on pthreads. When it comes to linux system programming pthreads are considered more than C++ threads. If possible also a video on difference between C++ and pthreads.
Yes actually threading is always similar in all the platform just syntax difference.
Please share links of Playlist/videos on data structures, design pattern if any?
Please check description of the video, you will get design patterns video, and DS & Algo is not fully covered.
Thanks.
Sir, Shall we use mutex to synchronize data b/w process ?? Bcz each process has its own memory space....Please any one answer to this ...I was asked this in interview
Great question
Using mutex guarantees that no other process enters while some process is accessing the critical section
That is the data is synchronized.i.e. Data changed is in the flow and and no race condition is happening.
Every process has its own memory space. And any of the process might access the Critical Section (1/1000000) times the cpu speed.
Hi Sir, Can you please bring us some videos on c++ streams classes?
Sorry, actually i am working on a playlist, which includes interview questions on DSA.
It will take so much time to complete these series first.
@@CppNuts there are very few videos which explain the usage, hierarchy and working of stream classes..would be really help if u plan to do so
Title is a bit misleading, because I thought you would talk about OS Processes (PID, TGID, etc) vs threads (like POSIX threads), but video is good anyway, thanks.
Hi, so I tried this in my own machine which supports 2 threads per each core but the results are as follows:
Case 1: Single threaded process
Time taken: 5 Seconds
Case 2: 2 Threads, one for Even sum and another for odd Sum
Time Taken: 7 Seconds
Can anyone please explain this behaviour?