Understanding Windows Applications Day 3 Hardware subsystems

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
let's take a look real quick i want you to look at this description because it really does help you understand hyperthreading technology is a technique that enables a single cpu to act like what it really is a and this is all hardware engineering at the microprocessor level this is intel engineers this is amd engineers they're the ones that are coming up with this technology a cpu is made up of many smaller components this is very important at any given time one of these components may be busy while another component is waiting to be utilized this to a hardware engineer is a horrible waste and so they are looking uh intel spends a tremendous amount of time analyzing this cpu and it's incredibly complex structure to see how can we redesign it how can we optimize it how can we redesign the way our processors work so that we don't have chunks of circuits just sitting there doing nothing okay so a tremendous amount hyper threading enables different cpu parts to work on different tasks such as threads we talked about threads in this way a cpu with hyper threading appears to be more than one cpu here's some cool things a cpu with hyper threading has two sets of circuits that keep track of the cpu state we've already heard that word processor states that when we run code through a cpu think of the challenge i want you to stop for a minute i'm running word through a cpu and i'm running various threads of that word processor through the cpu we have to be very careful that we're not executing something about the word processor first before we execute another part of the process ahead of time so everything has to be looked at as to this needs to be executed first so the results of this will be ready when we execute the second thread next timing timing is very critical the software engineer has to think about this the intel engineer has to think about this to make sure that we're not executing code ahead of time because we're executing code at the same time are we not yes that's the whole idea of hyper threading the whole idea of dual cores is i can at the same time execute code well if i'm a software engineer and i need to calculate one plus one so that i can add it to another function and i do the calculation first and then do the one plus one next or i do them at the same time and they're not ready my software is not going to work right so when you get into multitasking hyper threading it gets very complex intel spends a lot of time monitoring what is being run and should it run at this time because now with multiple cores and multiple cores with hyper threading we add another whole layer of complexity to the software developer and intel has to help them to make sure that we don't run code at the wrong time because now we can run a lot more at the same time these circuits do not accomplish the cpu's actual work they are the temporary storage facility where the cpu keeps track of what is currently working on i'm not going into depth in this but i want you to understand by solving one problem we're not raising the clock speed of the cpu instead we're work we're creating more cores that seems like a simple solution that fixed it no that made it much more complex now the cpu designer who's writing multi-threaded applications has to be very careful that i don't execute us a portion of code um that's that needed another chunk of code executed before it because now we can execute multiple threads at the same time that gets really complex so hyper threading is very very interesting it was developed by intel and amd here is something that is very interesting about hyper threading intel only has to duplicate five percent of its cpu circuits to gain what it appears to be two more cores so is that attractive from a hard hardware engineer perspective is that attractive absolutely five percent of the circuits to get what looks like another cpu absolutely is huge i'm going to very quickly run through ipc remember it's those inner process communications and the rigid rules between one process and another that gives us stability that's what's changed everything so there is an open software foundation where linux people sit down with microsoft people that sit down with the mac people that sit down everybody actually sits down at the same table and they're nice to each other okay they set up a series of standards and rules whereby when i write my applications in linux if they need to they could talk to a windows platform application and vice versa if we don't build those standards we won't have inter we'll we'll be dependent on operating systems and their rules and we won't really have that interplay and interchange that we have now so there is a standards body that sets up ipc's listen windows may say here's a list of ipc's we're going to use five of them we're not going to use all 10 of them linux can say you know what we know that windows uses these files we'll use these five but we're going to use additional three we're going to use eight okay of the ten and then matt can say we want to use all ten is everybody there so no one's held to it but it is an important process ivcs are based on standards i did throw i'm gonna this isn't in your notes but i did find some microsoft tech net information on msdn's site that gives you some additional information on what ipc's did microsoft choose to support here's a quick rundown clipboard you guys use it every day copy and paste from chrome to word you just used clipboard how many know how to see their clipboard and clear their clipboard i see a lot of hands how many know how to look at that all right i'm going to show you how you're ready okay okay why would you need to clear it huh do you need to clear it absolutely in fact how many times just let me ask you this you went over to chrome you said copy and then you paste it into word and it was totally wrong you thought where did that come from yes how many have done that how many checked their clipboard to see if the information in their clipboard was what they wanted to copy and paste no you didn't you just got junk over there and said where did that come from yes all right how about learning how to deal with your clipboard here we go so your clipboard can be accessed from everyone see this little what does that say right there clipboard how many ever paid any attention to it of course you did it's so ingrained word i'm in word i'm going to open it up and guess what i can see what's in what there it is just a few minutes ago i went to a website copied and pasted copied a url and it went into what and if i don't like what's in clipboard which i look at all the time i can do what and if i decide to go to anything like i'm going to go to ie and i'm just going to select some material here and i'm going to come up and say copy everybody there guess what's in my clipboard so when you shut your computer down it doesn't delete it yes it does oh okay so clipboard is a very temporary memory location in your operating system and it allows one process to communicate to a another process and now you know how to get to your clipboard and look at that before you paste yes yeah but know the program about that option right i'm sorry no the program has this option actually you can go and find there's lots of third-party clipboard tool sets if you don't have word and you're not you don't have that access to clipboard you can download a number of third-party there's some really good ones that open the clipboard allow you to see it you can delete it you can clean it out but since you all have office 2013 and i've given you the ability to get office 2016 at home you all have access to clipboard clipboard right there that's the dreamspark right i sent all of you a word document showing you how you could get it for free there you go if you haven't got that send me an email and i'll make sure you get it so mr equipment yes please that's right in fact you can use word to watch anything that goes on clipboard okay if i go into any other application and use clipboard and i go copy i can open up word and see what's in my only way to get to it that is a very good question word because we in word don't we use clipboard a lot yes microsoft decided their office team said you know what the people that use office need to see what clipboard it's the only way you can see it now there are third-party applications you can go out search google and you can find a number of third-party applications that allow you to access your clipboard so you didn't know you've been using ipc all the time yes clipboard how about that how about it so you have com you have data copy i'm not going into depth with these because everything i'm talking now is programming language okay we sat at the table of programmers this is the kind of verbage they would be using they'd be using dde they'd be using file mapping they'd use the word mail slots and you'd think gmail no no this is ipc is that it's not gmail mr ben no it's not gmail okay this is inter-process communication these are all things like anonymous pipes named pipes listen these words mean nothing to you now but i promise you as you're in this field you're going to hear those all the time you're going to see an article you're going to see a discussion on a problem and they're going to be talking about name pipes you're going to say i've heard that somewhere i've heard that so i'm talking all programming language rpc very very important this is how one application on a network talks to another process on your pc nine times out of ten is going to use things like windows sockets rpc these are very common terms in our field i rail i realize they're very new for you but they're very common in the i.t world so these are different ipc's i'm not going to go into depth with them yet because you're all looking at me going what in the world is he talking about is he talking cuban is what language he is talking nonsense those are ipc's that allow processes to communicate and don't forget processes talk to other processes across the network so name pipes rpc they're huge when i have an application on an sql server and i've got a access database on your desktop and you're accessing that sql database you're using a lot of those enter process communications can ask your questions yeah you did say the developer if i follow you they don't have to use they use like one they use five over here and another may use a different set of five right two that's correct uh developers have the option of using for various reasons different types of ipc's well they're going like um but it's a parallel course to get to the same place i imagine they want to all be speedy about it right so very much okay so i just want to make sure i got that concept yeah pick and choose so some of those ipc's are very microsoft is very very careful about making them based on open standards for example rpc very very important inter-process communication channel it's very very they they're very meticulous to make sure it meets the open operating system foundation standards so that if a linux application is trying to communicate to something on your platform it when when they talk rpc they're they're talking the same language so some of these are rigidly founded on those open standards okay so there's there's that uh compatibility now let's get back to some real practicals processes we have lots of tools such as task manager resource monitor they are all about one thing allowing you to see how processes impact the five hardware subsystems five hardware systems we have five major hardware subsystems one [Music] one more hardware subsystem it's not up there where is what is it i'm waiting cpu memory disks services network what's the missing hardware subsystem that's not up there phone what no hardware something on the motherboard video years ago think about it ten years ago was video important no if you could get red blue and green on the screen you were happy okay today is video important yes very very important when i render one of these videos i am very concerned how the processes are impacting my gpus okay so the missing one here in fact it's missing from task manager listen it's missing from resource monitor so i'm actually going to have to show you a new tool so that you can monitor how do processes impact your gpus but right now we need to know how do these processes impact cpu memory disk and network and that's what our tools are all about so let's go take a look this is task manager i'm going to get rid of the other ones and you can notice right away microsoft is very concerned about letting you see how are my processes impacting my cpu my memory my disks my network all of that is important and notice this information right here this is for you grandma does not look at this okay you don't have a clue one we're looking at the speed of the cpu why is it changing brandon because it's being used why is the cpu changing because they're going through it [Music] the process is processes are exchanging right and the different background coding thread why is the clock speed of that cpu changing the amount of activity about four years ago about maybe even i'll say i'm guessing but i'm thinking probably i'm close about four years ago microsoft began to really radically change its idea on how it clocks the cpu and it introduced the idea of of a variable clock on the cpu why what was its goal power efficiency in the old days this never changed it was 2.7 all the time no matter what you did but because of the need to save battery life the need to save power in general to be more energy conscious intel began to design a variable clock on their cpu and what they do is based on the load and a lot of you mentioned that based on what it's doing this circuitry will actually speed the cpu up or slow it down and that's why we are seeing a variable clock speed on our cpu this is directly related to how much work the cpu is doing so if i was rendering a video this would go to the highest speed and stay there flat if i'm doing relatively nothing you'll see the speed of the cpu stay at it'll vary up and down based on its on the need so this type technology is becoming almost a common platform even on servers it was unheard of to do this for servers but microsoft i mean intel is now doing this even for the server platforms they're all variable clock speeds we see our utilization we see how many processes are running we need to always pay attention to this when you go to a computer and you see 121 130 processes it's going to be a slow computer friends wait 90s almost that much that's right typically i would say with the basic applications you should see about 86 processes when you see 91 100 110 whoa these are application uh it's very it's got a lot a lot of software running okay not installed did you hear what i said it's got a lot of software running not talking about what's installed i'm talking about what's running right now against your processor so that is very important to look at how many processes are running number two how many threads how many handles we'll talk about this in fact you better start learning what's a a normal value of threads let me give you an example my son i was working with my son on a server issue it kept rebooting so the folks at the school were not happy because about every hour the server would reboot kick everybody off and sometimes they would lose work they would lose their data and of course they loved the technician about that time so we looked uh we remoted into the server and his his processes were good he had about 56 processes running on its server that's about average for a server but his threads were 200 000 what the minute i saw two hundred thousand threads we had a problem what did it end up being it had it ended up being an application that was installed that was corrupted so you must pay attention to this learn what is normal you should know about how many processes you have what's what's the average threads that are in other words like this what we call baselining i i install office i install windows 10 i install my office i install my basic applications then i open this up and i look at it what is normal did you hear that what is normal okay that's how many processes how many threads so many handles now you have a baseline for what is normal so when you have start having issues and you realize your handles are running at a hundred thousand you know something's wrong right away you know you don't have to guess you know you've got a problem with handles it's way over normal yes if you were troubleshooting a system that you didn't know what the base was uh as soon it's a computer would you be able to move into safe mode to get a great question um because a lot of that baselining knowledge will come with just experience for example if you deal with servers when you've got sql installed you're going to know that typically and remember with servers you're going to have a server operating system one app that's it a server operating system one app so it's going to be easier for you to say oh i've got an instance i've got an instance of sql installed or i've got an instance of of uh of opensql you know an open source version and i kind of know what it should be just by experience i can look at windows machines and i can tell you right away whether these are right or they're within ballpark so start looking at that start paying attention to that that's why microsoft is putting it here okay questions wait so that's kind of the normal number that's kind of normal yep uh this is a little bit high but it's you know a teacher station the threads and handles are normal the threads are about normal the handles are about normal this is pretty normal when you see this really really high 3000 yeah or you see handles way over 60 70. now listen to me i'm going to explain how to look at apps and understand what they're going to do here okay so hang on i'm going to teach you how to understand for example if i open up a command line a command prompt i'm going to teach you how to look at that and say i i know about how many handles are going to be and how many threads on the other when i open up sony movie studio 13 which is a video editor that's a big difference okay and i i'm going to show you how you can look at this and this and say that's okay i'm trying to connect the dots with this so i'm thinking context like switch like you told us don't go there yet okay we're gonna get into this i'm gonna we're gonna delve into this and understand you're gonna understand this and you're gonna understand that okay so what i'm working at is helping you understand this right now you're gonna show us how to know what application counseling absolutely i'm gonna show you because i'm gonna demonstrate i'm gonna we're gonna look at cmd we're going to run the command prompt and i'm going to show you how many threads are running and how many handles it has and when i do you're going to say well of course that makes perfect sense once you know what this is yes and then when i say we're going to run movie studio 13 uh platinum edition and i'm going to say we should see about this and and you're going to see a whole lot more of this you're going to say well that makes perfect sense okay so hang on i'm going to show you right now we're trying to understand how these impact what hardware subsystems now what what's missing video so process explorer process explorer from mark versanovich he has recently rewrote his um his tool and he has added gpu support so if you look here this is process explorer this is listen very carefully process explorer is simply task manager and resource monitor on steroids so if you recently downloaded system externals it's probably fine okay cool yeah so if you downloaded it two years ago it's old if you downloaded it last this year it's fine now watch what happens when i open up the the gui resource system information i'm going to double click that icon and we see that mark has added what now i can look at how processes are impacting what my gpu i can see my gpu usage so you guys are running games you need to fire this up and take a look you can also see your gpu dedicated memory and if your gpu is also using your motherboard ram you can actually see how that is working okay so we can now for the first time look at our gpus and he can actually do some really really cool additional things with this button called engines so he has added some really really cool additional metrics and information about our gpu which none of our other tools allows to see okay so you notice up here when i hit the tabs you can see all the things you expect cpu we can look at memory we can look at io which is disks and a network remember io is disks and network and now we also have gpu now in the summary he shows you a quick picture of how all of your processes are impacting your hardware subsystem so this is very cool and of course he gives us the same bit of information handles threads processes he also gives us that context switch when a process goes to the scheduler and says i need to run when the scheduler allows a process to go from waiting to running that is called a what context switch it's an event it ran this is very very important then we'll look at interrupts remember how i told you when kirsten moves her mouse that preemptive multitasking operating system says again we gotta move the cursor on the screen that is where she is going to send a what an interrupt to tell the cpu when that mouse moves the driver sends a signal to the preemptive multitasking scheduler and says huh you got to run the mouse driver you got to get the cursor moving because she just moved that like why even use task manager why not just use this it seems to have more better more information on it absolutely correct so what does mr v use all the time i use process explorer but when i go to my when i go to a friend's house they don't have process explorer and i don't bring my flash drive with me every time i go to my friend's house i probably should because half the time i'm troubleshooting their pcs but let's say i go over there and i don't have it i'm going to use resource monitor i'm going to use task manager yes okay uh but do what do i use process explorer okay can you click on the show one graph per cpu yep so we'll take a look because it's going to show us how many cpus and hyper threading so this particular has an i5 so it has two cores but each core is hyper threading so it appears to windows as if you had what four cores now listen this is very cool you can turn this on listen very carefully you can turn this on and you can see how well the application developer has designed is multi-threaded applications let me show you an example if i run dropbox and i see that two cores are running really heavily utilized but these two are idle do we have a problem not a well-designed application on the other hand if i see all four cores utilized almost identically it tells me the application developer is very carefully designing this application so that all cores are being used very well that is something you better pay attention to because here's what you're gonna face every day when you get hired they're gonna pull you into a meeting an office you're going to sit down at a table with your coffee your your iphone or your whatever and you're going to hear a bunch of managers talking about a new software package and they're very excited about buying and of course guess who supports it installs it and configures it you do you're and you're listening to all this dialog box and you're saying uh well let's first your suggestion is let's get a trial let's load it on a server let's test it and let's see if it's well designed what is it going to impact on my server and how is it going to impact my network before we get all excited in this table about pouring out about a half a million dollars on the software package that's what you're going to be doing and this is exactly what you're going to be doing baselining it testing it running it does it has it been well designed because i'm telling you there is software out there that you're going to support here's the bad news are you all ready for bad news you are going to support the cruddiest sufferer on the earth and you're not going to have a better choice because that sales team's manager is pounding forward because they didn't invite you to the table when they bought it or they didn't listen to your advice after they after you did the analysis and said this is garbage they said but we love it it has such a beautiful interface it's got you know oh we can sell more widgets with this it's pretty good okay so they check out the money they hand you the software package and you get to live with it aren't you excited get excited because that's your life yeah all right let's go back to word so we look at using task manager we also can use process explorer we can look at how processes are impacting our hardware subsystems when they start using up a lot of our hardware subsystems we are going to pay attention to that and try to solve problems so all of you are comfortable with that there's not four but there are what five there are five subsystems to monitor a couple things i want to show you in task manager there is usually a line in here we're learning a little bit about processes i'm going to delve into threads and i'm going to delve into handles but there's also one that most of you don't have any ideas called commit and there are two values here this is called virtual memory this is the memory that we use we take a portion of the hard drive we create a file it's called a page file and what the memory manager does your kernel does is it pages out code from dram into the page file and back it does it back and forth depending on how you use your applications this is very important to watch how much virtual memory you're using listen very carefully here's the thing that you need to know the more virtual memory you use the slower your server the slower the pc the less virtual memory you use the faster your application your applications run so the idea is keep your commit values as low as from do that and more thank you that's how you do it so if you've got eight gigs of memory throw another stick and get 16. that's how you get uh automatically you'll use less hard drive okay that's how you fix the problem is it like caching it is that maybe am i on the right track page files are a basic thing of both linux mac and windows okay we're going to take a piece of uh we're going to take a file on the hard drive and the memory manager will move things from ram to the hard drive and back and forth depending on whether you use them for example i'm going to pick on brandon bran's got powerpoint up he's got chrome up he's got word up and he's got i.e up memory manager knows all that but he's only got four gigs of ram so the memory manager says right now he's only got on his screen he's got four applications running but the one he's looking at is ie the rest of them he's not paying any attention to how does it know that you talked about earlier how does it know he's only looking at one and not the other one yeah he just said it too one context switch not the context switch but you're on the right track the uh when you make a movement it knows that you're looking at it because all right look at my screen guys when i click on a in fact you really can't see it with the new remember when you used to click on a window this would become a dark color the rest of the windows would become a lighter color does you all remember that microsoft is getting away from colors and 3d and all the fancy stuff but when you click the active window the memory manager knows this is the window that's active yes yeah how many understand what i'm saying when you click an active window this window is known by the operating system as the active window you say but mr vanderpool i've got four windows up yes but it knows which one is active because it's the one window that you click your mouse in when you click your mouse in this window right here and this in this case this is process explorer it knows you are looking at what and although you got other windows behind it those are considered to the operating system inactive you got them up they're there but it knows you're not looking at them because you haven't clicked on them this is the one you're using right now go back to brandon he's got four of them running memory manager says i'm running out of memory this guy is copying and pasting pictures into word and his document's huge my clipboard is just about run out of space we've got to move some code out of ram to the page file right there it's going to look at one of his inactive applications and start copying 4k pages out of ram onto his hard drive what is happening to the overall performance of his operating system slowing down because the hard drive is 300 times slower then there's ram so then what does brandon do he takes his mouse and he clicks instantly back here on task manager so the memory manager is going oh my goodness i just copied all those pages to the hard drive let's go to the hard drive let's copy him back into memory because brandon can't make up his mind which application he wants to look at it's doing this at 300 times slower so what is brandon's actual experience on his pc things get slower okay so page file is a love hate relationship we always have it the less we use of it the better the only fix is more memory thank you or in brandon's case if he's too cheap to buy more memory one run run one application at a time word close powerpoint okay you that that'll get old real quick everybody there so we have commit that is very very important that is your virtual memory that's a metric you want to pay attention to how much virtual memory am i using this is the peak this is how much you've used maximum since you turned the computer on this is where you are right now it's okay for this to be high as long as this one is low right now and if you'll watch as you open up more and more applications guess what happens to this all right it starts going up okay that's your commit your virtual that's your page file your virtual memory now where do you see that on the new task manager and processes let's go take a look i think they do it under remember so they really don't show it here i'm trying to take a look make sure i don't miss it oh you're on cpu let's go look at um yeah that's thank you there it is commit everyone see it there's commit on the memory page thank you brandon uh let's go look at process explorer process explorer allows you to see it i think in your we fire up the system information it will also show you [Music] if you look right here in this area right here and let's see it it's got a whole section dedicated to what chart this is virtual memory okay when when i this is what that's it so i've got 14 gigs of hard drive space available for the memory manager yes that's it our number i have used since i booted up a maximum about four gigs right now i'm using about three gigs you want to pay attention to that that's a direct indication on the performance of your pcu of your pc and it also gives you a good idea of do you need to add more memory because as this would creep up a lot to six seven eight gigs you are reaching the maximum you're utilizing your hard drive a lot you need to add more thank you [Music] i know the page virtual but above that is that page ws yeah i will this is actually what's happening when we talk about paging i'm not going to get into a lot of this um we're going to learn about soft page faults hard page faults we'll look at we'll look at what the difference are that's all about this activity of being able to copy contents out of dram into the hard drive temporarily back and forth your operating system does this all the time it's normal you just want to keep it low you want to keep that bubble okay i will show you this while we're here um there is memory probably let me let me give you a little bit of him because you're looking at this page and you're going that is so over my head so let me give you a little bit of insight i have studied and listened to a lot of technical presentations on memory it's over my head i've listened to a lot of very very well presented discussions on memory and it's probably the most difficult to understand of any of the concepts that i teach so if you're up there looking and saying i do too okay it's a very complicated subject okay i've listened to it many many times and studied it for hours it is a very complicated subject so don't don't if that gives you any consolation take it let's go back to our word document resource monitor is your next best tool besides task manager because it allows you to look at processes in a way that task manager doesn't so resource monitor can be launched right from task manager if you'll notice let's go back to task manager real quick i like task manager it's a quick look at my system but i'm going to fire it up right here if you'll notice when i run task manager right down here everyone see it it's called resource monitor so if you hit the performance tab you can launch resource monitor and if i have no other tool to use resource monitor is my next best tool my favorite is processor process explorer but if i'm away and i don't have access to that i'm going to turn to a resource monitor i think i'm going to spend the rest of tomorrow on this before i'm not going to get into this in depth because i really want to start with a fresh group so i'm going to hold off on going into going into some of this um so let me wait till tomorrow and we're going to jump right into this this is going to help you understand process explorer and then i'm going to start getting into threads handles and dlls [Music] [Music] you
Info
Channel: TechsavvyProductions
Views: 10,433
Rating: undefined out of 5
Keywords: task manager, resource monitor, process explorer
Id: ZCmizwyhdvo
Channel Id: undefined
Length: 50min 40sec (3040 seconds)
Published: Mon Jun 27 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.