0:00:15.353,0:00:17.214 Do you remember when you first realized 0:00:17.238,0:00:18.635 that your computer was more 0:00:18.659,0:00:20.718 than just a monitor and keyboard? 0:00:20.742,0:00:23.301 That between the mouse click[br]and the video playing, 0:00:23.325,0:00:25.659 there was something[br]that captured your intention, 0:00:25.683,0:00:26.404 understood it, 0:00:26.428,0:00:27.880 and made it real? 0:00:28.650,0:00:30.246 What is that something? 0:00:30.270,0:00:31.983 Is it gremlins? 0:00:32.007,0:00:33.769 Let's imagine that we can shrink down 0:00:33.793,0:00:35.117 to the size of an electron 0:00:35.141,0:00:37.870 and inject ourselves[br]into a click of a mouse. 0:00:37.894,0:00:39.507 If you took your mouse apart, 0:00:39.531,0:00:42.169 you'd see that it's really[br]a very simple machine. 0:00:42.193,0:00:43.420 It has a couple buttons 0:00:43.444,0:00:46.723 and a system for detecting[br]motion and distance. 0:00:46.747,0:00:48.224 You might have an optical mouse 0:00:48.248,0:00:50.844 that makes these measurements[br]with lights and sensors, 0:00:50.868,0:00:53.107 but older ones did this[br]with a hard rubber ball 0:00:53.131,0:00:54.552 and some plastic wheels. 0:00:54.576,0:00:56.301 Same concept. 0:00:56.325,0:00:57.890 When you click the button on your mouse, 0:00:57.914,0:00:59.692 it sends a message to the computer 0:00:59.716,0:01:01.801 with information about its position. 0:01:01.825,0:01:03.467 When your mouse click is received, 0:01:03.491,0:01:06.856 it's handled by the basic[br]input/output subsystem. 0:01:06.880,0:01:09.420 This subsystem acts like the eyes and ears 0:01:09.444,0:01:12.029 and mouth and hands of the computer. 0:01:12.053,0:01:14.196 Basically, it provides[br]a way for the computer 0:01:14.220,0:01:16.419 to interact with its environment. 0:01:16.443,0:01:18.066 But it also acts like a buffer 0:01:18.090,0:01:21.477 to keep the CPU from being[br]overwhelmed by distractions. 0:01:21.501,0:01:23.787 In this case, the I/O subsystem decides 0:01:23.811,0:01:25.918 that your mouse click is pretty important 0:01:25.942,0:01:28.915 so it generates an interrupt to the CPU. 0:01:28.939,0:01:31.075 "Hey, CPU! Got a click here." 0:01:31.952,0:01:34.303 The CPU, or central processing unit, 0:01:34.327,0:01:36.498 is the brains of the whole computer. 0:01:36.522,0:01:39.048 Just like your brain doesn't[br]take up your whole body, 0:01:39.072,0:01:41.553 the CPU doesn't take[br]up the whole computer, 0:01:41.577,0:01:44.238 but it runs the show all the same. 0:01:44.262,0:01:46.482 And the CPU's job, its whole job, 0:01:46.506,0:01:48.420 is fetching instructions from memory 0:01:48.444,0:01:50.427 and executing them. 0:01:50.451,0:01:52.356 So, while you're typing, typing, typing, 0:01:52.380,0:01:53.586 maybe really fast, 0:01:53.610,0:01:55.064 like 60 words a minute, 0:01:55.088,0:01:57.066 the CPU is fetching and executing 0:01:57.090,0:01:59.113 billions of instructions a second. 0:01:59.137,0:02:02.152 Yes, billions every second: 0:02:02.176,0:02:04.958 instructions to move your mouse[br]around on the screen, 0:02:04.982,0:02:07.121 to run that clock widget on your desktop, 0:02:07.145,0:02:08.868 play your internet radio, 0:02:08.892,0:02:11.273 manage the files you're[br]editing on the hard drive, 0:02:11.297,0:02:12.876 and much, much more. 0:02:12.900,0:02:16.160 Your computer's CPU[br]is one heck of a multitasker! 0:02:16.439,0:02:17.589 "But oh my gosh 0:02:17.613,0:02:18.885 there's a very important mouse click 0:02:18.909,0:02:20.006 coming through now! 0:02:20.030,0:02:22.560 Let's drop everything now[br]and deal with that!" 0:02:23.207,0:02:24.779 There are programs for everything 0:02:24.803,0:02:26.312 that the CPU does. 0:02:26.336,0:02:28.034 A special program for the mouse, 0:02:28.058,0:02:29.068 for the clock widget, 0:02:29.092,0:02:30.279 for the internet radio, 0:02:30.303,0:02:33.112 and for dealing with letters[br]sent by the keyboard. 0:02:33.136,0:02:35.664 Each program was initially[br]written by a human 0:02:35.688,0:02:37.882 in a human-readable programming language, 0:02:37.906,0:02:38.741 like Java, 0:02:38.765,0:02:39.774 C++, 0:02:39.798,0:02:41.195 or Python. 0:02:41.219,0:02:43.717 But human programs take up a lot of space 0:02:43.741,0:02:47.426 and contain a lot of unnecessary[br]information to a computer, 0:02:47.450,0:02:49.212 so they are compiled and made smaller 0:02:49.236,0:02:52.629 and stored in bits of ones[br]and zeros in memory. 0:02:52.653,0:02:55.386 The CPU realizes that it[br]needs instructions 0:02:55.410,0:02:57.387 for how to deal with this mouse click, 0:02:57.411,0:02:59.697 so it looks up the address[br]for the mouse program 0:02:59.721,0:03:02.072 and sends a request[br]to the memory subsystem 0:03:02.096,0:03:04.179 for instructions stored there. 0:03:05.287,0:03:07.335 Each instruction[br]in the mouse device driver 0:03:07.359,0:03:09.718 is duly fetched and executed. 0:03:09.742,0:03:12.089 And that's not nearly[br]the end of the story! 0:03:12.113,0:03:14.630 Because the CPU learns[br]that the mouse was clicked 0:03:14.654,0:03:16.274 when the cursor was over a picture 0:03:16.298,0:03:18.153 of a button on the monitor screen, 0:03:18.177,0:03:21.224 and so, the CPU asks memory[br]for the monitor program 0:03:21.248,0:03:23.329 to find out what that button is. 0:03:23.353,0:03:25.577 And then the CPU has to ask memory 0:03:25.601,0:03:27.413 for the program for the button, 0:03:27.437,0:03:28.924 which means that the CPU needs 0:03:28.948,0:03:30.664 the monitor program again 0:03:30.688,0:03:32.836 to show the video[br]associated with the button, 0:03:32.860,0:03:34.718 and so it goes. 0:03:34.742,0:03:37.463 And let's just say there[br]are a lot of programs involved 0:03:37.487,0:03:39.583 before you even see[br]the button on the screen 0:03:39.607,0:03:41.355 light up when you clicked it. 0:03:41.379,0:03:43.824 So, just the simple task[br]of clicking your mouse 0:03:43.848,0:03:46.192 means visiting[br]all of the critical components 0:03:46.216,0:03:48.172 of your computer's architecture: 0:03:48.196,0:03:49.214 peripherals, 0:03:49.238,0:03:51.023 the basic input-output system, 0:03:51.047,0:03:52.355 the CPU, 0:03:52.379,0:03:53.130 programs, 0:03:53.154,0:03:54.116 and memory, 0:03:54.140,0:03:56.133 and not one gremlin.