 So, let me first introduce myself, my name is Kim Hau, and I'm not a TA, I'm not even a senior this year, but I have big kids on this course for the last two years. And he has a big day life coming this week, so I'll cover the reasons for him this week and next week. So, as you will see, today, there was me, this is actually the slides from last year, but this one is there. So, today we're going to talk about, we're going to review the midterms. So, I will first discuss a few points that you may want to focus on for the midterm. Specifically, the midterms we have covered so far in the entrance, and also give some tips. Because I have been writing the exam papers for this course for the last two years, so I have some experiences. I want to share with you and to kind of give you an idea of what we expect when we write the exam papers. So, hopefully this will help you to better prepare for the exams. And finally, the third part is that we'll try to answer any questions you may have about the exam questions for previous years, from 2014 to 2015. So, we have been discussing a few topics in the lectures. The first of them is the process-related topics. So, you have to understand what's the process abstraction in particular, which of these parts are abstraction of what. So, we use thread to model the CPU, and in the OS process one code, you will see a thread as an execution unit. And so, that thread is nothing but the executing piece of code. And we use the address space to provide abstraction of memory, and you will tend with this a lot in the semester. And also, we use file to provide abstraction for the disk. In particular, you need to understand this. So, the first report concept in the file abstraction in the file table, which we place, which is always allowed in SMB2. So, we have to understand the three levels of abstraction that file table provides. What are the three levels of abstraction? So, first we have at the very most effort level, we have the one. File of description, which is nothing but an integer. I'm going to say 456. Then, the second level of abstraction, we have the file handler. So, file handler basically encapsulates the information about this file, and where it is stored, and where it is stored in the disk, and how far we have to read or write, e.e. to resume the file. And the final level of abstraction is the blocks on the disk, that's been the payload concept in the OS161. So, you need to understand the abstractions in the file system, and you might want to review the file system in SMB2 to better understand the concept we have been covered in the lectures. So, this is the first topic about the process abstraction. And then, we talk about a few synchronization mechanisms. For this part, you need to understand what is our predict section for the very beginning. This is the whole reason why we talk about the synchronization in the first place. So, our predict section is basically a resource or a piece of code that can only be executed by one CPU at any moment. So, because of such a mutual access, we want to protect the access to this shared resource. My favorite example of this predict section would be shared critical. So, suppose you're printing a job and you're printing 15 pages, and then you don't want another computer to just come in and start printing. In this case, the printer is a shared resource and you want to protect the access to that shared resource. That's why we have a whole lot of primitives and methods for this synchronization part. So, we talk about four synchronization primitives and also you have a chance to access them in the assignment. So, for the most basic, you have the blocks to protect the shared resource. The speed log is provided to you in the OS 161 code and you ought to write the non-speed log. So, what's the difference between the speed log and non-speed log? Well, one spins and another slips when the resource is not available, right? Then we have the sum of all which is provided to you and you should have used about in the assignment. What is best in models are limited resource with limited quantity, right? So, the sum of all can be initialized as a counter and anybody who applies for this resource will only get a block when there are no resources available. Next, we have one of the four condition variables, right? Together with blocks, condition variables and you can use them to coordinate access to the shared resources. Finally, we have the winner and the right block, right? Which differentiates the access types to the critical resource. So, this is the four simulation primitives we have discussed. And finally, we have the lectures also covered the dialog and how to avoid the dialog. The dialog happens when models read or multiple entities try to access multiple resources and each of them hold part of the resource and want to gain access to other part of the resource. That's when the dialog happens. And I remember there are three or four conditions when the dialog can happen. If I remember correctly, it is four, right? So you need to know under which conditions that a dialog can happen. And these conditions give you a hint of how to break the dialogs, right? But if you break only one, at least among the conditions, you break the dialog. So this is the point in the synchronization part. And next, the lectures covers interruption handling, which is you also interact a lot in assignments. So basically, each CIS clause in the OS 161 is an interruption. And you need to kind of understand what happens when there is an interruption pattern, right? So the first thing to do is... So there is an interruption. Either it's an exception or an interruption. The first thing the CPU does is what? To kind of save the context of what was happening before the interruption so that we can resume the execution when the interruption was handled, right? And then there are various steps that the CPU takes to handle the interruption. And in assignment two, you will respond to write the large chunk of code that handles different types of interruption, right? Is the software interruption a CIS clause? And in assignment three, you actually need to handle another type of interruption, which is the running out of memory, the memory-related interruptions. So also, you need to kind of understand the concept of context switch. It's easier once you have a good idea of what the interruptions are than context switch is nothing but the interruption followed by another thread, scheduling another thread running on the CPU. And finally, Jeff talked about various kind of scheduling algorithms in a lecture. And this has been covered a lot in previous years' exams. I don't know if he will still cover this this year, but this is a very important concept to understand what other scheduling algorithms are there and what are their differences and what's their advantage and disadvantages. So far, since everybody has a good understanding of what I've talked about. So, see, the final part is the memory management, which you do not have a chance to exercise yet, but you will have your will in the next month. So remember at the very beginning, we talked about that. We used the evidence base to provide the abstraction of the memory. So for this topic, you need to understand a mostly important concept, I would say, is the concept of virtual addresses. You need to understand the difference between a virtual address and a physical address. So what is a virtual address? How is it different on these physical addresses? The virtual address is the address of the processes. The physical address is the address that it actually maps to. The physical address is actually the physical address into the round back, where this data is stored to. And the virtual address is an abstraction that is always provided to the processes. So in the processes, when you write code, you're always using the virtual address. And there is a whole virtual memory management system that is responsible to translate this virtual address to your physical address. And speaking of translation, there are different ways to kind of do such translation. So there are different styles to do the translation. In 86 systems, such translation was done by Halloware. And in one system, such translation is done by software, which you will be working on in Asylum 3. So virtual to physical address translation has also been covered a lot in previous exam. In particular, you have to understand the concept of page table and know even a virtual address, keeping a page table, how to translate this virtual address to the physical address. Or is that even a valid translation at all? So in the lectures, I think we have been mostly using the 4K page size. So in the exams, definitely change the page size to another number to kind of see whether or not you kind of understand the sense of the page table. And finally, we have the... So process memory range. Because the process contains the abstraction of the address space, and how we split the different segments in the address space and assign them to different purposes. We have code regions, which is continuous virtual address block. We also have data regions and so on. And finally, TLB. So first of all, you need to understand what TLB is. It's a translation bar to that basically contains the mapping from our virtual address to physical address. And you need to know what TLB is and how to... So because it's a buffer, and you need to understand why we use such a buffer. Well, whenever you use a buffer, you always want to... You can understand it as a cache. So whenever we use a cache, we always want to speed up the access and cache most often used data. So this is the part for the memory management. And I believe that's all the topics we cover so far as intellectuals. Am I using something? So next, you may wonder, before... So this is an example for previous years. I believe this year will be pretty much the same. So first, we have 10 multiple choices. Remember, the first one is always kind of a brand teaser. So just don't be knocked off by the first multiple choices. And then you have six short answer questions in total. You need to choose four out of the six. You have to choose whichever four. If you choose more than four, we'll run all of them and choose the four that have the highest scores. And finally, you have two answer questions available. You need to choose one from them. So before we continue to the exam tips, I want to kind of discuss how you should kind of prepare for the exams. So first of all, you want to go over the lecture slides that Jeff covered in the... Just skip over them and try to associate them with the coding experience you have in OSOS. You want to better understand the concepts. And then you want to take advantage of the previous exam papers. I believe Jeff has the meantime exam papers for 2015 and also 2014 online. You may want to download them and try... Also, the better thing is the solution is also online. So you have to know what you are expected to answer for those questions. So you want to take a really good look at the previous exam papers and go over the questions and try to see what if this is the question that we will show up in the exam and how would you answer them and compare your answers to the solutions and see what the differences are and what's the differences of how you choose to approach the problem. So that's some tips on how to prepare for the exams. And finally, for... from a gradient point of view and this is why I ask you to kind of go over the previous exams and know what to expect. So typically the questions are very well asked in the sense that at least for non-answers you have a whole big paragraph describing what's the background of the problem are and the final paragraph or final two paragraphs of that big block is you can tell you what you are expected to answer. So typically in the final paragraph you will see first, please do this and then do that and finally do this. So you want to kind of highlight those points and figure out what's the answers for each one of them. We have a lot of students in previous years that just ignore the last part and try to write whatever they want and they can imagine what will happen to them. Basically when we're ready we can understand what you are saying because the question is very clear on what the questions are and what the questions are. So you want to read the questions first of all and try to figure out what you are expected to answer. This is taken from the exam papers from 2014. You can see why I highlighted is what the questions are. So you have very clear instructions on what to answer. Don't mess them up. So this is the first thing I have and the second thing is that you will find in the exam that the space you have is probably more than what you need to answer the questions. So you have to decide what you want to write. You cannot just write whatever you need to know tuning papers, which is kind of a disaster for us writers to kind of find out which part you are actually answering the problem. So try to be concise and try to be brief in the answers, especially for the answer questions which you have several pages of space to write. So also you want to organize the answers according to what the questions ask. If the question asks three sub-questions you want to organize the sub-questions in a different part and highlight them to kind of help the writers figure out which questions you are going to answer and what you have wrote. Do not mess everything into a big paragraph and leave the various kind of squashes head to find out what you are trying to answer. And finally for the non-answer questions you really want to, so for midterm the time is only 15 to 15 minutes so that's your time. For finals you have three hours and you need to write about that but for midterms you only have 15 minutes so for the non-answer you need to at least reserve 15 or 10 minutes for that because it's a very big part of the total score. So you want to kind of, and I haven't seen this year's papers yet but one thing I can guarantee you is that it will not be something you have heard of it will be something new but the principles behind this new background will be something we have covered in the lectures. You can get a sense of what I talked about by looking at previous year's papers. So you want to kind of, don't be kind of, be stumbled when you see some terms that you don't understand you haven't seen before just try to read it and try to use the knowledge that you learned in the class to kind of link that strange examples or strange background to what you have learned. Again, as I have mentioned before there is usually a big, a separate paragraph to tell you what to answer, to tell you what to choose. You want to follow that and try to organize the answer around that final paragraph. So this is basically what I got for the midterm papers. For the rest of the time if you have any questions on the exam papers I can try to pull them up and try to explain them. Yeah. What's the difference between the PLB and the H? Well, what's your take on that? So if this is the question asked in the exam how would you answer it? I mean, I don't think that's actually one of the exam papers. No, I don't. Just kind of I want to know how would you like to answer the question. So page table, what is the page table? It's basically a way for you, you can consider this as a dictionary or key value store. The key is the virtual bits and the value is the physical bits. Just that this key value store is in a special in a particular manner. So page W is a local table for you to organize the translations between the virtual and physical addresses. And TRB is a very particular form of this. You cannot even call it a page table. It's just a translation between the virtual and physical pages. It has very limited functionality and it has very fixed format. Page table, you can design your own page tables. You can use all kinds of page tables in this very light. But the TRB is just this particular hardware component that is designed in a particular way to do the translation. Another way to think about this is that TRB is a hardware component that the hardware will use to do the translation when the hardware don't know how to find the physical page. But the page table in the concept of OS 1.6.1 the hardware does not realize the existence of page table at all. Page table is just for you to kind of help you do the virtual to physical translation. So we're not using the TRB OS 1.6.1? You are using the TRB. The TRB is a hardware component that will be there when I use it as the answer to the question. From a functionality perspective these two serve the same purpose. It's just to facilitate the translation between virtual to physical addresses. But they do use the translation in different ways. The TRB is a hardware component that provided the hardware to do the translation. Page table is designed by you to kind of maintain the translations in all of the way. So that whenever there is a need for such a translation you can always consult the page table to find the correct translation. So are you saying if the page table does the job why do we need a TRB? TRB is a cache. Why do we need a cache? So for the TRB does it need to enter the kernel moves? That's a good question. So at least in the case of OS 1.6.1 that's the case. It's a privileged component that only kernel moves. Yeah. And actually in fact in user space there is an existence of TRB. Only when you are implementing the memory subsystem you are responsible to manage the TRB. Otherwise when you write normal SQL in the user space you don't need to know about the idea. So do you want to use a thread with a kernel to check the TRB? And if there is a misted terminal to trigger another transaction? No, like I said so when you write a program you just manage access to memory. You don't need to worry about whether or not this virtual address has a very physical transaction. Whenever you access a virtual address that does not have a valid transaction you will trap into a kernel. The rest is the responsibility of the kernel. In particular the memory subsystem. And the virtual memory subsystem is responsible to advocate for the set of the TRB entry so you can continue your execution. Then we can test this state. So you guys are going to have to go back to check the exact papers and here we go.