Felly, we're here today to introduce our new display processor, Marlady 77. This is the global launch of our new display technology. My name is Ian Hutchinson. I'm director of Outbound Marketing for the client line of business. Client line of business looks after the things like smartphones, DTVs, laptops, wearables, et cetera. I'm with my colleague Roger Barker, who's going to talk a bit more about the detail of the product when we get to that. So, it's the first time we've interacted with most of you on a face-to-face basis, so I'm really pleased to see you or some familiar faces and the majority of you are not. So, I'm just going to spend five minutes giving you a bit of background about ARM, and then I'll say hand over to Roger. So, I'm hoping, mostly you've heard about ARM, even not directly about our display products but about the company itself. So ARM is really ubiquitous in the world of technology. In the areas of smartphones, DTVs, embedded, we've been around a long time, and some quite amazing numbers, as Shree said, 130 billion ships over the past 30 years. But you may not have heard about ARM, because sometimes we are the secret hidden source among many of the key technologies. And as we're sort of moving into new areas, such as automotive and infrastructure, we think the name is going to get more and more popular. So, how do we get here? A little bit of history. So ARM was formed about 30 years ago in a barn in Cambridge in the UK. And our first products really appeared to some of the cutting-edge technologies, very, very early on. So you can see some of the examples of that on the left-hand side. But it was really from about 1993 onwards that things started to take off. So our CPUs, which are really incredibly energy-efficient, they were designed to some of the first mobile phones and then into the smartphones. And I don't think it's an exaggeration to say that actually ARM technology drove the mobile revolution from 93 onwards. And now, here we are today, our technology appears not just in those phones, but in multiple devices, almost everything you can think of. So from automotive to cars to your wearables, to your laptop, to the projector, to the air conditioning, it's almost certain there'll be some ARM technology within there. But what does it we do? Quite often we get asked, what do we do? What do you make? So ARM is an IP company. So we design IP. And in our instance, from the client line of business, we have Cortex-A processors, we have machine learning processors, and we have the Marley multimedia suites of products. So we design the IP and our partners, such as Qualcomm, MediaTek iSilicon. They take that IP and they design and build their own SOCs, systems on the chips, that their partners then build secure devices of all shapes and sizes, such as the smartphones, the DTVs, the wearables, the goggles, et cetera. And it's these devices that allow the end user, so you and me, my kids, my friends, your friends, your relatives, it allows these to actually enjoy these interactive and immersive experiences. And this sort of pervasiveness has led to some quite huge numbers. So Shreementioned 130 billion. Well, last year alone in 2018, ARM Cortex CPUs, our partners shipped about 23 billion of them. So that's 3 times the actual population of the earth. And they appear in our case in things like wearables, smartphones, modems, et cetera. And you can see some market share stats actually at the bottom of the slide. You know, over 95% in some very large selling categories. And we have over in the market over 20 billion cellular modems powered by ARM. But it's not just about CPUs. The CPUs were the first piece of IP designed into those mobile phones 25 years ago. We also have other products, such as Mali and our multimedia suite. So Mali is not only GPUs, but also deep display processors as well. Now GPUs are very, very successful. They are the largest shipping GPU in the world. And last year our partners shipped over a billion of them in various devices to consumers all over the world. And they really help power user experiences that we see today, such as gaming, AR, VR and AI. It's really that IP coming together on the devices that allows that. But as I said, Mali is not just about graphics. We also have display technologies. Now our display technologies are relatively new compared to the other bits of IP. So there's no staggering numbers yet, but we'll get there. But where we are today is a series of products that serve Clamshell, premium and home markets. And that's covered by Mali D71, which is our current premium display processor. Sitting alongside Mali D71 is AD5, which stands for a Cert of Display 5. Cert of Display is a technology that allows the viewer to view any content under different life conditions and also allows the viewing of HDR content on an SDR screen. So they serve what we call the premium markets. And then the mass market is served by their little brother and sister, Mali D51 and a Cert of Display 3. So that's where we are today. I said we're here to launch our new products. In approximately 10 minutes time, the worldwide embargo lifts for our brand new product, which is Mali D77. So Mali D77, brand new display processor, really focusing on VR, on head-mounted displays, whether they be standalone or within a sort of a holster setup. And to tell you more about this exciting new VR technology, I'm going to hand over to my colleague Roger Barker to give you some further details. Roger. Thank you, Ian. I think we should all stand up again. No, no, thank you. I'm very tempted, though. Right, right. Thank you, Ian. Right, before I move on to the product, I want to talk a little bit about head-mounted devices and how we see things going over the next few years. And clearly, with head-mounted device, you need a display that's held very close to your eyes. As it's held close to your eyes, you need something to increase the field of view, so they tend to have nice big lenses in front of them. And it gets very, very complicated. As you move forwards, we're going to have to get higher and higher resolutions on these displays. And within a couple of years, we're going to be seeing 2.5K by 2.5K per eye. So 5K by 2.5K at up to around 120 frames per second. As we get to that sort of level, the amount of pixels and information that has to be processed through the processors out to the displays becomes enormous. And it's a real issue at the moment, managing to get the SOCs powerful enough to move all these pixels fast enough to give a good experience into the headset. And this is part of the issues that we're facing. So typically today, frame rates are around 90 frames per second. They're driven and controlled through the GPU. The GPUs are often only going at about 45 frames per second and then they're getting doubled up.  As you move your head, there's delays that creep in. The electronics, the pixels can't be processed fast enough to actually enable your head to move smoothly with the display. And this is part of what makes people uncomfortable when they're wearing them for long periods of time and has led to things like motion sickness. And we've got to find a way around that. And as Ian was saying, we have a very strong position in GPU land. We have a lot of GPUs that are in a lot of handsets that are used for this type of product. And we started analysing a couple of years ago, what are the bottlenecks? What are the problems? How can we address them? Do we just continue to throw more and more power on the GPU or do we look at other innovative ways we can address this? And this is part of what we've done with Mali-D77. So, what is it? It's a new display processor IP. It's specifically designed to address the special requirements for head-mounted displays, which is designed to work either with a standard smartphone, so a standard flat-panel display, but equally as Ian said earlier, into pluggable products. And that, typically at the moment, means they're only really used in premium mobile phones. But you can also use this in all, in one head-mounted displays or head-mounted devices. So, if we're going to make this more successful, we've got to address the problems that are experienced in the head-mounted devices. And this is specifically the latency, which is related to head movements.  And also, how do we handle the effects of those enormous bottle-top lenses that are typical in VR headsets? So, as we said a minute ago, we are very strong in GPU land. So, why don't we just throw more GPU processing at this? And when I'm talking about VR processing here, I'm talking specifically about the problems of reprojection lens correction. I'm not talking about how we actually create the game or what have you. That's done nice and cleanly. It presents nicely onto a flat panel display today, but when we put the additional workload of having to overcome the latency problems, reproject and do the lens corrections, we need to use many more GPU cycles. And it's somewhere between 10% and 20% typically, so we put an average there of about 15% extra GPU cycles. As we do this, the GPU has to keep switching context from delivering the game to actually carrying out the reprojection algorithms and fixing those. So, as it's switching context, this also makes it less efficient because you stop processing the game, you will get to a position where you start missing the deadlines for when you're updating the display. And this is where you start to see problems in what scene, you start to see artifacts, glitches in the system as it moves forward. So, as you can see here, we have the GPU, it's talking many times to the main memory before it's sending it off to a display processor like Mali-D71, which will then compose it and deliver it to the screen, whatever screen you're using. What we're doing with GPU-based VR processing, we're moving the requirements to perform things like reprojection and lens distortion correction from the GPU into the display processor. So, we have an inline processing through the display so we don't miss the deadlines. The display has got all sorts of additional high-powered IP in there as well. It will optimise and improve the scaling. It will enable you to define it specifically for the display processor that you're using. We can add things like a certain display to make sure that we're doing all sorts of corrections so that we're optimising the performance in the screen. But at the same time as we're doing this, we're doing this in a single pass through the display processor. That alone will save us around 40% of the DRAM bandwidth, which is enormous. It makes a huge impact. So, we know that today we can do around 2K by 2K per eye in Mali-D77 at 90 frames per second. Not at 45 seconds doubled up, we could handle it at 90 frames per second, just firing straight through there. So, let's talk a little bit about these terms that we're going to be using and what D77 provides. So, asynchronous time warp is a well-known phrase now. I'll talk a little bit more about this in a minute. I assume many of you know what it is, so you can correct me later. Then talk a little about lens distortion correction, chromatic aberration correction, and as well as that, we can compose up to four VR layers in a single flow through the display processor. And I said 4K90 capable, but we're optimising it around 3K at 120 frames per second. So, as these requirements increase, we will continue development, we'll continue putting this in different formats in different ways with different levels. So, we'll start adapting the D77 and have products derived from it to address the increasing performance requirements. The top layer, I mean, it's just eye candy really in a way. So, the top layer is some RGB images that we're distorting in different ways. So, across the X, Y and Z axis, the bottom set are clearly from a video stream. And one of the advantages about video stream, and I have to cheat here because I always forget this bit. So, I'll admit that, is that we're looking at quad projection examples. So, quad projection is the process of positioning the rectangle in a 3D space. So, each of the corners of the video represent a 3D coordinate for Mali D77 and we're able to project these quads onto the screen positioning the virtual 3D plane within the display. So, let's talk about time warp. So, time warp, it's a widely used method of reprojection to mitigate for display pipeline latency as it says up here. So, the bottom left diagram there is an illustration of what we're doing. So, we have the image that's there. We move our head slightly. We have to, if we haven't already got a frame ready because it hasn't come up from the GPU fast enough, we just adjust how we're projecting it so we're taking account of the head movement. So, the head movement is fed into the display processor as well. So, the display processor knows how it's moved and works out how it's got to project the actual display. And this now we're doing in hardware. The pre-distortion, we're combining time warp with lens pre-distortion to improve the overall display pipeline efficiency and I'll talk a little bit more about that in a second. So, geometric distortion is caused by the bottle top lenses. So, if we render a normal frame, so this has come straight from the GPU, it's a normal frame. It's a picture of, I won't embarrass him but we nicknamed a member of the team is closely related to this gentleman. In fact, it could be him. From here, if you render the frame, you then pass it through the first VR lenses and what you start to see is a geometric distortion known as pincushion and pincushion distortion. So, we need to adapt that and correct for that so that you see the image exactly as you want to see the image on the VR device. So, what we do before we actually pass it to the lens we've formed the invoice distortion and this is applied on the rendered frame so when it then passes through the lens we see a proper rectilinear image in the head mounted device. So, this is how we compensate for the geometric distortion. But the sharp-eyed amongst you can soon see that this is a little blurry. It hasn't completely solved the problem. There's still other issues for us to address there. So, what do we do? The colours aren't aligned and this is just a simple fact because of the different refractive indices for the colour channels. So, the colour channels are separated as they pass through the lens. So, how do we fix this? We actually do the same as we did before. We apply inverse chromatic aberration before we pass it through the lens and this has the same effect so that instead of having the blurry image on the left we end up with a nice pin-sharp image that we have on the right-hand side. So, all these adaptations are being applied in line as the data is flowing through the display processor. We're not going backwards and forwards between memory and processor. We're going in line and delivering straight away and this is how we can guarantee the frame rates and hitting the frame rates that are required in the modern devices. So, I just want to backtrack a little and Ian spoke about Mali-D71. Mali-D71, we originally announced roughly two years ago now. It was the first product within what we call the commedia architecture. And the reason I want to highlight it is that this was specifically developed to ensure that we could guarantee high frame rates at high resolutions. So, we were always working on having 4K90, 4K120, 4K90 for cell phones, 4K120 for devices where you could guarantee availability of the memory bandwidth. We started embedding things like TPUs for prefetching so that you actually had the data there. You never had to wait for data. We've got six polyphase scalar engines in there. So, we have very high quality scaling. So, if for whatever reason you need to render from the GPU at a relatively low resolution, we can always scale up in the display processor again as part of the flow-through operation. We have our own arm frame buffer compression within here as well. So, we compress the data as it flows through. We can handle it more easily. We can apply things like rotation much easier by using the compressed formats. We have a co-processor interface which links directly to our assertive display. So, if we need to do some tone mapping, if we want to add in the content adaption, sorry, content adaptive backlight control from assertive display, we can add that in as well. Add that into the solution. It's separate IP but we add it to our display solution so that we're delivering a top quality output. So, this is Mali-D71 and the reason I've highlighted that is that all we're really doing is adding the additional block. So, the lens correction, distortion and chromatic aberration correction and the asynchronous time warp. It sounds very easy when I say it like this but it's not. And clearly, if you think about what we've been talking about, are all these lenses the same? Don't think so. We have many different lenses so we have to be able to program the D77 so it knows exactly what the interpupillary distance is. It knows all sorts of clever things about the head-mounted device so that we can apply exactly the correct corrections to the devices as we're projecting into the screens. So, this has taken a couple of years to be done. We're the only people that are doing this inside the display processor today and we are convinced that this is the right way forward to enable VR and AR in the future. Clearly AR has different requirements but this is also a building block that will be used in that type of arena as we move forwards. So, it's something that we're focused on taking the power out of the processing, putting it in line so that we can guarantee performance. Sorry, is that the question? Yeah. So, I'm going to take a pass on that in a way because the foveated rendering, of course, is key to how this is moved forward. It's an alternate approach that is mainly being run through GPUs at the moment. We are looking at this. From the GPU point of view, we can handle that in our own GPUs as well. So, it's another additional tool available to help us provide improved performance at the very highest level. I'm not an expert on it so I won't try and talk any more than that but it is something that ARM is working very closely on as well within the GPU side of the business. Eye tracking, we're investigating at the moment. So, yes, it's something that has to be done. There are many different ways of doing it but it's something that we're very keen on and we're working on at the moment. We're not in a position where we're going to talk much more about that yet. But clearly, all of these are areas of great interest to us and with our background in low power, it's critical that these things are done with as low power as possible. We don't all want to walk around in motorcycle helmets. I certainly don't. So, this is a brief example. So, this is actually the D77 running inside a relatively small FPGA within our development system. What we have there on the top, we have a regular phone which is running Android AR core and we're using that because that's working out the head pose, the different angles of the movement that we're putting through. That's then feeding through into the FPGA and the FPGA is amending, as you can see in real time, the position and what's presented on the screen. So, everything that you're seeing there in the screen is being done on D77. There's no GPU interaction at all. And we have, this exact piece of kit is sitting booth 842 over the next couple of days. So, please come and look at it, ask questions of it and you can see what's there. Next to it, we've also got a demonstration of assertive display 5 running also on the Mali D77 as a separate thing. Yes, please. The D77, you'd expect fit in the VR headset. So, it depends on how you're handling it. So, the reason we've done it in the way that we're doing it is it can either sit in the phone or it can sit in the head mounted headset. So, if you think of a pluggable headset where you're putting a phone in, then it's in the phone. If you're having an all-in-one, whether it's linked to a games console or linked to anything else, then it would have to be in the headset. So, the D77 is what we were announcing today. We think it's a game changer for display technology in head mounted devices. We've added lens distortion correction, chromatic aberration correction, reprojection and time warp. And all of that is in a single pass through the display processor, which offloads the GPU significantly and allows you to use the GPU for either doing more or you're reducing the GPU requirements so you can actually deliver it to a lower grade of product as well. So, we're looking at this from all angles. The VR processing in the GPU is of higher quality. So, the output to the displays is of higher quality than you get normally through a GPU and we can show that on the stand if you want us to. And we believe this is the best route to get to a position where you actually have a very light, small, much more comfortable, cheaper head mounted device for people to develop for their customers. So, finally, our lead architect who was the person who started off this program and did a lot of the initial works on this program is doing a talk on this product about what we're doing, how we're going about doing it in far more detail than this, that's starting in about 50 minutes in room 220B. So, if you want to learn a lot more, that's a good place to go. There's also the paper that he's basing the talk on is available within the information that's provided. So, we are excited about this. We hope it's of great interest to you. We believe it's a very cool product. The demo is good, so please go and look at it. There's a couple of people who are very keen to talk you through it. There's at least two. There's probably many more people there doing so. A couple of them are sitting at the back in the corner grinning. So, we hope this was of interest and thank you for your time. Any questions? Yes? So, actual hardware, we'd expect to be around either Christmas next year or CES just after that. So, typically IP, it takes roughly a year to get the IP into an SOC, maybe a little longer than that and then up to another year to get it from that into end products. So, roughly two-year cycle. It's a different cycle to many. So, we're hanging around for a while, so by all means come up and ask us anything you want to ask us if we can answer, we will. If we can't, we'll duck. Oh, yes, sorry, that's the right answer. Okay, we'll leave it like that.


