You are so right. But well the TPL example was super loaded
with 1 million time more but still performed better. So it sill conveys the same message TPL is better.
So sorry i was so engrossed in the demo……Should avoid night recordings.
"P2" is typically used to refer to the "Pentium 2" processor. A processor with 2 cores is referred to as a "dual core" processor and a system with 2 processors is referred to as a "dual processor" system (a dual processor system can have more than 2 cores).
To increase utilization, you should create multiple threads. As you have 4 cores, creating 4 threads with each running the RunMillionIterations would show you a high CPU utilization.
Good video showing concept of TPL but in this example diagram showing running multiple cores of 1/2 millions iterations each but code shows running multi cores of millions iterations which I don't quite follows. How do you knows that tasks of computing spread equally.
Correct me if am wrong, Parallel.For runs from 0 to million each time it calls a function RunMillionIterations(). This means that the each function call will be divided among processors/ available threads. However, i see the explanation saying the whole iteration is divided among iteration that is kind of confusing.
Author seems to be under impression that PII processor means processor have two cores. Rather PI to PIV are all single core processors, only after arrival of dual core pentiums we had multiple cores and later it was followed by core 2, I3,I5,I7.
After inserting the Parallel.For-Call the total amount of iterations is 1,000,000 * 1,000,000. For unexperienced viewers leaving the old for loop in the program could be confusing.
Questpond has top notch videos and the explanations are among the best anywhere. Especially the design patterns series – simple to grasp some complex subjects! Excellent job Questpond! I'll likely sign up with them shortly.
There seems to be a misconception here, when we spawn a new thread like shown in first part off video, it is not for completing task faster, it is just for making calling thread free and assigning task to another thread. By this its obvious that all cores of cpu will not take same load. Because spawned thread running on one core is processing assigned task and meanwhile calling thread finishes with main function.
The explanation here is not correct. He took a single threaded "for loop" and placed it on a single thread. Well, that is in fact multi threading. Your fist thread is the thread of your application itself. The second thread is the "for loop", for a total of 2 threads. What you are really talking about is parallelizing work that is "normally" single threaded, which is distinctly different.
Nice video. thanks to the creator. However, it raises a few questions:
1. What if I wish to run a task forever according to its own logic (in which case the 'For" of the Parallel.For is not required). Thus, I need a one time launch … and let the thread run as long as its own logic says so.
2. How do I enquire a core's overload to correctly set task-core affinity?
3. Which API is used to set affinity?
4. I don't understand why the Parallel.For is used … there is a for () loop statement in the task's code?
5. It is unclear to me from the core overload chart whether we see 4 identical tasks running on 4 cores concurrently?
If this is a single task running on all 4 cores. then: (a) what exactly controls splitting its work among cores and then combine the results as if it was executed on a single core. (b) how come the overload of all cores is similar to the overload of the execution of a single core. Where is the benefit? in the execution period length?
thank you for this explanation!!!!
Its a dope video awesome.
awesome..
not able to access this video. it says an error occurred
you should have put the parallel for inside the run million iterations… technically you are showing two diff examples…..
You are so right. But well the TPL example was super loaded
with 1 million time more but still performed better. So it sill conveys the same message TPL is better.
So sorry i was so engrossed in the demo……Should avoid night recordings.
thank you for this explanation!!!!
Hi, Great video, where are the other parts to it?
"P2" is typically used to refer to the "Pentium 2" processor. A processor with 2 cores is referred to as a "dual core" processor and a system with 2 processors is referred to as a "dual processor" system (a dual processor system can have more than 2 cores).
To increase utilization, you should create multiple threads. As you have 4 cores, creating 4 threads with each running the RunMillionIterations would show you a high CPU utilization.
It plays for me. Must have been just a YouTube error.
Where is the 2nd part of this video? I cannot seem to find a link for it. Thanks.
examples show are different but proves the point anyways that TPL has better performance than threads.
Good video showing concept of TPL but in this example diagram showing running multiple cores of 1/2 millions iterations each but code shows running multi cores of millions iterations which I don't quite follows. How do you knows that tasks of computing spread equally.
how to implement, below code using TPL. Any Idea?
foreach (GridViewRow row in grdSearch.Rows)
{ //do smth
}
P8, hehehe :p
You are awesome sir.. really you always explain complex things in simple way. that a layman can understand.. thank you for sharing ..
thank you for this great video, very well done!
good tutorial .. liked it !!
awesome. love the explanation of all your videos.
Correct me if am wrong, Parallel.For runs from 0 to million each time it calls a function RunMillionIterations(). This means that the each function call will be divided among processors/ available threads. However, i see the explanation saying the whole iteration is divided among iteration that is kind of confusing.
I think we do not need "for loop" in the method while we are using parallel class in the example mentioned in the video..
Author seems to be under impression that PII processor means processor have two cores. Rather PI to PIV are all single core processors, only after arrival of dual core pentiums we had multiple cores and later it was followed by core 2, I3,I5,I7.
After inserting the Parallel.For-Call the total amount of iterations is 1,000,000 * 1,000,000. For unexperienced viewers leaving the old for loop in the program could be confusing.
Nice video with ample of information demonstrating comparison of legacy multi threading and modern TPL
This video really helped me. Thank you !
What a nice tutorial!
How do thread branches execute? If I spawn a thread from a thread does it time slice or does it parallelize. I guess I could experiment and find out.
If you spawn two or more threads manually it will parallelize but you will need callbacks unless its fire and forget.
nice explanation. Awesome work.
video for mutex semaphore, semaphoreslim is missing in questpond.com. Pls put it back
P2(intel Pentium 2) is single core btw
Good video. Liked the perfmon demo.
great video,
Questpond has top notch videos and the explanations are among the best anywhere. Especially the design patterns series – simple to grasp some complex subjects! Excellent job Questpond! I'll likely sign up with them shortly.
Where is the second part of TPL video?
really good video. what i suspected was happening but very clever way of proving it.
I love your concise to the point tutorials….Very helpful.
There seems to be a misconception here, when we spawn a new thread like shown in first part off video, it is not for completing task faster, it is just for making calling thread free and assigning task to another thread. By this its obvious that all cores of cpu will not take same load. Because spawned thread running on one core is processing assigned task and meanwhile calling thread finishes with main function.
The explanation here is not correct. He took a single threaded "for loop" and placed it on a single thread. Well, that is in fact multi threading. Your fist thread is the thread of your application itself. The second thread is the "for loop", for a total of 2 threads. What you are really talking about is parallelizing work that is "normally" single threaded, which is distinctly different.
Excellent 👌👌
how to implement this in infinite loop?
Is this code not doing 1 million * RunMillionIterations() I think you can drop the one of the for… probably the one inside RunMillionIterations
Good one 👍🏻
Fast-forward to 8:31 if you already understand threading and using perfmon and actually wish to get to TPL.
In the first example you run a single thread and in the second you run MANY threads
Good video
I have to say that concatenating a string with s = s+"x" one million times is absolute a killer for memory and GC
Please set your second video here
Nice video. thanks to the creator. However, it raises a few questions:
1. What if I wish to run a task forever according to its own logic
(in which case the 'For" of the Parallel.For is not required).
Thus, I need a one time launch … and let the thread run as long as its own logic says so.
2. How do I enquire a core's overload to correctly set task-core affinity?
3. Which API is used to set affinity?
4. I don't understand why the Parallel.For is used … there is a for () loop statement in the task's code?
5. It is unclear to me from the core overload chart whether we see 4 identical tasks running on 4 cores concurrently?
If this is a single task running on all 4 cores. then:
(a) what exactly controls splitting its work among cores and then combine the results as if it was executed on a single core.
(b) how come the overload of all cores is similar to the overload of the execution of a single core. Where is the benefit?
in the execution period length?
Nice. Many thanks!