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