We we introduced the concept very quickly last week at the end of the lecture.  Although we didn't go through the the many example technologies. We know that we can distinguish between lands and wide-area networks covering different geographical areas having different technologies So you can think if you think of any home and organizations some company government organization They have their own internal network to connect their computers inside their buildings inside their Offices and so on so usually lands local area networks, but also they want to connect together usually using either larger lands or wide-area networks and we'd like to allow Well, not like to allow people the different organizations will choose the best technology to support their requirements so for example in SIT we have Inside our land we have wired ethernet especially to the the PCs in the lecture rooms in the labs in the offices and we also have wireless land For students and also for staff and faculty. So we have two different land technologies Some other organization may use a different technology. We go across the road to one of the factories Maybe that factory's been there for a long time and they have an old land technology a token ring network Or maybe they have some new upgraded Fiber based Land technology okay, depending upon their requirements. They'll choose the technology that the best suits them Similarly when we connect the lands across a wide network many different technologies to choose from Telephone network based optical fiber satellite different wireless systems for wide-area networks What we would like is to allow to connect multiple lands and wide-area networks together and Allow any computer on Any of those networks to communicate with any other computer Irrespective of what technology the individual networks are using So this is the concept of internet working Connecting those different networks together and we achieve that using datagram packet switching in the internet or packet switching generally Where we have for example this case multiple lands and wide-area networks and we connect them together using packet switches so These are packet switches here But more specifically when we talk about the internet we refer to them as routers It's just a different name Routers and packet switches that operate at the network layer. So we're in the middle layer of our five layer stack the network So they play a major part in connecting these Component of these smaller networks together to form one large network So we have these smaller networks using different technologies potentially we connect them together using routers and When we connect them together if we're using the Some internet working protocol, which we'll see shortly then We'll allow anyone on any of these networks to communicate with anyone else and we'll get as a result this one large network called an internet work or an internet so The terminal terminology is listed here We'll talk about routers that connect these smaller networks together and Because when we take the smaller networks and connect them together to get one large network Often will say that the smaller networks are subnetworks. They are subnetworks of the larger network Subnetworks or subnets so in this example, there are nine subnets and We join those nine subnets together using the set of routers and the result is one large network called an internet work or an internet So this is an example internet So an internet is a network we get when we join these subnets together using routing or routers In a simple just definition and the process of doing that is called internet working So a general internet that is any network that we connect together in this way. We can call an internet But we know that in across the world many networks all connected to the one large network And that one large network we refer to as the internet Usually the where the uppercase i for internet That's the the network that we use on a on a daily basis to form the internet and the internet use Users as we'll see in this topic the internet protocol a specific protocol That will allow any computer on any of the subnets to communicate with any other With computers on any other subnet So it's just some terminology that we talk about routers connect subnets subnets join together to form an internet We distinguish between routing and forwarding and I've said this before in previous topics We say that routing is the process of discovering the best path through the network Forwarding is the process of once we have a path Sending the data across that path we forward the data by switch through the network and Some some other terminology to make things a bit clearer as we go forward We've already talked about packet switching and circuit switching so these devices That connect networks together. We can talk about a switches now. We're talking about using packet switching We'll see specifically the internet uses datagram packet switching. So these Datagram packet switches But we'll generally just call them a router. It's the more common name in the internet What's inside one of these clouds? Okay, so I've drawn a cloud to represent a small net or some network a land for example, what's inside it? I'll not try and draw it but Okay, you can think this cloud has different end end user devices attached PCs laptops Whatever the user is using servers even Inside the cloud is depends upon the the technology used in that subnet for example if it's a wired LAN We may have some PCs connected via cables into some central ethernet switch and That ethernet switch connected into this router So we introduce very briefly last week a common topology in a wired LAN as we take our PCs They have a cable that and they all go into one central switch called an ethernet switch and Then that one central switch can then go to the router What about a wireless LAN if this LAN 4 was a wired LAN LAN 1 was a wireless LAN Well in addition to a switch we may also have things like access points where we have laptops Mobile phones connect wirelessly to some one or more access points, and then the access points have wired Network into some switch and then possibly into a router So depending upon the technology used in here What's inside the cloud? May differ The idea of drawing a cloud is we don't care from this perspective. We don't care what is in here. We just say some network technology It could be a satellite link across the globe So across the wide area network 3 it may be connecting up to a Satellite up in space and then down to one of these other routes So we hide that detail of it So Coming back to switches it gets confusing because now we have different types of switches. We will talk about packet switches Specifically at the network layer now that we're in the network layer a packet switch will refer to as a router If we're in another network, we may use circuit switches Inside wired LANs we often refer to ethernet switches LAN switches Different types of devices So if we connect these subnets together via routers, how do we get data from one computer to some other computer? Well, we use an internet working protocol Because the different subnets use different technologies we need some other protocol to overcome those differences Differences in addressing Differences in the way to recover from errors differences in how to transfer the data efficiently across the network So we introduced a new protocol an internet working protocol which has the aim of getting the data from one Computer across this internet to the destination What would such an internet working protocol? Do what's some requirements? Some are listed here Provide links between subnetworks between subnets Don't be able to join different subnets together and we use routers for that to be able to provide some form of routing to find the path and Forwarding or delivering the data across the different subnets So to make sure we can get data from source to destination So we we know one way to do that Data-gram packet switching and we know concepts for how to do routing in the network So we can use the concepts of data-gram packet switching and The concepts of routing that we saw in the previous topic to to solve this this problem Usually when we build a network We use it to transfer data But we'd like to make sure that that network is operating correctly We don't just build it and leave it run for 10 years. We may need to Get updates on how it's running if there are any problems in the network and to perform maintenance on that network so It may be useful if we have a protocol that allows us to send data through the an internet to also To be able to collect data about the current status to monitor to report if there are errors Some some form of monitoring Importantly an internet working protocol needs to deal with the many differences between the subnets on this subnet. We may have One particular addressing scheme for the hardware addresses like the ethernet 48 bit hardware addresses here on This wide area network number three. We may have a different addressing scheme So when we want to communicate between two computers on different networks, which use a different addressing schemes Well, it's very hard to communicate because my computer on land for Doesn't know about the addresses used on other networks, which may be on the other side of the world so an Internet working protocol has to deal with that somehow and the normal way is to introduce a a new addressing scheme a New addressing scheme that all devices on the network use We'll see in the internet protocol. That's IP address Another difference or a problem that That occurs when we have multiple subnets is the concept of error recovery Let's say so error recovery is how to cope with errors across our links across our subnets. For example, we know of using Retransmissions ARQ scheme stop and wait go back and selective reject to send our data Wait for an act send it again That's a way to recover for errors But different technologies may use different error recovery mechanisms, so this land for may be using some stop and wait ARQ This wide-area network using some selective reject. Maybe this wide-area network doesn't have any error recovery It's a very simple Protocol inside here. We don't know we cannot predict in all the networks in the world what technology they'll use for error recovery So now if I want to send data via these subnets I Want to make sure when I send it it gets delivered to the destination Well, I'm Confident that it'll get delivered across the first subnet because that has a means for recovering from errors So is the second subnet But the third one does not because it has no inbuilt Error recovery mechanism as an example So if I send data across this path I know I have no guarantees that it's going to get delivered to the destination So one thing that we may want an internet working protocol to do is to provide error recovery across the entire network across the path As opposed to just across a single subnet or across a link So there are many differences between the technologies we may use in the subnets And we must deal with those differences and that's what an internet working protocol Should try to overcome for example differences in security Ways to report errors inside the subnets Different protocol parameters like what is the maximum packet size one subnet may have a maximum size of 1500 bytes The next technology has a maximum size of 10,000 bytes So when we send data across the network, what size data should we send? 1500 or 10,000? Well, we need to consider The maximum sizes supported by all the subnets along the path So an internet working protocol will try and deal with these issues So that's some general requirements for an internet working protocol And people over the years have developed set or different internet working protocols different protocols to try and meet these requirements One of them is called the internet protocol IP And there are others The internet protocol has become the most widely used one the others Old ones which were really replaced by IP Only used in very old networks Or some which are used in very specific domains very small or Very specialized networks, but the main internet working protocol available Is the internet protocol It turns out that the internet protocol is does not meet all of these requirements that we want The idea of the designers of IP were to in fact keep IP very simple So it does some of these things but For those that it doesn't do it leaves to other protocols So it's an idea of keep this internet protocol simple by just providing a few features Those other extra features that we may want to provide use other protocols like ICMP TZP and others we may see over this course Let's look at IP and see what what features it does provide So this topic we're going to look at What is the internet protocol? How does it work? And then we'll look at parts of Look what are IP addresses? How are they structured? What do they mean? And we'll get a bit of an example of an IP address today as well So IP as Is the internet working protocol used in the internet and the main one used in the world today There in fact two main versions of IP IP version 4 and IP version 6 IP version 5 they skip that because there was some other obscure protocol used that referred to IP version 5 So really today we have IPv4 and IPv6 it turns out IP version 4 has been around for many years, so I think In the 1970s it was first specified. So what's 30 or 40 years? IP version 6 has been around for more than 10 years Maybe designed 20 years ago almost It turns out today Although both exist IP version 4 is still the main one used in the internet IPv6 is available And most devices many devices support IPv6, but not many networks use it So my my laptop or most standard operating systems support both version 4 and version 6 But for example the sit network the routers Inside sit and inside tamasart do not support or do not use IPv6 So we're going to focus this course on IP version 4 In maybe next semester in if you take computer networks and network architectures I think it's called ITS 327 IPv6 will be covered And there are others Mainly old ones IPx x25 and others, but we're focusing just on IPv4 that the main one Developed by the US Department of Defense, but now it's maintained The standard is maintained by the internet engineering task force the ITS They look after it and they develop IPv6 and any enhancements What does it do? It operates at the network layer So in our five layer stack the network layer is the one in the middle It's an internet working protocol It uses datagram packet switching So of those three switching techniques we're using datagram packet switching the simplest of them all The ones where we just take our data Break it into packets and send them And it's connectionless Which means there's no concept of establishing a connection before you send data Which is what we know with datagram packet switching We'll see in some protocols What we do is if I want to send data from source to destination the source first contacts the destination saying I want to send data to you And the source and destination may negotiate some parameters for this upcoming data transfer The destination may get prepared to receive the data for example allocate buffer space So they may choose parameters for the protocols to use So they set up a connection That's a connection oriented protocol that does that they establish a connection IP does not do that. We say IP is connectionless. There is no concept of a connection It's very simple There's no overhead of establishing a connection But it means that we cannot inform the destination that we're about to send data We'll see the a main example of a connection Oriented protocol one that does create a connection. We'll see that in the next topic is TCP So what features of IP? It provides data delivery. Okay, that's our main main goal to get data from source to destination It provides addressing So we're going to see that Because the different subnets use their own addressing scheme the internet protocol you introduces a new addressing scheme IP addresses such that the Devices on the internet all use this same common addressing scheme So it defines the format of those addresses and the meaning And another feature of fragmentation and reassembly which means it's got the ability if we have a big packet To fragment it into smaller packets smaller chunks and send them as smaller chunks And then reassemble them at some destination So that's sometimes needed When we send data, which is too large to support To be supported by a subnet We're going to spend a lot of time in this topic on addressing. We'll see the basic mechanism for data delivery There's a few slides on fragmentation and reassembly. We may just mention that quickly one thing Sorry What does it not do so one way to understand what IP is is to look at well some of those features on the previous slide that we'd like That are not provided by IP It doesn't establish a connection. We said it's connection less Which means Before we send data. There's no negotiation of how to send the data. We just send it So the destination doesn't know data's coming. It just starts receiving the data There's no error control in IP My source computer sends the IP packets We'll actually call them IP datagrams And if they don't get to the destination too bad The source will not retransmit There are no acts coming back So I just send the packets and if they get there good data is delivered if they don't get there Because of some errors in the network from IP's perspective It doesn't care And I think you know that that's not so good for some applications It doesn't do any flow control. So it doesn't provide flow control So if my computer at one endpoint is sending very fast and the receiver destination is very slow We may overflow that receiver IP doesn't care But we know that in some cases we'll need to deal with those issues What if there are errors? IP doesn't fix them In the internet we genuinely leave those features To another protocol called TCP That's at the next layer up to transport that IP does not report the status of any links of any devices in the network That's a nice feature. We'd like to have to know whether the network is working IP doesn't do that. There's another protocol called ICMP that will do it for us in In most cases IP doesn't provide any priority for data Or any quality of service. What that means is When we send an IP packet Send it through the internet I send my IP packet, which is for my web browsing You send yours through the internet you which is for some voice call IP doesn't Treat them any differently. It treats them the same It doesn't give one priority over another That's a nice feature to have in some cases. Sometimes it would be good for My voice packets That the packets that belong to my voice over the internet call To get a higher priority than someone's web browsing packets Because often with voice we want a small delay so we can talk And communicate efficiently IP does not have such features to provide any priority priority or quality of service It's left to some add-on features called a diff serve and insert, which we will not cover It doesn't have any inbuilt security I send an IP packet From some source computer. It goes through these subnets and gets to the destination Anyone with access to these intermediate devices these routers Or these subnets Can potentially see the contents of the data that i'm sending across the internet There's no encryption of that data So that the data we say is sent into clear Again, there are applications that we would like to make that data secure so that Someone with access to these intermediate subnets Still cannot see what i'm sending IP doesn't do that. There's another feature or another add-on really called ipsec that adds that security We will see tcp in a bit more depth in the next topic You'll see icmp in some practical tasks The others we were not In terms of our five layer stack It's in the middle the network layer The simple view is that All the subnet technologies the lands the wide area networks like Wireless LAN ethernet Some of the wide area technologies frame relay atm optical fiber technologies Satellite microwave wireless think of them at the physical and data link layer They are used within the individual subnets The internet protocol in the middle of our stack We think joins them all together. It's the common thing Amongst all the computers in the internet And above that we have transport and application layer So what we're going to see is that all of the computers Which generally want internet access Need to support the internet protocol Your mobile phone laptop pc And also the routers that connect the subnets together All must support ip It's the one common thing for the devices that connect to the internet If they don't implement ip Then generally they cannot get access to the internet Unless they go via some intermediate device some special device so You may use different physical and data link layers You may use different transport protocols There are some common very common ones, but there are many others as well Many different application protocols, but for internet access You need to use ip Some people say the core of the internet is built around ip We will see that ip doesn't provide Or it doesn't specify which routing protocols to use You can choose the routing protocol A routing protocol is a protocol that automatically finds the routes through the network the best paths And creates our routing tables ip doesn't do that it leaves it to some other routing protocols We'll we'll see a little bit about icmp and arp later Who has done the practice lesson on packets? Hands up Practice lesson on packets Is that a hand To anymore try and do the practice lesson on packets, okay? It's not related to any specific topic It's about what do we mean by what's a packet? What's the structure of a packet common examples? In fact, one of the examples is That I use in that lesson is ip datagram. So Some people have already seen this and they'll understand this straight away others Uh, a little bit more time But still try and do that lesson because it's useful understanding how most protocols Structure their packets in the internet today So the internet protocol like most protocols has some packet structure It contains data and a header. There's no trailer at the end just the header at the front and then data What's that structure specifically? What does the header look like? What information does it contain? Here's a picture of an ip packet In fact, we often call it an ip datagram Okay, so sometimes you'll hear me say ip packet other times ip datagram Are the same thing The typical ip datagram contains a 20 byte header Followed by data The way this diagram is drawn is that our 20 byte header The packet is just a sequence of bits and the header is a sequence of bits where Sets of bits have some specific meaning We'll see that the first four bits in the header mean or indicate the version of ip we're using Either four or six So the first four bits indicate the version of the protocol So in a packet it's just a long sequence of bits but To draw on a piece of paper on the screen instead of drawing the the large continuous sequence of bits We commonly structure it in some way in this case We've structured it so that this each row indicates a sequence of 32 bits And we read row by row So this is the first bit or on this diagram the zero bit we start counting at zero the 31st bit And then we come back to here the 32nd bit And and so on so we read row by row It's just a way to present the structure of that packet in some convenient small picture So let's look at the fields of the header What information is contained in every ip datagram in the header of each datagram? The version a value that indicates either version four or version six We're dealing just with version four the header length is normally or by default 20 bytes But it turns out you can add some optional fields And so if you there are some optional extra features of ip that allow you to add extra fields That's this options part And that may vary in size Therefore, there's a field h length which indicates the length of the header It counts in I think four groups of four bytes So in fact by default the value is five Because there are one two three four five rows or five groups of four bytes 20 bytes in total But if you add some options, this will increase So it just is a way so that when we receive this datagram, we know How big is the header? So that we know well, where does the header finish and where does the data start? Because if I receive a sequence of bits, I need to know Which parts of the header and which parts of the data so the header length indicates that diff serve and ecn They are fields in the packet that I use to provide priority and some Performance enhancements in the internet I said that ip doesn't provide any priority Well, it doesn't the protocol doesn't although the header field the header has fields available to Indicating the priority of the packet By default ip doesn't treat them any different We're not going to touch upon these two fields You need to go into advanced parts of internet working to see them in use Total length is a 16 bit value that indicates the total size of our datagram header plus data maximum size 65656 bytes with a 16 bit value That's the maximum size of our datagram In practice, it's usually much smaller But that's what we can go up to So if we know the header length And we know the total length Then we can calculate the data length ID identification is like a sequence number. I send the first Datagram value one next one value two so we can include a some sequence number in the datagrams But we don't have any retransmission schemes So we don't use it for any error recovery, but we can use it to keep track of packets as we're sending the Ordering of them The next two parts flags and fragment offset What we may do is send a large datagram and say 10,000 bytes send it It gets to a subnet which has a maximum size of a thousand bytes So we've got a 10,000 byte datagram, but the network technology only supports sending frames of a thousand bytes So we'll need to fragment that 10,000 byte datagram into smaller chunks So that's the process of fragmentation where we break The data into smaller chunks and send them as say 10 different ip datagrams 10 fragments If we do that We use the flags and the fragment offset to keep track of that we've performed the fragmentation and that we The ordering of those fragments So if we break our original datagram into 10 fragments Then we keep track of fragment one fragment two and so on Because at the receiver When we receive those 10 fragments we need to reassemble them and get the original Large 10,000 byte datagram back I think in this course, we're not going to go into much detail of how fragmentation and reassembly works But we use these fields to support it What's time to live? Where do we use time to live or where have we seen a concept similar to time to live? It's the number of so you you may have seen it when you Send some data across the internet or test the network You can see some information about the number of hops That we traverse or the number of routers that we traverse from source to destination Remember flooding In flooding one of the extensions was a hop limit The idea was that the source sets the hop limit to say three We send it to the first across the first link the first hop is reduced to two The next one it's down to one the next one. It's down to zero and then it's no longer sent We use the hop limit to limit how many hops that packet would traverse when we did flooding The same concept of time to live The source sets some time to live value Although it says time to live it doesn't measure real time. It usually measures hops So if I set the time to live in my ip datagram at the source to be three When it's sent across the first hop to the first router is reduced to two Then sent across the next hop reduced to one Then the next hop down to zero once it reaches zero That router will not send it again It's reached or it it's expired that packet has died So it's used in the similar way to a hop limit and it's used in to diagnose parts of the network operation You may see to see how many hops your packet traverses One thing that's it's useful for is Is if you send a packet in the network and there's some misconfiguration in the network Maybe there's a route such that one router sends the packet to the next router And then that one sends it back to the first router because of some error in the network And they keep sending to each other Okay, and it becomes a loop that the the packets go back and forth or enter some loop in the network Or they go forever that packet would be sent forever in in that network in that loop Setting a time to live means that eventually the time to live will get down to zero and the packet will be destroyed It will not be kept being sent. So it's a way to stop such errors for Causing packets to be sent forever and we use it for diagnosed diagnostic purposes So the source sets the value And it's reduced For every hop we transmit this datagram across similar to hop protocol The protocol field indicates what protocol was used For the data put inside of this datagram It really means the next higher layer in the stack In this this diagram when we create the datagram The data comes from the the application Maybe we're using TCP as the transport protocol That data from TCP is sent to ip and ip creates a datagram The data inside the datagram came from TCP So the protocol field in the ip header says that this data came from TCP There's a specific number that indicates TCP. I think the number six If it came from another protocol like UDP it gets a different number in the protocol field So really the protocol field tells us where which Higher layer did this data come from TCP UDP? There are others In fact ICMP is also a case here. I think has a protocol number one So it tells us the data inside our datagram. Where did it come from? header checksum Is used when we receive a datagram to check if there are any errors in the header A checksum is some error detection code We haven't covered the algorithms, but the concept is that using this value When we receive the header we can check if the values in the header Have any errors from what was transmitted So we transmit some value of the protocol field six The receiver receives the datagram and there was some error in transmission such that comes out as 23 Using the checksum we can detect that that was different from what was transmitted So we can detect errors in the header It doesn't cover the data. We don't know if there's any errors in the data just the header But ip has no retransmission scheme. So if I detect an error All I can do is discard that packet. I cannot get the source to send it again the last two fields the address of the computer that generated the ip datagram And the address of the computer that Is the final destination the intended destination of that datagram. They are ip addresses How long is an ip version 4 address? An ipv4 an ip address How long is it? And the answer is on the screen How long is an ip address? For example, how long is the source address? What's the the picture tell you how many bytes or how many bits? 32 This diagram shows us the structure that Okay, this is the header. These are the first 32 bits The next 32 bits and so on and okay We see that the source address the source ip address takes up 32 bits in the header So it tells us an ip address is 32 bits in length So a source ip address is a 32 bit value that Identifies the computer that sends this datagram And the destination is a 32 bit value that identifies who we want to get it to the destination ip version 4 uses 32 bit addresses ip version 6 Uses longer addresses anyone know the value I'm not sure if this slide say it anywhere ip version 6 With ip version 4 with 32 bits There are about 4 billion possible values 2 to the power of 32 is around is around 4 billion So with a 32 bit address space in theory we can have have up to about 4 billion different ip addresses How many people in the world anyone roughly How many people in the world? About 7 billion How many people use the internet? Definitely not all of them I don't know one or two billion maybe one billion But now think about all the other devices We don't necessarily we need often ip addresses not just for your laptop your mobile phone your home pc But many devices which connect to the internet servers Monitoring stations so inside factories they use ip addresses so If we think of the world and all the devices that want to connect to the internet With a 32 bit address We don't have enough addresses available to give a unique one to everyone And there are ways around that And one of the main reasons that led to the development of ip version 6 was to give it a larger address And ip version 6 uses 128 bits With 128 bits we have 2 to the power of 128 possible addresses And I can't never remember the value it's something like Billions and billions and billions of addresses for every person in the world. Okay, so More than enough addresses if we use 128 bits ip version 4 32 bit addresses are used today, but We need special ways to overcome the the Limited number of addresses Before we look at how ip works. Let's give an example of an ip address Let's look at the configuration of my Wireless LAN interface on my laptop How many interfaces on my laptop anyone remember? How many network interfaces 2 3 3 maybe If I turn them on wireless LAN Wide LAN or ethernet And bluetooth can be thought of as an interface as well This is the configuration of my wireless LAN interface My wireless LAN card it has a hardware address That's used just on the wireless LAN Just on that one subnet I use this hardware address to communicate with anyone else on the wireless LAN Like the access point up there Has a hardware address And it has an an internet address Which is our ip version 4 address 10 dot 10 dot 100 dot 184 There are some other addresses, which are also special case ip addresses It also has an ip version 6 address an inet 6 address This long string of hexadecimal values Those three addresses the hardware address The ip version 4 and the ip version 6 addresses Are presented by my computer or by this software in some human friendly form Those three addresses are all just binary values The hardware address is a 48 bit value IP version 4 32 bit IPv6 is a 128 bit value And my computer always deals with the the binary value when I send the the packets It's just that so Us humans don't have to write down these long binary values and we don't have to deal with them There's some common way to convert them into some a little bit more human friendly values Let's look at how to convert IPv version 4 addresses 10 dot 10 dot 100 dot 184 So we convert that into a The actual 32 bit binary address And it's quite simple And just just not this is a bad example from the perspective that this is these are four decimal values It's 10 10 100 Although it's ones and zeros. This is not binary And this is 184 The way to convert it to that the real ip address is that this is called dotted decimal notation where we have four decimal values separated by dots And each of those Decimal values represents eight bits of the 32 bit address So our ip address is 32 bits long We break it into four chunks Each of eight bits in length And each of those eight bit values are converted to a decimal value And with an eight bit value the decimal values can range from zero up to 255 So to convert to the binary we just convert each of those four decimal numbers into an eight bit value And you can do that We'll do it quickly So 10 Here we go That's 10 as an eight bit value And in fact the next one is convenient because it's the same value 10 10 100 And you're checking that my conversion to binary are correct 184 it should go on the same line, but I'm out of space but 184 is So just convert the decimal values into eight bit values Remove the dots and we now have a 32 bit ip address So that's the simple way to or that is the way to convert from what's called dotted decimal notation To the actual binary value And to go the other way you take the binary value break it into four eight bit values convert to decimal Insert dots between those four values and we get what's called the dotted decimal address so Everyone can convert ip addresses now Whenever you see an ip address for your computer you can easily convert it to the binary form So when my computer sends an ip datagram the source address Would have these 32 bit 32 bits in the header Destination address would be another 32 bits for the destination computer Any questions on the conversion easy Remember it because we'll use it. We'll need it to when we look at other parts of ip addressing There are some slides later on ip addresses. This is just one example So always remember ip addresses in fact most addresses are stored in binary It's just the human friendly forms are used by computers by when we describe them To make them a bit easier to communicate That lists those packet header. Yeah the header fields Let's look at what have we got remaining a few slides On some of the features of of ip and this one I think we've said Enough of what I need to say is that ip is connection less We don't set up a connection An alternative is what's called connection oriented Where we do set up a connection Now ip doesn't do that Not setting up a connection makes things simple It's very simple It can be flexible. It can work with many different types of connections and there's no overhead Of setting up a connection But setting up a connection can be of a benefit In that we inform the destination. We're about to send data And they can negotiate parameters for that data transfer to to optimize the data transfer based upon What they agree ip is connection less in the internet the devices that Let's say are attached to the internet. We distinguish between hosts and routers I don't have it on the picture here, but going back to our example We have subnets these clouds connected together by routers And not drawn here, but imagine around attached to the subnets are hosts. Think of your end user computers servers and so on they are the hosts and Both hosts and routers need to implement the internet protocol So they all take part in ip What's the difference between a host and a router? What do we mean by them? Hosts are the end user devices They create the data that needs to be sent across the internet And they receive the data. So they are the sources and destinations of the data A router In most cases just forwards the data through the network. So in the typical scenario A source host creates the data Sends to a router which forwards to another router to another router Which eventually sends to the destination host. So that's the typical role of those devices hosts or sources and destination routers forward the data Some characteristics So think of a host as a laptop a mobile phone a server some sensor in a network Hosts normally use only one interface at a time We said my laptop has three interfaces wireless LAN wired LAN and bluetooth So I have three interfaces And I may have three IP addresses one for each interface bluetooth is an exception But I normally just use one at a time If I'm using the wireless LAN And then I plug a wired LAN cable into my laptop Most likely my operating system will switch to use the wired LAN You can test it at home Test and see okay you're using the wireless LAN then plug in a LAN cable See whether the the operating system switches Normally they'll automatically switch to use the LAN cable because in most cases that's better So in most cases hosts use just one network interface at a time even though we have many Now it doesn't have to be the case. You can set up your host So that it can use two two interfaces at the same time It's possible So sometimes the operating system will support that so I could be Downloading data via the wireless LAN and the wired LAN At the same time It's not common, but it's possible Routers almost always have two or more interfaces and use at the same time Because a router connects two or more subnets together a router connects subnets together So normally with a router we have Say a cable connecting to one subnet And another cable connecting to another subnet And we can be sending and receiving data on both of those interfaces at the same time So that's typical operation for a router And we may have more than two A key and and the primary difference if we want to define hosts and routers A host does not forward datagrams A router does forward datagrams If we need one thing to just to differentiate between the two is the forwarding of datagrams A host never forwards datagrams so What that means if if my laptop is a host If it receives an ip datagram it looks at the destination address If the destination address in the header matches my computer's address 10 10 10 10 10 10 100 184 Then that datagram is destined to me and it's reached the destination But if I receive a datagram where the destination address does not match my ip address Then that's an error. I would discard that datagram I will not send it on to someone else. I will not forward it to someone else because this is a host A router of course does forward datagrams. That's its main role What is my laptop host or router? Hands up for host Think carefully. Okay easy one my laptop host or router It's a host But in fact I can easily turn it into a router Okay, it's normally a configuration of the software of the operating system as to whether it forwards datagrams or not And it takes me one line To turn this host into a router Even with a single interface I can act as a router It may not perform well, but I can receive and send as a router So I have have a wired interface. I could plug a wired LAN in And use my wireless LAN interface and I could have this laptop act as a router But I'd have to configure it to do so and the way to do that is to tell it to forward datagrams most consumer operating systems don't Forward datagrams by default that hosts by default A host because it doesn't forward datagrams is either a source or a destination A router mainly Forwards datagrams, but in special cases it can act as a source or a destination That's that's in cases where we want to Set up the router. We want to manage the router Some of you would have done it. We've got a home adsl router normally that home adsl router Forwards datagrams it receives from your computer and sends them on to the isp So it's acting as a router But sometimes you can the router will support you configuring it changing some parameters So you open up your web browser on your pc you type in a special IP address for that router and Change some configuration of the router In that case the router is actually acting as a destination and source of datagrams So in the main cases a router forwards, but it can be a source or destination And again, we've said this before we distinguish between routing and forwarding. How are we going with time? Let me just see what we need to cover We'll not cover that forwarding See if we can cover this today This shows the protocol stacks for an example network or a path through a network. So we have some source hosts now So think of hosts as the end user devices And routers connecting subnets together So I want to send data from the source to the destination host via some set of routers I don't care what's inside the subnets, whether it's a wireless or wired technology Whether it's a wide wide area network or local area network to some subnet And underneath those devices Is the protocol stacks So this is implemented inside the source host And this is inside router one router two and so on And this link think of this as the cable connecting source host to router one Maybe wide or wireless connection some link At the bottom two layers Source host and router one are on the same subnet So they must use the same technology to communicate across that subnet across that link And that's related to the data link layer and the physical layer Recall that these two bottom layers are about getting data across a link Not across a network, but it just across an individual link or in this case A well not across an internet But across a link or in this case our subnet So for example a wired LAN Where the data link layer would be the IEEE 802.3 ethernet standard and similar for the physical layer So both source host and router Must have interfaces that support the same technology then Let's say technology a I haven't given it the name technology a they need to be the same so they can talk Router one and router two are on the same subnet And maybe we use a different technology technology be They need to support the data link layer and physical layer so they can communicate to each other across the subnet And similar across the other subnets The technology Amongst the subnets may be different So For router one to talk to router two it may use a different technology for the source host to router one So that's why label. This is Data link layer a and physical layer a and this is b. So they may be different What's one thing we notice? The routers generally need to support or need to implement The data link layer and physical layer for each subnet they connect to Maybe technology a is our wired LAN technology b is a using adsl and some atm wide area network So different technology here So they may be different across the subnets The internet working protocol in this case ip is what joins them together and we see the hosts And all of the routers implement ip And that's what allows us to send data across these different subnet technologies They all use ip the internet protocol So hosts and routers in the internet must implement ip And We will not cover it today. We'll get on to it tomorrow But there's a way then which we forward the datagrams to the router Which then forwards it on to the next router and then to the destination The the highest two layers the transport and application layer Only needed on the hosts on the source host and destination host We see the routers don't care what applications are being used If we go back to our packet switching or our switching The switches in the network just have the role of getting data from source to destination They don't care what the data is They don't care whether we're using tcp as a transport protocol HTTP for web browsing Or we're using some voice over ip some voice Application which uses udp as a transport protocol From the routers perspective, it's all just ip datagrams. The data inside is doesn't care so The transport layer and application layers we say The protocols in those layers are end end to end protocols. They operate between the end points only The routers don't need to implement those protocols So in summary data link layer and physical layer are common across each subnet So here's one technology. Here's a potentially different one ip is common across hosts and routers Transport and application layers are common across the hosts that want to communicate So what does ip do? It's very simple in the because there's no error recovery No retransmissions. There's only one type of packet an ip datagram. There's no acknowledgments There's no setting up of a connection We just create an ip datagram Send it to the router which sends to the next router and so on until it gets to the destination If it doesn't get there because of an error somewhere along the way Then too bad There's no concept of retransmitting The details of how we forward it through those routers will cover tomorrow morning so we'll cover ip routing And ip forwarding not with a w tomorrow morning


