1 00:00:15,000 --> 00:00:17,000 Do you remember when you first realized 2 00:00:17,000 --> 00:00:18,000 that your computer was more 3 00:00:18,000 --> 00:00:20,000 than just a monitor and keyboard? 4 00:00:20,000 --> 00:00:23,000 That between the mouse click and the video playing, 5 00:00:23,000 --> 00:00:25,000 there was something that captured your intention, 6 00:00:25,000 --> 00:00:26,000 understood it, 7 00:00:26,000 --> 00:00:27,000 and made it real? 8 00:00:28,000 --> 00:00:30,000 What is that something? 9 00:00:30,000 --> 00:00:32,000 Is it gremlins? 10 00:00:32,000 --> 00:00:33,000 Let's imagine that we can shrink down 11 00:00:33,000 --> 00:00:35,000 to the size of an electron 12 00:00:35,000 --> 00:00:37,000 and inject ourselves into a click of a mouse. 13 00:00:37,000 --> 00:00:39,000 If you took your mouse apart, 14 00:00:39,000 --> 00:00:42,000 you'd see that it's really a very simple machine. 15 00:00:42,000 --> 00:00:43,000 It has a couple buttons 16 00:00:43,000 --> 00:00:46,000 and a system for detecting motion and distance. 17 00:00:46,000 --> 00:00:48,000 You might have an optical mouse 18 00:00:48,000 --> 00:00:50,000 that makes these measurements with lights or sensors, 19 00:00:50,000 --> 00:00:52,000 but older ones did this with a hard rubber ball 20 00:00:52,000 --> 00:00:54,000 and some plastic wheels. 21 00:00:54,000 --> 00:00:56,000 Same concept. 22 00:00:56,000 --> 00:00:57,000 When you click a button on your mouse, 23 00:00:57,000 --> 00:00:59,000 it sends a message to the computer 24 00:00:59,000 --> 00:01:01,000 with information about its position. 25 00:01:01,000 --> 00:01:03,000 When your mouse click is received, 26 00:01:03,000 --> 00:01:06,000 it's handled by the basic input/output subsystem. 27 00:01:06,000 --> 00:01:09,000 This subsystem acts like the eyes and ears 28 00:01:09,000 --> 00:01:12,000 and mouth and hands of the computer. 29 00:01:12,000 --> 00:01:13,000 Basically, it provides a way for the computer 30 00:01:13,000 --> 00:01:16,000 to interact with its environment. 31 00:01:16,000 --> 00:01:18,000 But, it also acts like a buffer 32 00:01:18,000 --> 00:01:21,000 to keep the CPU from being overwhelmed by distractions. 33 00:01:21,000 --> 00:01:23,000 In this case, I/O subsystem decides 34 00:01:23,000 --> 00:01:25,000 that your mouse click is pretty important 35 00:01:25,000 --> 00:01:28,000 so it generates an interrupt to the CPU. 36 00:01:28,000 --> 00:01:31,000 "Hey, CPU! Got a click here." 37 00:01:31,000 --> 00:01:34,000 The CPU, or central processing unit, 38 00:01:34,000 --> 00:01:36,000 is the brains of the whole computer. 39 00:01:36,000 --> 00:01:39,000 Just like your brain doesn't take up your whole body, 40 00:01:39,000 --> 00:01:41,000 the CPU doesn't take up the whole computer, 41 00:01:41,000 --> 00:01:44,000 but it runs the show all the same. 42 00:01:44,000 --> 00:01:46,000 And, the CPU's job, it's whole job, 43 00:01:46,000 --> 00:01:48,000 is fetching instructions from memory 44 00:01:48,000 --> 00:01:50,000 and executing them. 45 00:01:50,000 --> 00:01:52,000 So, while you're typing, typing, typing, 46 00:01:52,000 --> 00:01:53,000 maybe really fast, 47 00:01:53,000 --> 00:01:55,000 like 60 words a minute, 48 00:01:55,000 --> 00:01:57,000 the CPU is fetching and executing 49 00:01:57,000 --> 00:01:59,000 billions of instructions a second. 50 00:01:59,000 --> 00:02:02,000 Yes, billions every second: 51 00:02:02,000 --> 00:02:04,000 instructions to move your mouse around on the screen, 52 00:02:04,000 --> 00:02:07,000 to run that clock widget on your desktop, 53 00:02:07,000 --> 00:02:08,000 play your internet radio, 54 00:02:08,000 --> 00:02:11,000 manage the files you're editing on the hard drive, 55 00:02:11,000 --> 00:02:12,000 and much, much more. 56 00:02:12,000 --> 00:02:16,000 Your computer's CPU is one heck of a multitasker! 57 00:02:16,000 --> 00:02:17,000 "But, oh my gosh, 58 00:02:17,000 --> 00:02:18,000 there's a very important mouse click 59 00:02:18,000 --> 00:02:20,000 coming through now! 60 00:02:20,000 --> 00:02:22,000 Let's drop everything now and deal with that!" 61 00:02:23,000 --> 00:02:24,000 There are programs for everything 62 00:02:24,000 --> 00:02:26,000 that the CPU does. 63 00:02:26,000 --> 00:02:28,000 A special program for the mouse, 64 00:02:28,000 --> 00:02:29,000 for the clock widget, 65 00:02:29,000 --> 00:02:30,000 for the internet radio, 66 00:02:30,000 --> 00:02:33,000 and for dealing with letters sent by the keyboard. 67 00:02:33,000 --> 00:02:35,000 Each program was initially written by a human 68 00:02:35,000 --> 00:02:37,000 in a human-readable programming language, 69 00:02:37,000 --> 00:02:38,000 like Java, 70 00:02:38,000 --> 00:02:39,000 C++, 71 00:02:39,000 --> 00:02:41,000 or Python. 72 00:02:41,000 --> 00:02:43,000 But, human programs take up a lot of space 73 00:02:43,000 --> 00:02:47,000 and contain a lot of unnecessary information to a computer, 74 00:02:47,000 --> 00:02:49,000 so they are compiled and made smaller 75 00:02:49,000 --> 00:02:52,000 and stored in bits of ones and zeros in memory. 76 00:02:52,000 --> 00:02:55,000 The CPU realizes that it needs instructions 77 00:02:55,000 --> 00:02:57,000 for how to deal with this mouse click, 78 00:02:57,000 --> 00:02:59,000 so it looks up the address for the mouse program 79 00:02:59,000 --> 00:03:01,000 and sends a request to the memory subsystem 80 00:03:01,000 --> 00:03:04,000 for instructions stored there. 81 00:03:05,000 --> 00:03:07,000 Each instruction in the mouse device driver 82 00:03:07,000 --> 00:03:09,000 is duly fetched and executed. 83 00:03:09,000 --> 00:03:12,000 And, that's not nearly the end of the story! 84 00:03:12,000 --> 00:03:14,000 Because the CPU learns that the mouse was clicked 85 00:03:14,000 --> 00:03:16,000 when the cursor was over a picture 86 00:03:16,000 --> 00:03:18,000 of a button on the monitor screen, 87 00:03:18,000 --> 00:03:21,000 and so, the CPU asks memory for the monitor program 88 00:03:21,000 --> 00:03:23,000 to find out what that button is. 89 00:03:23,000 --> 00:03:25,000 And, then CPU has to ask memory 90 00:03:25,000 --> 00:03:27,000 for the program for the button, 91 00:03:27,000 --> 00:03:28,000 which means that the CPU needs 92 00:03:28,000 --> 00:03:30,000 the monitor program again 93 00:03:30,000 --> 00:03:32,000 to show the video associated with the button, 94 00:03:32,000 --> 00:03:34,000 and so it goes. 95 00:03:34,000 --> 00:03:37,000 And, let's just say there are a lot of programs involved 96 00:03:37,000 --> 00:03:39,000 before you even see the button on the screen 97 00:03:39,000 --> 00:03:41,000 light up when you clicked it. 98 00:03:41,000 --> 00:03:43,000 So, just a simple task of clicking your mouse 99 00:03:43,000 --> 00:03:46,000 means visiting all of the critical components 100 00:03:46,000 --> 00:03:48,000 of your computer's architecture: 101 00:03:48,000 --> 00:03:49,000 peripherals, 102 00:03:49,000 --> 00:03:51,000 the basic input-output system, 103 00:03:51,000 --> 00:03:52,000 the CPU, 104 00:03:52,000 --> 00:03:53,000 programs, 105 00:03:53,000 --> 00:03:54,000 and memory, 106 00:03:54,000 --> 00:03:56,000 and not one gremlin.