So here we are in project 12, the last and final project in Nand to Tetris, in which we are going to build our operating system from the ground up. Here is the operating system in all its glory, consisting of eight different classes. Each designed to service some other functionality like memory management, screen management, keyboard management and so on. And I wish to remind you that at least in this form of description, the operating system is nothing more than an obstruction. It is basically a set of APIs that describe what the operating system can do for you, or for other application programmers. For example, let us sample one class from this set of eight classes, Screen. And take a look at this class description. Basically, what we'll see is a set of subroutine signatures each describing how to use it for its effect, and this documentation is aimed at application developers. So an application developer can write some code, in any class that he or she desires, and this code can use the services of the screen or it's class. It can draw lines, and rectangles, and circles, and whatnot. Now, if this were an introduction to computer science course or many other courses in computer science, then we would've been contained with this level of description. The API of the operating system, because we view the OS from a user's perspective. But in nand2tetris, we don't take anything for granted. And so, we are going to actually build and realize this operating system from scratch. And in particular, in nand2tetris, we're going to find three different implementations of the same OS abstraction. First of all, the supplied VM emulator, which is a fancy Java program that we wrote, several years ago, well this VM emulator also has a built in Java based implementation of the Jack operating system. So when you execute the program in the VM emulator, if you find the call to let's say memory.aloc with VM emulator, knows how to service it using Java. Also, we provide a completely different implementation of the Jack OS. In this folder here, which is now on your computer, because it's part of the nand2tetris software suite, that you have downloaded at the beginning of the course. Basically it's a set of eight VM files, which are the compiled version of the operating system that we wrote also using the Jack language. And in project 12, you're going to do exactly the same thing. You're going to write these eight OS classes in Jack yourself. And after you compile them, you will get your own set of eight VM files. Which presumably will deliver the same functionality as our VM OS classes. They will not necessarily be the same code that hopefully, they will have the same behavior, because they implement the same or they seek to implement the same API. Now before we go on, I'd like to say a few words about reverse engineering, which is an important technique in the software developer's tool box. So let's assume, that we want to implement some existing operating system. And let us assume further that the operating system, naturally consists of several executable modules. These modules are stand-alone classes, for example, in some language like Java or C++. They are executable so you don't have the source code. And they also interact with each other intensively. As often happens in complex program like an operating system. How would you go about writing this software from scratch? After all, you don't have the source code you have only, the executables. For each module in the OS you can focus on this module only, develop the source code of this module separately. And use the remaining n-1 executable modules to support it. So if your module will call a method in some other executable model for it's effect. The executable module will be there to service the call. So that's a very nice and elegant development strategy and if you just follow it step by step, then after end stages you will end up developing the whole operating system yourself. By the way, this is exactly how systems like, Gnu Unix and Linux were developed. The developers of these systems started from an existing executable well-known operating system, Unix and they went on to develop their own versions using reverse engineering, using precisely the same technique that we're using here. So going back to nand2tetris, let us assume that we want to develop the Screen class, which is one of the eight OS classes, and test it using some supplied test code. Which we call Main.jack. How should we go about doing it? Well, the development strategy is going to be surprisingly simple. What we suggest that you do, is that you take the screen Jack file that you want to develop and the supply the Main.jack, and put them in some directory on your PC. Then you can go on and compile the directory using the Jack compiler. Now, what you will get is a set of VM classes or two VM classes, screen.vm and main.vm that you can now go on to execute. How will you execute it? Well, we will simply execute the directory in the VM emulator. Now, think about it. The VM emulator has a built-in implementation of the operating system. But, if it finds a user implementation of any VM function including, let's say draw rectangle or draw line. Function that you have written in Jack and compiled and transformed into VM functions, then the VM emulator is going to use your implementation. Instead of the built-in implementation. So what you get is exactly the ideal setting for reverse engineering. Now the VM emulator will first of all execute your code, including your own implementations of the OS subroutines. And all the other OS subroutines which maybe called in the process will be serviced, using the built in OS version. So that's how we're going to do it for every class in the OS. So let's go on and continue with this example of the Screen class, because it would serve as an example of how to do all the other classes in the operating system. Well, this file is going to be supply to you by us. It is part of the nand2tetris software package, it's part of project 12, and the I call this file, Stub File. And I use this term and you know its not a term that I invented, it's a well-known term in a software engineering. Basically, it's a skeleton of a class that contains the signatures of all the subroutines of interest in this class. And notice that these subroutines include also the non-public subroutines, that application programmers don't get to see. In other words, this file was delivered to you by the system architect who said, go on and implement every sub routine that you see here. Including for example, init which is a sub routine that the application program has don't get to seek. Now how should you go about implementing this class, well we discussed it in several units in this module. Say you just go back, you re-read if necessary the relevant units in a module six, if you want you can consult the chapter 12 in the book. And then just go on and implement every one of these methods using the Jack language. So that's how you'll develop the Screen class. What about testing it? Well, we're going to supply a test file. And the name of this test file is going to be main.jack. And as you see, the test file calls all sorts of methods. In the Screen class. And if you will run this directory on the VM emulator. Then, here is what you get to see. Some simple picture, which is designed to demonstrate that your Screen class is well behaving. So we are going to provide the stub file and the test file. And it's your job to implement the stub file and bring it through a level, that it can service the test file to your and our satisfaction. Now that's what we have to do with every one of the eight classes in the operating system. So five of these classes are going to be designed in exactly the same technique, using a supplied stub file in the supplied Main.jack. And the remaining three classes will be tested slightly differently using both jack tst and compare files. And all the details are in the project page in the nand2tetris website, so I don't want to belabor on it because you can just go on and read it yourself. Now, any one of these classes can be developed in any order that you fancy, because you can always use the remaining seven classes to support it by default, if you use our VM emulator. And once you are done with these eight classes, we request that you do a final test. And the final test will be to test the operating system that you developed in the context of a Pong application. And if you read the steps here, they will tell you exactly how to do it. So this will be the final test and once it passes this test, we can say that your operating system is, well, it's not fully tested, obviously. But it's sufficiently tested to ascertain, that you have completed project 12 to our satisfaction. So that's it, and in the next unit we'll go on to talk about some perspective on operating systems.