 Hey everybody, it's Brian and welcome to the 29th Qt Tutorial with C++. We're continuing our conversation on the Qthread class and what you see before you is the program we created in the last tutorial. So if you haven't watched that one, I'm going to real quickly go over this. We've got our main.cpp which we are including a mythread.h and we're just creating three versions of that thread as a name variable, so we're setting the name three times and starting it. And it's a very simple class. It just inherits Qthread and it overrides run. And when we go in here the run function simply prints out running with the name and then it prints out the name and the current number and it loops for a thousand times. Alright, so now that we've covered all that, let's talk about priority a little bit. Remember from our last conversation when I showed you Task Manager, each process had a certain priority. Well you can specify how you want these threads to run. So let's just take the first thread and we'll say Qthread and we'll say highest priority. So we're going to say thread one has the highest priority. So when the CPU is granting out time slices to not just this process but to each thread it's going to say thread one has the highest priority. And let's actually say thread three same thing. I want to show you what's going to happen here. So thread one and thread three have the highest priority. Thread two is just normal. So let's run this. And when our application runs, you notice how everything stops except for two. Two keeps going and going and going and going. Well, that's because remember we said thread one and thread three have the highest priority. So they're going to get more of the CPU's attention than thread two. So that is how priority works. And there are multiple levels of priority. There's highest, high, normal, low, inherited. So you could say lowest priority for thread three. And let's go over this real quickly. Thread one has the highest. Thread two has inherited which I believe is just normal for this process. And thread three has lowest. So it means thread three is just going to take a long time to execute in comparison to thread one and two. Compile and run. And you see sure enough thread three was the last one in the race here. So that's how priority works. It's actually a pretty simple concept, but you need to understand how and why you would need priority. For example, if you are doing a network communications you want that communication to just be rock solid, you would probably give that a higher priority. But typically in the real world, you don't mess around with priority that much. So this is Brian. Very short tutorial, but very important subject. Thank you for watching. I hope you found this video educational and entertaining.