1 00:00:03,560 --> 00:00:08,620 So, let's start thinking about how to go build 2 00:00:08,620 --> 00:00:14,270 a memory coherence protocol. So, as a little bit of warm up. 3 00:00:14,270 --> 00:00:18,670 For a memory coherence protocol we'll actually see that this problem. 4 00:00:18,670 --> 00:00:22,310 Exists beyond multiprocessor systems. 5 00:00:22,310 --> 00:00:25,160 So a lot of the motivation for these ideas in 6 00:00:25,160 --> 00:00:25,166 [UNKNOWN] 7 00:00:25,166 --> 00:00:30,060 coherence protocols actually pre-date even having multiprocessors. 8 00:00:31,110 --> 00:00:32,210 And how is that possible? 9 00:00:32,210 --> 00:00:35,125 Well the same problem ends up in. 10 00:00:35,125 --> 00:00:39,030 I/O. So let's say you have parallel I/O. 11 00:00:39,030 --> 00:00:40,720 So let's take a look at this picture here. 12 00:00:40,720 --> 00:00:46,590 We have one processor, a uni-processor system and we have main memory here. 13 00:00:47,860 --> 00:00:50,660 And we have a cache. And then over here we 14 00:00:50,660 --> 00:00:56,860 have a disk with a DMA engine. So a direct memory access engine. 15 00:00:56,860 --> 00:00:58,330 So this is an autonomous, 16 00:01:02,900 --> 00:01:06,940 controller here which can move data from the disc to main memory and 17 00:01:06,940 --> 00:01:11,070 vice versa. So how does, how does this come up with, 18 00:01:11,070 --> 00:01:16,230 something like parelell, what problems can come up with something like parallel i/o? 19 00:01:16,230 --> 00:01:21,880 Well, let's say that the disk here wants to 20 00:01:21,880 --> 00:01:28,010 transfer a page from the disk to physical memory, or to main 21 00:01:28,010 --> 00:01:29,770 memory, while the processor is running. 22 00:01:31,630 --> 00:01:35,680 Well, you program up the DMA controller, it says go. 23 00:01:35,680 --> 00:01:39,380 Well, it's going to start copying data here from the disk out to main memory. 24 00:01:40,720 --> 00:01:45,290 Well, because we have not done anything on this bus, we just use it as a way to 25 00:01:45,290 --> 00:01:51,600 communicate, the cache here might have the same addresses that are being written to. 26 00:01:51,600 --> 00:01:53,650 And, now they're going to have stale values. 27 00:01:53,650 --> 00:01:57,260 So they'll never actually pick up the value from 28 00:01:59,830 --> 00:02:03,810 That just got DMAed, or just got moved from the disk to physical memory. 29 00:02:05,950 --> 00:02:11,980 Likewise so that's disk to memory. You might get scale data in the cache. 30 00:02:13,260 --> 00:02:17,940 Likewise you could have memory trying to go to disk here. 31 00:02:17,940 --> 00:02:24,720 So, let's say you start to have a DMA transfer from main memory to disk, 32 00:02:24,720 --> 00:02:31,360 but you might have data in the cache here. Let's say it's a write back cache. 33 00:02:31,360 --> 00:02:34,860 Well, this transfer could get started, but it could miss. 34 00:02:34,860 --> 00:02:37,930 Updated data here in the cache. 35 00:02:37,930 --> 00:02:41,170 So we can try to start doing copies, but because we said the DMA 36 00:02:41,170 --> 00:02:44,310 agent just copies directly from physical memory 37 00:02:44,310 --> 00:02:46,020 to disk, it'll just miss those updates. 38 00:02:46,020 --> 00:02:52,710 So there's no good way for the processor to go and write data to the disk, and, 39 00:02:52,710 --> 00:02:56,420 and this is something you fundamentally want to do, so there's a couple 40 00:02:56,420 --> 00:02:57,580 solutions to this. 41 00:02:57,580 --> 00:03:02,050 And this is sort of brainteaser to get you thinking about this. 42 00:03:02,050 --> 00:03:09,030 But what do you need to do to guarantee some way of having the disk here. 43 00:03:09,030 --> 00:03:11,400 For instance we will see the data that's in the cache. 44 00:03:14,690 --> 00:03:16,640 Well How do you go about doing this? 45 00:03:17,700 --> 00:03:21,760 You need some way to either invalidate the cache and send these to main 46 00:03:21,760 --> 00:03:27,210 memory and have the disk pull out the updated or most up to date copies. 47 00:03:27,210 --> 00:03:33,340 And this is a sort of similar notion as what we have to do, back in this example 48 00:03:33,340 --> 00:03:40,920 here. We need some 49 00:03:40,920 --> 00:03:44,570 way to 50 00:03:44,570 --> 00:03:51,140 either get 51 00:03:51,140 --> 00:03:56,250 the most 52 00:03:56,250 --> 00:04:02,090 up to date 53 00:04:02,090 --> 00:04:08,660 value or, or 54 00:04:08,660 --> 00:04:17,420 invalidate or 55 00:04:20,340 --> 00:04:26,180 pick data 56 00:04:26,180 --> 00:04:29,830 out of 57 00:04:29,830 --> 00:04:34,210 apical 58 00:04:34,210 --> 00:04:40,780 cache.In 59 00:04:40,780 --> 00:04:48,080 other wards 60 00:04:48,080 --> 00:04:53,190 to allow 61 00:04:53,190 --> 00:05:00,490 new windows 62 00:05:00,490 --> 00:05:04,140 to see 63 00:05:04,140 --> 00:05:09,370 updates.