Do you have any questions? That essentially brings me to a close of what I wanted to talk about over yesterday and today. After this I want you to write some code. So, we would pick up some problems which we will write, but before that some introspections took question asking time. In the morning session in version control, you open a particular file, you delete one line and again write the same line and the same position. Will it be taken as modified or adding or? It will be taken as modified because the programs do not have any intelligence. They will essentially look at files time. Some identically type the same thing, we will test it, we will test it in a slightly different place. So, that is a file A, copy A to B, you are not using the mercurial diff, you are using the Linux command line utility called diff, but they both operate on the same principles. In fact, diff is the basis of version control to take a small historical aside. The whole idea of version control was how do I store multiple versions without losing space? Today we have gigabyte disks, but in the early days of computers, space saving was as important as anything else. So, somebody came up with the idea of I have original file plus the deltas only. I had a 100 line file, so version 2 was line 4 replaced by this, line 7 and 8 deleted. In position 12, these two lines added. If I keep only that, both copies are now occupying much less space. So, essentially that is how the original source code control system SCCS was born. So, it is a series of shell scripts using diff and another thing called patch. Now, let us edit this B, delete the line again, notice, because it is doing a textual comparison. So, probably the diff inside mercurial will do the same thing, because that diff and this diff would be sharing source code is my memory, but test it out at some time. I am leaning to the side, it will be the same and for the nth time, note the absence of any output when the files are same. You ask me, what is the difference? There is no difference. So, I have nothing to say. So, there is no output. Yes, diff would do that. The diff there will do the same thing, because it is like I said, the underlying algorithms are the same diff. So, I am guessing, I am still guessing, not for a day till telling you it will do the same thing. I am still guessing the same algorithm is operation in the HG diff also and it will do the same thing. Let us test it out. I am editing this too, I will delete this line, replace that line. Now, I have to save, let us see, no change, it does not show the, as modified, I deleted two letters typed in the same. So, essentially I have replaced a line by itself, it does not see it as change, because it is using the same diff, there is nothing to commit. Commit means my working copy is different from the last committed one, according to it there is nothing. I just removed the other files, nothing changed, there is nothing to commit. Well, this is interesting, then add much to our handling of versions. It confirms that the people who wrote these systems have applied lot of intelligence, that is all. So, that is the interesting point, it is a good quiz question, good quiz question to ask. Anything else? Rather, next question, there has to be something, anything else encourages us to say no. Here is the version one of the code and if you are committing two, three times and then there is a requirement of going back to the first point. I do not think it is possible, is it possible? You are thinking wrong, you can say full the answer. Selective undo, I mean I know that it is only last commit and delta would be stored, that you say. You can get back a specific version. First version of the code. Oh yes. Then committing up to certain level, two, three levels, so version two, version three, log one. Now. There is no one. Yes, so log is updated. So many are there, right, so many versions. So, I want version one now. So, like is there any upper limit, no limit. Whatever versions are there, anything can be got, that is the whole point. Progressive scan, sorry. Something like progressive scan, keeps on increasing. You probably do not see that because, sorry, we have used the same file and we have made minor changes. The best way to see it is possibly, I have got a file called version. I think I deleted something else in between. I wanted to show one, two, three, four, so that you know which has come because in that file it is not. But it will get you the one you want. All right. Anything else? In any of the Python stuff, version control, before we move on, yeah, we have about 40 minutes. This is a reasonable time for the exercise I have in mind. That is not a test. That is a testing tool. Okay. Unit test, we saw for each module, you write only corresponding unit test module. For GCD, you write a test GCD. So, a large application can have nodules spread in a nice directory structure. I can have a menu, then sales, this, that. So, the code will be distributed in a directory structure. So, you will have for each of them a corresponding unit test. How do you run all of them? You have to go to each directory and run, which is a pain. So, no job is, it will sniff for all these fellows and run all of them. It is simply another convenient tool. Again, nothing much to learn there. It is simply you have to know the syntax. It is an idea is that unit tests are always for a model at a one unit level. But, when you want to do what is called regression testing, you want to, you have made a change, you want to run all the unit tests. So far, we have not seen anything which gives us an easy way. The way we have done so far is you have to go run each unit test module, which is a pain. If you have hundreds of modules, NOS will automate that job for you. That is all. So, it works at one level higher than unit test or dog. The advantage of NOS is it does not care whether you have unit test or dog test or whatever. It will run everything. All right. Next question. Other than the basic image processing things that we have seen yesterday, anything like if you want to process further filtering and all such things. So, that support is available with Python. Among the Python aficionados, there is a phrase for the language. It is called Python is a battery's included language. It is just as I am read function is available with us. Do we have functions to read MP3 and related files by UV? So, if you want to process some elements and look into that, that functionalities are possible. I do not know specifically, but in general the answer is normally yes. You have a large number of libraries for handling different things. Do you have the Python docs online? I mean on your machine. Let us take a look at the Python document, library reference, built-in types, data types. You have a daytime module, calendar. These are built-in modules. Collections, heap queue, bisect, array. Obviously, numpy has even more better arrays. It is the same. Mute xq, weak reference, user list, pretty printing, numeric and mathematical function. These are written by the way. Meaning they come along with Python without going to numpy or scipy. You have a decimal. So, you can do decimal math. You can handle fractions. 2 by 5 and get a fractional number rather than one floating line number. In file and directory access, you have all these modules. So, many different ways of doing data persistence. You can read gzip, tar files, all of that. So, XTR data you can code. You are following cryptographic services. Once again, these are basic. That is all available. You want AES or anything. These are third-party libraries which are available.  So, many OS related, IPC, email, JSON, mail cap, mailbox. So, effectively, you can send an email from within a Python program, SMTP to receive a whole lot of markups. You can generate HTML, XML, parse it. You can read a website like a file. Syntax is almost the same.  It will give you the page line by line. Once again, you rarely write more than a few lines of code. These are the multimedia services. You can see very many different files can be written. I do not know whether MP3 files, I think, are outside this. These are? Yeah. So, others will be available. These are graphical user interfaces, whole sort of development tools. Doctest and unit test, which we just now saw. There are others. There is a debugger. Then there are windows, unique specific services. A whole host of them. Now, if you are looking at something specific, you may want to simply Google for it. Chances are very high. You will find it. For example, you want to do extensive data warehousing type of analysis of data, large scale data analysis. There is a package called orange written in Python, completely open source, huge volumes of data. Similarly, there is a biopython module, which gives you a lot of biochemistry, biophysics analysis built in. You want to do natural language processing. One of the largest tool kits called NLTK is available. You can do significant amount of natural language processing. You want to A tool kits? Yes. Lot of specific things are available. DSLs are available. Almost whatever you want is available. So, I just typed Python MP3 parser. I walked into something called pymedia.org. So, Pymedia library is a Python module for wave MP3, oog, avi, dvx, ding dong, ding dong, allows you to parse, demultiplex, decode and encode. I have no idea what all those things mean. If they mean something to you, you got it. Some of you have expressed an interest in 3D visualization or 3D. Please look at MayaV. MayaV is written by our own program, by the way, which is probably the single largest open source application contributed out of India. It is a huge application. We can probably take a look at, that is MayaV. If you are interested in these sort of things, I suggest you keep in touch for the next PsiPy conference in India. Every year, we have a scientific Python conference, where a large amount of, for example, Berkeley Neurosciences Group has huge amount of Python work they do, and they are a big contributor to PsiPy. And of course, all of it is free. MayaV is free. You can download, install VTK. This is used as VTK, which is fairly standard. As far as visualization goes, VTK is a reasonably standard format. So, MayaV can read and write VTK format. Anything else? All right. So, maybe let us write some code. What shall we write? I will give you a description. If you discuss amicable pairs, the problem is to generate a list of all 5-digit amicable pairs. Two numbers are said to be amicable if the aliquot of the first is equal to the second number and the aliquot of the second number is equal to the first number. What do you mean by an aliquot of a number? It is the sum of the factors of a number. For the purposes of the aliquot definition, a factor is any number smaller than the given number including one that divides the number without a reminder.  So, that those two examples are given just to give you an idea of what aliquot is. So, go ahead, create a repository, write some code. Anybody has anything to say, comment on the aliquot problem? Sorry, the amicable pairs. So, that the time it took about 25 seconds, less than 25 seconds and that is the code. If you do not have any questions, we will declare the program understood and stop the session. Anything interesting to note in the program? Any construct we have not seen so far or anything done differently or any particular why is he doing this somewhere? Quite interesting. Quite interesting, yes. You know these days of retail malls, buy one, get one free style. If you find one factor, you should get one factor free. If f is a factor, n by f is obviously another factor so there is no need to find it twice. Another wrinkle, which I do not know whether anybody noticed, you cannot run it all the way equal to n, it would be 2. Your devices will be from 2 to the half of that number. Not half, square root of that number. 2 to square root of that number. Because for every factor below the square root, there is a corresponding factor above the square root. So, if I can find all the factors below the square root, I have automatically found all the factors above. That is where most of the speed up comes. I cannot do equal to here because if it is a perfect square, the square root will get added twice. It is a small bug so you have to be a little careful. Because when you add the factors of a number for a perfect square, you do not say 16 has 1, 4, 4. You say 16 has 2 factors, 1, 4, that is all. 1, 2, 4, 8. You do not say 1, 2, 4, 4, 8. If you wrote equal to, you will end up adding 4 twice. So, that is the only bit of care you have to take. Otherwise the code is fairly straightforward. The other wrinkle is to ensure if a, b is reported, b, a should not be reported. That we ensure by checking. We got a number and we ensure the aliquot of that number is always greater than that number. So, we always report in ascending order. So, automatically the other pair will not be reported. And we are careful to find the aliquot of the other number after checking that so that we save that much of computation also. Every bit helps in order to get that 22 seconds. All right. That brings us to the end of what I wanted to talk about and share with you. Thanks a lot for putting up with so much of Python in so short a time. Do keep in touch. Ask us any time, any questions. If you have on Moodle till the end of the course and on the mailing list or you have asked, you know our mail IDs, I presume. Okay. Thanks a lot. Hope to see you soon on the next workshop.