0:00:15.000,0:00:17.000 Do you remember when you first realized 0:00:17.000,0:00:18.000 that your computer was more 0:00:18.000,0:00:20.000 than just a monitor and keyboard? 0:00:20.000,0:00:23.000 That between the mouse click and the video playing, 0:00:23.000,0:00:25.000 there was something that captured your intention, 0:00:25.000,0:00:26.000 understood it, 0:00:26.000,0:00:27.000 and made it real? 0:00:28.000,0:00:30.000 What is that something? 0:00:30.000,0:00:32.000 Is it gremlins? 0:00:32.000,0:00:33.000 Let's imagine that we can shrink down 0:00:33.000,0:00:35.000 to the size of an electron 0:00:35.000,0:00:37.000 and inject ourselves into a click of a mouse. 0:00:37.000,0:00:39.000 If you took your mouse apart, 0:00:39.000,0:00:42.000 you'd see that it's really a very simple machine. 0:00:42.000,0:00:43.000 It has a couple buttons 0:00:43.000,0:00:46.000 and a system for detecting motion and distance. 0:00:46.000,0:00:48.000 You might have an optical mouse 0:00:48.000,0:00:50.000 that makes these measurements with lights and sensors, 0:00:50.000,0:00:52.000 but older ones did this with a hard rubber ball 0:00:52.000,0:00:54.000 and some plastic wheels. 0:00:54.000,0:00:56.000 Same concept. 0:00:56.000,0:00:57.000 When you click the button on your mouse, 0:00:57.000,0:00:59.000 it sends a message to the computer 0:00:59.000,0:01:01.000 with information about its position. 0:01:01.000,0:01:03.000 When your mouse click is received, 0:01:03.000,0:01:06.000 it's handled by the basic input/output subsystem. 0:01:06.000,0:01:09.000 This subsystem acts like the eyes and ears 0:01:09.000,0:01:12.000 and mouth and hands of the computer. 0:01:12.000,0:01:13.000 Basically, it provides a way for the computer 0:01:13.000,0:01:16.000 to interact with its environment. 0:01:16.000,0:01:18.000 But it also acts like a buffer 0:01:18.000,0:01:21.000 to keep the CPU from being overwhelmed by distractions. 0:01:21.000,0:01:23.000 In this case, the I/O subsystem decides 0:01:23.000,0:01:25.000 that your mouse click is pretty important 0:01:25.000,0:01:28.000 so it generates an interrupt to the CPU. 0:01:28.000,0:01:31.000 "Hey, CPU! Got a click here." 0:01:31.000,0:01:34.000 The CPU, or central processing unit, 0:01:34.000,0:01:36.000 is the brains of the whole computer. 0:01:36.000,0:01:39.000 Just like your brain doesn't take up your whole body, 0:01:39.000,0:01:41.000 the CPU doesn't take up the whole computer, 0:01:41.000,0:01:44.000 but it runs the show all the same. 0:01:44.000,0:01:46.000 And the CPU's job, its whole job, 0:01:46.000,0:01:48.000 is fetching instructions from memory 0:01:48.000,0:01:50.000 and executing them. 0:01:50.000,0:01:52.000 So, while you're typing, typing, typing, 0:01:52.000,0:01:53.000 maybe really fast, 0:01:53.000,0:01:55.000 like 60 words a minute, 0:01:55.000,0:01:57.000 the CPU is fetching and executing 0:01:57.000,0:01:59.000 billions of instructions a second. 0:01:59.000,0:02:02.000 Yes, billions every second: 0:02:02.000,0:02:04.000 instructions to move your mouse around on the screen, 0:02:04.000,0:02:07.000 to run that clock widget on your desktop, 0:02:07.000,0:02:08.000 play your internet radio, 0:02:08.000,0:02:11.000 manage the files you're editing on the hard drive, 0:02:11.000,0:02:12.000 and much, much more. 0:02:12.000,0:02:16.000 Your computer's CPU is one heck of a multitasker! 0:02:16.000,0:02:17.000 "But oh my gosh 0:02:17.000,0:02:18.000 there's a very important mouse click 0:02:18.000,0:02:20.000 coming through now! 0:02:20.000,0:02:22.000 Let's drop everything now and deal with that!" 0:02:23.000,0:02:24.000 There are programs for everything 0:02:24.000,0:02:26.000 that the CPU does. 0:02:26.000,0:02:28.000 A special program for the mouse, 0:02:28.000,0:02:29.000 for the clock widget, 0:02:29.000,0:02:30.000 for the internet radio, 0:02:30.000,0:02:33.000 and for dealing with letters sent by the keyboard. 0:02:33.000,0:02:35.000 Each program was initially written by a human 0:02:35.000,0:02:37.000 in a human-readable programming language, 0:02:37.000,0:02:38.000 like Java, 0:02:38.000,0:02:39.000 C++, 0:02:39.000,0:02:41.000 or Python. 0:02:41.000,0:02:43.000 But human programs take up a lot of space 0:02:43.000,0:02:47.000 and contain a lot of unnecessary information to a computer, 0:02:47.000,0:02:49.000 so they are compiled and made smaller 0:02:49.000,0:02:52.000 and stored in bits of ones and zeros in memory. 0:02:52.000,0:02:55.000 The CPU realizes that it needs instructions 0:02:55.000,0:02:57.000 for how to deal with this mouse click, 0:02:57.000,0:02:59.000 so it looks up the address for the mouse program 0:02:59.000,0:03:01.000 and sends a request to the memory subsystem 0:03:01.000,0:03:04.000 for instructions stored there. 0:03:05.000,0:03:07.000 Each instruction in the mouse device driver 0:03:07.000,0:03:09.000 is duly fetched and executed. 0:03:09.000,0:03:12.000 And that's not nearly the end of the story! 0:03:12.000,0:03:14.000 Because the CPU learns that the mouse was clicked 0:03:14.000,0:03:16.000 when the cursor was over a picture 0:03:16.000,0:03:18.000 of a button on the monitor screen, 0:03:18.000,0:03:21.000 and so, the CPU asks memory for the monitor program 0:03:21.000,0:03:23.000 to find out what that button is. 0:03:23.000,0:03:25.000 And then the CPU has to ask memory 0:03:25.000,0:03:27.000 for the program for the button, 0:03:27.000,0:03:28.000 which means that the CPU needs 0:03:28.000,0:03:30.000 the monitor program again 0:03:30.000,0:03:32.000 to show the video associated with the button, 0:03:32.000,0:03:34.000 and so it goes. 0:03:34.000,0:03:37.000 And let's just say there are a lot of programs involved 0:03:37.000,0:03:39.000 before you even see the button on the screen 0:03:39.000,0:03:41.000 light up when you clicked it. 0:03:41.000,0:03:43.000 So, just the simple task of clicking your mouse 0:03:43.000,0:03:46.000 means visiting all of the critical components 0:03:46.000,0:03:48.000 of your computer's architecture: 0:03:48.000,0:03:49.000 peripherals, 0:03:49.000,0:03:51.000 the basic input-output system, 0:03:51.000,0:03:52.000 the CPU, 0:03:52.000,0:03:53.000 programs, 0:03:53.000,0:03:54.000 and memory, 0:03:54.000,0:03:56.000 and not one gremlin.