Times have changed and these are the top eight most profitable items during this whole pandemic and I'm gonna cover it with you so then that way you can take advantage of it. Make sure you guys keep watching. Hey friends my name is Wilson your friend in helping you build a profitable restaurant. Just want to give a major shout out to these two individuals for their positivity for the love and support. If you guys want to get featured make sure you guys leave us a comment in the comment section below so then that way we can show you some love in return. Now without further ado let's dive right in. I'm super excited to shoot this video for you because Jason and I have done the research in finding out what is the most profitable food idea for your next venture or if you already have a restaurant then this is something that is a must-have. How did we come up with this data? DoorDash, Grubhub and all the different delivery app platforms have conducted studies on what is their most ordered item throughout this whole pandemic and if you can have that in your menu then that means that you can ride the wave in having this influx of demand and that's the reason why we created this video for you. So if you want to make some money then definitely keep watching. Number one most profitable food idea is burger. Burger is an American staple, it is comfort food, it travels well and that's the reason why it is so popular. According to DoorDash it is the number one item that people ordered throughout the whole platform burgers and fries. Grubhub is saying that their spicy chicken sandwich sells more than 353% and plant-based burgers and cheeseburgers they're all up 150% in demand and in orders. What does that mean? It means a lot of people are ordering burgers so if you want to ride the wave definitely include burger whether it is in your cloud kitchen or include it in your restaurant concept already. This is a money making food item. Next up is mac and cheese one of my favorite item it is nostalgic it is simple to make and it is delicious it is comfort food and it is hearty. According to DoorDash this is the second most in-demand item that people are ordering. However when we're talking about mac and cheese you must be aware of the characteristics of this item and if you were to serve it make sure that it is not clumpy and it is not dry and it also delivers a great experience. At the end of the day it is all about the customer experience the better the customer experience the more they're going to be able to order from you again and again. Third item is tacos. Tacos Tuesday everyone loves taco although it could be a mess during delivery I would highly recommend you to work on the packaging aspect so then that way your tackle does not fall apart it is also very very great item for delivery margins are great on these guys and the demand has skyrocketed. We're talking about more than 900% on a shrimp taco and more than a thousand five hundred percent for a chicken taco. These are crazy numbers if we're talking about let's say selling one taco we're talking about selling a hundred and fifty tacos right now that the demand has increased and it has skyrocketed and if you're not on this wave definitely be on this wave. Next up is a DIY pizza kit what is a DIY pizza kit and why is it popular it is because people are bored at home they're they're they're enough they don't want to be able to go out and buy groceries they just want to buy a meal kit have all the ingredients there and they just need to put it together put it in an oven and it's good to go. Pizza is an all-time favorite people love pizza I love pizza you love pizza and that's the reason why you should definitely consider not just selling and serving pizza but offering a DIY kit according to DoorDash DIY kits is going to be skyrocketing in demand and it has already seen a tremendous amount of demand for DIY kits and on top of that it is super easy for you as a restaurant to produce all you have to do is put all the ingredients in a box and it's good to go that's the reason why if you're not on this idea you should definitely be on it right now. As a bonus note that Jason has brought up you can actually consider this and be a little bit more creative you don't need to just offer DIY kits for pizza you can offer DIY kits for pasta sushi tacos the list goes on and on at the end of the day it's about the experience customer experience is what we are going for if you make them and if you allow them to have this experience they'll attach this experience with your brand and when they do that then you're in a very good place to be able to capitalize on this trend. Believe it or not the next item is iced coffee yes you can go down the street go to your favorite coffee shop to order iced coffee but surprisingly people love ordering iced coffee as a delivery item. DoorDash saw an increase in more than a thousand percent for their iced coffee item which is blows my mind however having this item having beverages within your your your arsenal within your menu is a really great way for you to be able to marginalize on this wave people just love it a lot it is something that everyone drinks on a daily basis and once again you don't need to limit it to just iced coffee you can have different items for beverage and beverages are great for traveling when you have a sealer to seal the top or if you're wanting to have different items beverages have high margins and that's the reason why it's a great add-on for your menu item to make you more profitable. Number six is sushi. Sushi is by far my favorite food item yes I know I eat a lot of food and I have a lot of favorite foods but no for real sushi is definitely my favorite food and if you're a restaurant definitely jump on to this trend or if you're thinking about starting a food item sushi is the way to go why is that the case it is because it travels tremendously well okay like sushi it just sticks in the box and it doesn't move around presentation is there and on top of that if you have a high demand and high volume you can actually prepare everything in advance maybe in the morning time and you can just put in the fridge and when people order during the lunchtime you can just take it out put in the box and boom it's good to travel travels well allows you to prep well and that's reason why I love sushi either as a consumer or as an operator and on top of that it is one of the top food items ordered on DoorDash top 10 they sit at six and ninth spot California roll and spicy tuna such a good item and on top of that people love sushi more than 30% of the respondents for the DoorDash survey says that they miss sushi they want to order sushi because sushi is not something that you can make readily at home it is difficult to make if you don't have to trade and it is something that just everybody loves so definitely this is a great item for your menu next up is cupcakes okay you know what this one really caught me by surprise I never really thought cupcakes would be in my top eight but it is according to studies from DoorDash and Grubhub yet when I'm thinking about delivery of cupcakes I most likely am worried because when I receive my goods or if I'm the one that's serving it like if what if the driver took a sharp turn and all the cupcakes tumble over it's just not going to be a good experience but hey you know what people order it and which is the reason why I'm sharing with you and covering it for you according to Grubhub cupcakes demand and sales went up by more than 200% I understand why people want comfort food people want sugary food and people just want that moist gooey goodness in their mouth and that's why it is really really good and on that note dessert trends are going and skyrocketing up the roof as well according to DoorDash cheesecakes and muffins are going up in demand by more than 500% and the reason why I'm sharing these statistics with you is because I'm not only here to convince you about these items I'm there to support it with facts so you know that these items are good to go so definitely if you have a sweet tooth considering dessert for your next meal item and lastly pasta is our winning item and if you haven't checked out my top five most profitable food item check it out here we talk about pasta pasta is always on the list because it is high in margins low in skill set to make and overall it is just a great hearty foodie comfort item according to DoorDash Cajun shrimp pasta has gone up in demand by more than 164% and that's a lot of pastas that people are serving and that's the reason why that you should consider it and we also talked about DIY kits you can pasta is a great idea for DIY kit so if you don't want to cook the pasta and serve your customers then you can also consider having your pasta and a meal kit that you can put on these apps to sell so there you go the eight most profitable items through the COVID-19 if you have a restaurant or you're thinking about opening up a restaurant consider these items all in all the pattern that we see is that comfort food does well and shareable plates does very well as well and because people are just not they just don't care about health as much we see a huge decline in people ordering healthy food because I guess when you're at home when you're snuggled in all the discipline just goes out the door you just want to be able to enjoy a delicious plate of food really hope you enjoyed this video because I had a ton of fun shooting it for you guys we have a ton of fun creating this for you guys so make sure you guys support us by liking this video and leaving us a comment in the comment section below otherwise I'll see you guys in the next video


And we're back! I apologize why every site 42 critique lab ends up in a two-parter because the site crashes But let's pull up the chat on the new video and continue our dive into What it means to be human man Chat is up. Here we are. So what was I saying before that lagged out and crashed? We need a balance of Enough story and being told Pardon shown slash told slow shown, you know show not tell but We need the story to be pushed through More because there are assumptions that people don't see at all or wait too long to be caught 05 9 being at fault for this Comes in way too late Right now it doesn't tell us that we sent Jesse to the wrong dimension. It's just glazed over so small that it's easy to miss and With so much stuff We just need extra We need we need more context and we need it. We do need to shorten it a little bit Because people are cross-eyeing so actually, I Don't know if Yes, we're final reference Jesse meant at least what I would do is Jesse Mantell Slug with an 05 9 ethics committee note Honestly, I feel like Dr. Blank's note that we're not relegating him to the gallows Isn't too important in a version that doesn't have the you Like it's kind of something where we try and humanize If I race to see me when Jesse gets wrecked people assume 05 9 is Jesse or ask why Jesse gets the powers instead hmm interesting and for context this this is the sixth version of this skip and It's been up on the site in two different iterations and come back down due to downvotes. So this is this is an uphill battle. We're fighting and Okay, so here's another thing. I don't actually know what happens to 05 9 It's never Okay self-deletion not downvotes but I don't know what happened to 05 9 at all It never mentions him again He's it doesn't say he got deleted from history. It doesn't say that they did something with him He just So that's that's something I annoyed with. I don't know if he got his come off. It's or anything cease up The chat mentioned is he reality bent it away? No unconfirmed is a guy who gets reality bent it away but It never mentions 05 9. So he's in prison, but cannot be killed due to 9 6 3 dash 2 We need to know that There's a lot of stuff. We don't need to know and there's stuff. We do need to know Where 05 9 went we need to know We need to know that Jesse went in to the wrong universe and why Because that's the that's a very interesting thing. That's not mentioned at all Even to the point where it's hard to tell that he went to the wrong universe In the Delta Corbin article part as it is this is gonna have a hell of a lot of cross links in it to get some points across Like how can we get one point that's going on in the chat right now is That I still don't know what 9 6 3 dash 2 is read 9 6 3 then We don't really need That's in this article at least Because this has nothing to do with that particular piece. That's just a background history of 05 9 So thankfully that's not something Because remember you want every SCP to be understood without looking like anything else Or looking at anything else. You want your story to stand on its own So the question is does this stand without having to look at any other articles? mostly There are a lot of things that are enhanced by knowing though and those things Yeah, like of course not So yes, we need to trim this We need to Yeah, this You can tell a story including other Articles But it has to live on its own the author says in the chat, but it's series four and series four is Not does not excuse that that is I Cannot think of a lot of articles that don't stand on their own There might be an article that requires another article but I Don't even think that's the case Because the goal of the story is you have to be able To explain it within the current skip, even if another skip is part of it SCP-3143 Tells you everything you need to know about Murphy law Without you having to read SCP-3043 You don't need to read 3043 to Read 3143 So if 3143 is the first thing you read Yes, it's a little pathophysical and hard. It's hard in that sense But it does not seem But it does not need the other ones your article has to stand on its own. I'm pretty sure At least mostly sure that you can't give me an article on the wiki That omits information that you need to read another SCP to understand That's a Problem in the writing that's not you can't rely on the other articles to carry weight for you just like that's a that is a less common Form of cross-linking problem because the cross-linking problem. We all know is linking to a popular article To make your scene better Just kind of leaching off the popularity of an already good article. You don't do that and You don't link to another article to rely on its strength Or you don't really just link to a series one article But that's more of a guideline than a rule linking to a later articles better because we don't do it as much So those are the three sins of cross-linking I can think about relying on popularity relying on for knowledge or Doing series one's kind of iffy So you need to rely on your own story. You can't use another story to tell your story The techno babble's fine as long as the story inside is fleshed out you need to find a way to get Jesse Mantel to Just God So much there's so much going on here The author states less relying on it for info more on it because these characters have already been fleshed out And it would be redundant of me to add the info already stated elsewhere That is not true That is a bad call in this case in all cases You have to give a minimal amount You need to tell the audience what they need to know for your story to work like 059 has a long history so They don't need to know his whole history But they need to know that he has a thirst for immortality That is the thing they need to know in this story to understand it So if you don't tell them he has a thirst for immortality Then they won't know why he's doing any of this It's cool that in every story. He's in he is looking for reality The author points out yes, it's indicated in the interview yes, but We all that info that interview is just after the fact long info dump What happened is at least as far as I can tell is you had a skip and People didn't understand it. So you tacked on an interview explaining it and Instead what should have happened is you should have sparse to this information little by little throughout the skip That way the story is told during Rather than just here's a long thing. I don't understand and here's what actually happened You want this to be understandable? That's the important part So that interview was a bad idea in this case this position interview that just says everything above Should just be facts that we got throughout the skip Uh The author says but I really like the interview and want to keep it because it goes into the dilemma of inevitable destruction You can go into that dilemma Somewhere in the original Is it would be better for you to have that giant exposition dump Get rid of Harding all together in the interview have the ethics committee Talked to 059 himself and bought bug him Uh, we have another scp where the o fives argue with the ethics committee and the ethics committee stages a coup and Takes over becomes the new o fives like you can use the o fives for this kind of purpose Or if you want it coming from someone else, I still think it should be way shorter and Put in somewhere Like even a much shorter interview linked to an ethics committee notes Next to the generator itself Would be better because then at least your hap your explanation happens during the story and not at the end Because a story that makes us scratch our heads and have a headache and then dumps all the information at the end That's just bad story structure because there are good themes the theme of 059 doing what he's doing for a selfish purpose or an altruistic purpose is interesting the idea of an outside observer Harding Trying to guess his of purposes and hedging his bets on the good because of a nihilistic outlook that everything's gonna end anyways is interesting The researchers trying to save Jesse could be interesting But we don't have enough of him right now It's a lot of people talking about Jesse Rather than us really meeting the character in dealing with his plight. So Jesse Mantell He says what four lines in the story that's half about him in the incident log researcher Mantell one two two lines Mantell has Two lines and then two lines after the translation. He has four lines of dialogue One of our two main characters are subject Jesse is iconic by the time he gets shipped as a result of his condition says the author Show me that that sounds awesome. So there's a concept in story writing that says if this is a Lot of people like do flashbacks or like they'll say hey remember that Uganda incident in 1973 and the thought is If that is more interesting than what we're seeing show us that and The author says it's in the document. I sent you on discord and what I'm saying is it should be in this document somewhere Because him getting turned into an X-man isn't interesting Him going insane and reality-bending and forcing them to send him away and being sent to a wrong place where they blow up an entire galaxy by accident be they populated galaxy that is Super interesting That is the story your skip needs to be telling and right now it isn't so All right, he is saying I think it would be prudent that you see it as it looks like it's definitely making it into the final draft Let's go in. I'm open in discord I can't see the YouTube chat because I got discord open. What's going on? New mentions, but in general Google doc All right characters Jesse Jerry Messer It's like three three names of the same guy Jesse plus Jerry equals Messer. I Hear them you hear what Jesse the most important ones and why are they important sir readings are striking dramatically I'm trying to calm him down. They want to take me Jesse. I you need to stay here. Do not go with whoever you hear He turns to the microphone. He's delusional. We can't keep him much longer. No, don't do it Please we're always having a breakthrough. It's going to have to happen. He's going to be critical soon readings are reaching Reachings are reaching readings are reaching critical condition. No, we have it. We almost have it We were so close to planning a cure. We simply need the proper dosage values of that They just want to help they don't need to come with them man. Tell snap out of it. Jesse. Jesse. It's okay, Jerry I'm going I'm going to see them engaging me our sake. Please insert and turn your safety keys The psychologist is both an investor about to insert the key and turn it.  He'll stabilize. I'm not doing it unless it's truly necessary Turn the key now Jerry turns the key initiating the slowly moving track hooked to three revised restraints through his clients The only sound being the whooshing of the portal and the motors in the back wheels where I'm already stabilizing I don't know what's causing it. It's the excess reality. It's like the portal. We must get him out No, we don't know if it'll work abort Okay, so Still not the most interesting part though, I'm glad we're gonna have a conversation about this document because we're gonna Talk about this now that interview is 9% two guys arguing over whether they are going to save Jesse and Or whether they're gonna shoot him away Jesse is mumbling about others. I Don't know who those others are. I can't tell from the text I have no clue. I don't know if they're important and by the way, I'm back in the YouTube chat now So hi YouTube chat Brad Barman. I have no idea what's going on right now. That's fine. Jack. He's just crazy. Okay, so he's just crazy He's lost his brain but In this case Number one just off tangent. He's just crazy is never as fun as if there's a different meeting So if there is something cool, we can slide in there that's like a sly reference or a callback to something or if he is going psychotic, maybe he's going back to the day of the Incident and he's reliving the incident and Like he's trying to fix the court the crystal that broke or something but it should be more than just jibbering about nothing There should be more to that crazy Slash vision slash whatever it could be or isn't there should be more to it than just meaningless stuff That's just more literacy interesting Literacy interesting That's not a thing you say Okay, second most of this is on the ethical dilemma of Getting rid of him or keeping him But at no point during this does his reality-bending misfire except for the portal in the very last second What if he uh he was What if like as I said earlier what if a dog turned it what if a table turned into a dog? What if things were happening and they're like, oh my god, this is getting really really crazy We better do something my clipboard has turned into Sandstone and it's really heavy and my pen is now has word Things that like show reality is bending despite the safety precautions Because he is the most powerful reality-mender that's ever been That's what happened in the recovery log in the recovery log really incident report do you mean the incident reports? because Only the only thing that happens in that incident report is his arm goes through a desk like That's I don't think that's enough Like does an explosion something exploded he wipes a dude and becomes intangible Like and I don't even know why he wipes a dude. That's a thing. Why did he wipe that dude? Did that dude do something to him? Is that Christensen? Is that did he deserve to go? Does he know something now? Like he just it's accidental he randomly went but it's accidental to Mantell But it has to have a reason in the inner workings of the story Like is this guy a guy? He didn't look and that's why when he heard his voice it annoyed him And so he got rid of him Like I hate that guy. I wish he wasn't here poof It's not enough for it just to be a random occurrence. That's the thing insanity shouldn't just be random George drool as a character only existed to be wiped and that's not a good character and You you don't want a bad character. You don't want someone who just exists to get wiped and then disappears you want You should have his backstory in your head You should know who he is you should know why he exists as a character Besides just getting wiped you should know his relationship to him because him like earlier in the thing in a random dialogue saying I never liked that guy And now he doesn't exist. That's kind of interesting. There's all sorts of you've got the bare bones of what? you've got a whole lot of what but you don't have why and Why is the most important question because why is the reason we care? Right now a bunch of stuff happens but We all either don't get it or don't care and We will care to if we care we will fight through techno babble to get it But if we don't care, we just kind of shake our heads and go that was what was that? So you need to go in and you need to think about these things because no part of a story exists just to exist there should be Frickin Every character should have a meaning and a purpose and every character has wants. This is why they exist This is where their relationship to everyone else you write out outlines and character maps. This is this person he exists It'd be interesting There were like blank places where he didn't exist or was like white from history. I don't know. I'm just there's so much There is so much here Courts point out there is no why it's a reality bender aka Meaning has no meaning anything can happen. That is false That is false Because reality has meaning based on what the reality bender says based on what they want SCP 3999 is a reality bender and it has a want It wants to write a story or In universe it wants to torture Taloram it wants to do both It mainly wants to write a story and it's kind of torturing Taloram by accident except at some points It's doing it on purpose But it has the meaning is in the reality bender's meaning So when something is white from existence, it has to have meaning to the reality bender Courts says 3999 is a perfect example of my point and I say 3999 is the opposite of your point Reality bending The most important thing is the bender what they do and why Nothing happens without a reason even a reality bender bends reality for a reason I don't remember the number of the series one little girl reality bender But if she bended reality by accident, it was because she thought something So when she thought Santa Claus was real it spawned a Santa Claus That's the kind of thing if she thought if she decided she wanted something it happened If she decided something was real that thing existed it was linked to her Nothing just happened without a thought It always had a purpose 3999 has a purpose and if you don't know what the 3999 purpose is Then If you don't know what the 3999 purpose is I actually made a video Talking all about it's a 10-minute explainer on 3999 Go check that out because it'll get you I don't make more sense now going back to the author for a second I feel Mantell stretches his arm out to drool and helps him to stabilize Physically not reality wise and blew him out of reality So that's so you're saying he basically iron-banned him out of reality Like he threw up his arm and a wave of reality knocked him out I Think if he was using This guy to stabilize him I Think all of the sudden That guy would all of the sudden become a fixed point in time and immovable he is so stable that he reaches out and touches him and now that guy can't move or Change ever again He is a fixed point in time because the reality bender Needed to be able to stabilize himself That is what a reality bender accidentally does when they try to stable himself and they don't understand their power That was a cool idea I like that I feel I feel happy about that. All right So yes, that is the kind of thing you think of you think of why something is happening or you think of what you want to happen you want or what the character has and Then you go extrapolate from why it's a I Just watched a great series. So for all of you writers, we're now getting like way off topic So I'm gonna end this with a quick summary of everything. I think before we chat in the chat a little more for funsies and that is basically This skip we're worried about the story structure and we're worried about why We're worried about the length a little bit and we're worried about making sure that the audience knows what's going on Not through assumption, but through showing More showing less telling show us what happens document what happens SCP documents are weird because a lot of it has to be tell instead of show Because that's why oh my god. I'm about to get off on such a tangent, but I need to finish the sentence So You need to make sure the document speaks for itself No other document can help it can elaborate on other things outside of this document, but this document needs to stand alone Probably needs to be shorter Make the explanation fit into the actual documents rather than being an ending interview Even if you got to put parts of the interview in there All right, cool. So the author is leaving We're gonna talk shop a little while longer, but thanks for the draft learn something about this skip I think everyone learned something about writing and critiquing and I can't wait to see a rewrite of this that gets To being site ready What tangent was good I got to go on Now that the skip is done courts. I want to make something about spooky-j making his own gaming channel and making it an ARG I'm just saying I would Die to do a spooky-j gaming channel. That would be really funny Just as let's plays as spooky-j. That would be hilarious but if you want to learn more about writing and about How to do stories the way I do and I'm gonna send this link to Jack since he has to get off if he doesn't see it But look up a channel called Night Mind Night Mind run by a guy named Nick Nocturne is a brilliant channel that looks down different Da-da-da it looks over different horror things and it explains The stories and it shows the clues that you should have seen while watching marble hornets tribe 12 PetScop all these different online web series and it goes into the depths of the writing and it goes into the kind of things where if you study this You become a better writer Because you're studying and I'm a college dropout. I've written one SCP article. I'm not hugely qualified to go into writing I'm just trying to help out but I go to every source I can who does these Explanations and I take in what they do. I listen to critics. I listen to Game theory does some good stuff. Sometimes Nightmare Masterclass is a newer channel that kind of does what Night Mind is So if you like Night Mind Nightmare Masterclass is also amazing in the same thing but going back to Night Mind he has a series called how to make a web series and It teaches you how to make a YouTube series or an ARG or stuff like that where you're writing fiction Watch it all. It gives you like several tracks to go down Watch it all if you want to write stories watch that entire series because he teaches you all about how good stories are made And if you want to be good at the SCP you need to know how good stories are made by itself then you can make good SCPs and Finally The one thing that I'm gonna give you from that class on Night Mind's channel How to make a web series on Night Mind go check it out is twisting and he talks about this in a couple of the tracks, but twisting is what I just did to Jack's idea. It's the idea of taking something you see and then extrapolating Saying what would happen if this happened from here? in this case we wanted him to accidentally He wanted to him to reach out to somebody to stabilize himself, but instead blow that person out of existence That doesn't make sense in the mind of the reality bender. So what would happen if a reality bender who didn't know his powers Thought I need to stabilize myself Let me put my hand on you to stabilize myself. What would that do to a person? They would become the most stable object in the planet ever they would be immovable fixed point in time Can't be moved. They are now a statue That's the kind of thing an out-of-power reality bender would do by accident Because they didn't know their powers, but they wanted to be stabilized themselves. So that kind of What would happen if this scenario is what's missing from a lot of things? So that's why that's why bad stories get made. That's why Stories where you don't care about it gets made because the logical leap isn't there You want a starting point and you want to go from there as to why this happens and the great thing about that is when you write a story From a point and you keep twisting all of the sudden number one your entire story always makes sense and number two You get in really interesting directions that no one's ever gone before because you're not thinking of this is what I want to happen You're thinking what would happen if this happened? What would happen if that happened? Most TV shows aren't written all the way start to finish They start at a point and every episode they twist from there to the next story That's why every show that does that goes in wildly different directions Okay, I had a headache from the article and And I just cackled because I was about to sign off but the author Jack is still here Go check out Night Mind series read it all listen to it all But I actually changed my mind the voices that are talking to Jesse are Successful articles and they want that they want him to join them That is ridiculous that is Comically ridiculous and it's so out there And as a concept I find it hilarious and ridiculous and I love it The only thing is I don't think it'll fit in the serious tone of everything else. You're doing because that is meta Whereas everything else is reality-bending and while 3999 is meta about Okay, so Jack you say you won't say it, but it's my author again. Okay, so you're not like gonna change it. All right Or you might change something but interesting Because yeah, there's the witch girl who bends reality, but it's still constrained to the story and Then there's 3999 which you might say is meta because it messes with the format But it actually doesn't mess with the meta of the site It doesn't make it doesn't do anything pedophysical 3999 doesn't Okay, it does comment on it being a story when the author talks to us and tells us what the story is about So yes, sometimes reality-bending can go so far as to go into meta Reality-bending and meta are separate, but they can come together So you just need to blend those things well. I'm not sure how that's gonna go I can't wait to see how it turns out. Maybe it'll be amazing Maybe it won't be but just keep thinking of why This is what this is where I'm starting What happens and does that make sense? And if you can grow that web? I think this story might be better So with that, I want to thank you guys for tuning into the site 42 critique lab I hope this helped you guys. I hope you guys enjoyed the show. I hope you guys had enjoyed hanging out with me I'm gonna if you want to submit your draft because I don't have a draft for next week right now You can submit your please be it like mostly finished that way We're not like just doing spelling grammar spelling grammar submit it to scp site 42 at gmail.com You can submit your draft and we'll go over it next week Beyond that If you like the channel if you like what we're doing do all those YouTube things like liking sharing subscribing paid for tree awning Keep an eye on the merch store guys because I just got some things and They're not up yet at this exact minute But by the end of the day, there's gonna be some new merch and I think you're gonna like it I got some I've been talking some artists. We got some things going on. It's gonna be hip. It's gonna be cool It's gonna be rad. So yeah, that's that. Thank you guys. See you next time foundation staff Poke you in the face until the phone responds


That was not a bad song. Thanks to whoever recommended that. I'd say the person who recommends the song that I like the most gets 1.1 extra credit points. So far he's in the lead. OK, so what are we going to do today? So today we're going to pick up where we left off last time. So last time, we had talked about multiple ways to translate. So we've created this problem for us, which is that we have to be able to efficiently translate virtual addresses that are going to be used by applications into physical addresses that actually address memory.  But there are a couple of problems that come along with this. And we're talking about one of them, which is how do we efficiently perform that translation. And so today we're going to introduce you to the modern way of doing this, which is to use something called pages. And then we'll work on Friday. We'll talk more about pages and some of the things we can do with where pages go and things like this. OK, so Simon2 is doing Friday. So do with Simon2. I can see people have been cutting their hair to prepare for Simon2 to be done. That's one of the things I consider to be one of my capabilities to sit. For some reason, I'm very good at detecting when people have cut their hair. I don't know why. Men only. When we get the haircut, it's like they get a little bit here and there. And it's very hard to tell. Men, I don't know. I don't know why. I'm good at that. Anyway, maybe I'll find a way to monetize that ability someday. Maybe I'll start a game show or something. OK, so the midterm this year will be, so when we get back, you can think of that as being midterm week. So you come back from spring break. On Monday, we will do review during class. On Wednesday, we will have the midterm. And on Friday, we will go over the midterm solution. If the calendar doesn't say so, then I'll fix the calendar after class. But that's how it works. So you sort of pause. You guys go to week off from working on the assignments, focus on the midterm. And then on Friday, we will.  But by Friday, after spring break, Scott will have finished all the work on the assignment three targets and adding to the description and things like that. And you guys can go, OK, you can already start on assignment three. It's already up there. The write up is very short, actually. And then, yeah, so after class, on Friday, we're trying to bring in as many people for office hours on Friday as possible. So we'll try to get as many of the ninjas and the TAs and everyone else who's involved, who's available to help you guys out on Friday. And then after class, on Friday, we'll sort of try to fix any of the last minute bugs. So we're working on trying to incentivize you guys, particularly on assignment three. We're working on a new leaderboard feature for the website. This is something we'll probably release in the next few days. So we'll put up instructions. But essentially, this gives you a way to kind of brag about your performance on the assignments to people, people who might want to hire you, people who might care. We're going to put up for assignment three some performance targets where we run some performance tests on various parts of your submissions and have those numbers up there. Maybe we'll have some extra credit if you can beat the assignment three solution which is not that hard, I don't think. And this is all opt in. So by default, your submissions are anonymous. If you want to share your information with people who might stumble by and look at this, I will certainly send a link out to this to some people I know who might be interested in people who can do well in this class. So anyway, so that's coming. We'll tell you more about that. Oh, and just let me make a, I've had a couple of questions for people who are asking various types permutations of why did test 161 not work the same way that it worked when I ran sys161. So test 161 doesn't do anything mysterious. It is, you can think of it as running sys161 internally and typing characters into it. That's pretty much all it's doing. So it doesn't run your kernel in any special way. The differences are usually created by the fact that it will configure the sys161 simulator differently. So if your kernel works fine when you use it and when test 161 tries to run it to dust and boot, look at the configuration that test 161 is using. I think Scott's adding a feature so you can print this out. It's part of inspecting the output of various tests and configure the kernel the same way if you want to reproduce the same results. OK, yeah, so I hope you guys are figuring this out. When I taught this class at Harvard, the course staff said that every year, either one of two things happened. Either people crashed and burned on assignment 2 or assignment 3. I can't quite figure out what's going on this year. We'll see. But yeah, these are hard assignments. And this is just assignment 2. So when we get back, you guys will have like a month, like six weeks to work on assignment 3. And assignment 3 is worth twice as many points as assignment 2. OK, so let's go back to address translation. So remember, we had created this level of indirection that allows us to really play lots of games with memory, with what processes think is memory. It allows us to support this address space abstraction, which we really like some of the features of. But the problem is that it's potentially inefficient if the kernel has to be involved a lot. And so the goal here was to make sure that the kernel is not involved a lot. Most address translation should be able to proceed without the kernel's participation or interference, because if the kernel gets involved, it's too slow. Yeah, I just said that. And this is another case where hardware provides a mechanism that is fast, and maybe not another case. And in context switching, the hardware mechanisms are pretty limited. Here, we have a nice interplay because hardware is really the part of the system that's in charge of making sure this happens quickly, because that's something that hardware is very good at. But hardware has to provide enough of an interface to allow the kernel to set the policy dictating how translations happen, whether translations are valid. So the kernel is in charge. The kernel maintains control at all times of all memory that each process has access to, and the way it does that is through manipulating the translations that are available to that process. But the hardware is in charge of making sure that this is fast, particularly making sure that the kernel doesn't have to get involved every time. All right, I'm just going to skip through this. So we talked about base and bounds, which was very simple. Every process had a one base and one bound. It was very simple to check if the virtual address is valid. It was very fast to translate it. But there were all these problems with that approach, specifically, that leads to a lot of wasted memory and both internal and external fragmentation. So we didn't like this. We extended the idea slightly into what we called segments. So rather than needing to cover the whole address base with one chunk of contiguous physical memory, segments allow me to cover each contiguous part of the address base with the chunk of physical memory. Now I have multiple bases and bounds per process. And translation and checking that the address is valid are a little bit more complicated. The MMU has to store a little bit more state. But there were advantages to this, specifically, well, there were advantages where it worked a lot better than base and bounds. There was a lot less waste of memory. But this still requires that every segment be contiguous in memory. And it's possible that segments internally have a lot of unused parts. So this still leads to a lot of internal fragmentation. And because the segments are different sizes, we still have this external fragmentation problem. So some of the same problems as base and bounds in terms of how physical memory is allocated, the only difference is the segments are small. So that's good. It takes fewer segments, less virtual memory in within the segments to cover the address space. Because most of a process's address space consists of virtual memory that's not valid. Any questions on this before we go on? Address translation is a topic which is popular on midterm exams. Because it's fairly easy to design questions about. Because the questions involve math. So this is something that will probably come up again. Yeah? I just want to point out, he asked for that, right? So maybe what we'll do is if you want, then OK, fine. That's OK. I'll do two examples on the exam. One will be in Hex, one will be in base 10. Would anyone like to request other bases? Octol, we could do one in whatever 7 is. That's weird, right? Whatever, you can do anything. We could do binary, right? It's going to require a lot of paper. Would you like them in Hex as well? Yeah, we can do that. It's not a problem. We will have two parallel problems. One will be in base 10. The other will be in Hex. I've never had anyone ask that before. Yeah? Yes. That's the point. You will get a good question. We'll figure that out, right? I'll add the scores in Hex, right? And we'll see where you go. Yeah, I don't know. OK, so any more questions on simple address mapping schemes? Now, neither one of these really did what we wanted, right? What we wanted was a way to map from any virtual byte to any physical byte. Now, maybe this was overkill. Maybe this is a dream that we were never going to achieve. And so we talked a little bit about this piece of hardware called the TLB or the Translation Look-Aside Buffer that was going to help us. So how this helps us, it allows us to do constant time searches over a large number, not an infinite number, of potential translations looking for one that matches. So if you think about, you go back to the segment idea, you might be worried that as I add segments to the MMU, it's going to take longer and longer to find the segment. And in that case, that would probably actually be true because there's a little bit of math I have to do to figure out whether or not the virtual address is inside a particular segment. But with the KM or content addressable memory that I'm going to use to build the TLB, I can do this very efficiently. So you don't have to get into the hardware details, but you can think of these as something that essentially allows me to search a bunch of different entries in constant time. So they're kind of searched simultaneously and returns whatever entry contains the key that I'm looking for in this case, which is 0x800. So the problem with these aren't very big. And so what would happen if, let's say I use these to map virtual bytes to physical bytes. What problem does that create? Let's say the KAM maps. So let's say the way that I translate addresses is that I look up the virtual address in my TLB, and the TLB returns the physical address, the physical byte of memory that that virtual byte maps to. Why would I not do this? This sounds like it allows me to do exactly what I wanted. I wanted a fast way to map any virtual byte to any physical byte. So why not do that? What is the problem here? Want to take a guess? Yeah. Well, I can't make a KAM infinitely large. So let's say my KAM has 1,000 entries. How many bytes of virtual memory can I map? If each entry maps one byte of virtual memory and there are 10,024 bytes, how many bytes can I map? 1024? Right? You guys seem tired. What's that? Ran out of fingers. Ran out of fingers, yeah, exactly. So I mean, if there's a one-to-one mapping, and that's a pretty huge KAM, actually. Think of KAMs as like 32 or 64. I think the one on the MIPS has 64 entries, if I remember correctly. So I can map 64 bytes of memory, of virtual memory. How much is that? Not very much. So let's say I have a program that's running along sequentially. It does not loop. It does not branch. How many address translate, how many times will the kernel have to be involved to load new address translations? So another way to think about it is, once I put an address in the TLB, I want to get some mileage out of it. I want it to get reused. So if each entry maps one byte, and my program is running along sequentially, how many times will that entry be reused? How many times will it be used? Maybe that's easier. Once. So I go to the next address. That address isn't in the MMU. There's a trap to the kernel. The kernel loads it. The address is translated. And I repeat this over and over again. So how, what percentage of virtual addresses generate an exception that the kernel has to handle? These are not hard math questions. 100%, all of them. So this is not what I wanted. What I wanted was the kernel to be involved as few times as possible. So at this point, I've got segments that are too large. Mapping individual bytes doesn't work either, because I can't map enough of them. And I've also got these fragmentation problems that are created by segments, because they're different sizes and there's too large, just internal fragmentation. So what do we do? Well, we try to make a compromise here. And the modern compromise is to, so there's one reason why I would like the amount of memory I map to be big or the page size to be big.  And we'll come back to this. We'll talk about this a little bit. But that's the trade-off. The smaller these units are, the less internal fragmentation there is, because I'm assuming that things that are close to each other in memory are related, which is normally true. Structure and array access to them are clustered. As they get bigger, though, they allow me to map more and more memory using a fixed size cache. So we call, OK, so and this also, depending on the size of this unit of granularity, this also determines the size of the data structures that the kernel has to maintain. So this is another trade-off. As these get bigger, it takes fewer of them to map the same amount of virtual memory and any kind of data structure that's related to memory management gets smaller. This is all, I mentioned this a little bit last time, but I want to come back to it, because this is pretty critical to understand. So a lot of this is driven by this notion of what's called execution locality. If a process, you can think of the virtual memory that a process has mapped at some given point in time. It's a combination of the stuff that has its code in it that came in through exec, anything in the heap that was created by malloc through s break stacks of the threads that are running along, whatever. Imagine that you're watching all the accesses to that memory in time. You could even do like a heat map, showing the number of accesses that are occurring in various parts of memory. And the important thing here is that over small enough windows of time, the memory accesses are highly clustered. So it's called execution locality. The reasons for this are pretty obvious. So let's say I have a loop of code that's running, that's looping at 10,000 times. That loop accesses the same series of instructions over and over and over again. A lot of times that loop is manipulating some kind of data structure, maybe some sort of array. That array is also located in contiguous memory. So now it may be that I have a couple parts of memory that are hot at one given period of time. Part of it could be where my code is. Part of it could be some object in the heap that I'm accessing. What might the other part be? In general, I might have three regions that could be hot. Three regions where I would see a lot of different accesses. I gave you two of them, what would be the third one?  Think about a loop, right? It's executing a series of instructions. So some instructions came from its code somewhere, so that part is warm. I just told you it's accessing some sort of dynamically allocated data structure that's on the heap, so it's producing some heat there. What's the third part? Where's the third part of memory that that loop is going to access, probably, in most cases? Stack, my loop iteration variable is probably a locally allocated variable that's part of the function context. That's on my stack. So I might have these three parts of memory that are hot. The rest of my address space is completely unused. It's not touched. There's a whole bunch of the code I'm not executing. There's a bunch of different data structures that I'm not touching right now. And there's other parts of my things that are higher up on my stack. The function context that was saved by the caller and the caller of whatever function I'm running, that stuff's also quite cold. Over time, these areas move around, but over a small enough time window, there are just small pieces of the address space that are in use. Does this make sense? This is kind of critical to understand why the rest of this works. If you, now, it would be fun. You could try this at home. Try to write a program whose memory accesses are entirely randomly distributed. So in that case, if I have a certain amount of virtual memory allocated, every time it's like I'm picking it random from anywhere in my virtual memory and I'm touching that byte. I think that would actually be a very hard program to write, but that's not how programs work. If your program ran that way, it would be terrible. It would really, really frustrate the cache and the other things that we're going to do, but it turns out, programs don't run that way, so that's good. Okay, so the modern unit of execution to granularity is something called a page of memory. This is probably something you guys have termed that you guys have heard before. Page sizes, so for a long time 4K was this really canonical page size. Now you see architectures that are looking at larger page sizes. Why would we start to think about bigger pages today? What's happened over the last 10, 20 years that might lead you to think that 4K starts to feel a little bit small? Why am I not thinking about like a four megabyte page instead of a four kilobyte page? What's different about today's computers? What's that? They have more memory in particular. The disk size is sort of irrelevant here, right? But they have a lot more memory. So a 4K page on a system with two megabytes of memory seems reasonable and you can calculate how many pages it would take on a system with eight gigabytes of memory, 4K pages start to seem pretty small. So there's something else that's changed too though. So it's not just the amount of memory. On certain systems, you can configure different parts of your address space to use different page sizes. What's an example of something that a process might be using where it might make more sense to have a larger page size, like a four megabyte page size? Databases, yeah. So databases are a great example. Databases, I do not want the operating system playing games with these little pieces of memory. If I have a big database, I want that database all in memory all at the same time and I want it to stay there. What's another example? This is something that I suspect you guys do on a regular basis with your computer. It's a pleasurable activity. Yeah. Oh, okay, games would be, games are interesting, okay? That's not what I was thinking of. Gaming for me is not a pleasurable activity. I'm not very good at computer games. Yeah. Videos, right? Videos are huge, like several gigabytes. And the video is really, I mean, videos show a great degree of locality, but they're so big that if I was loading things in 4K at a time, that would cause more overhead than I want. So once I touch a certain four megabytes of the video, I'm probably gonna watch all of it. Four megabytes of video is maybe, I don't know, 10 seconds or something like that. Don't quote me on that. It's not very much. So in general, your playing videos from start to end unless you're strange. So once I see memory access to a certain part of the video, I might as well load that a big chunk. Okay. So, and now if you, the way you can think about this is how much, when you think about TLBs, you wanna think about how much virtual memory will the TLB able to cache translations for? So if I have 4K pages, then 128 entry TLB, which could be pretty standard, maybe they're a little bit bigger now, can cache one megabyte of virtual memory. That means that as long as my process is using less than a megabyte of virtual memory and all those translations have been loaded, I shouldn't see any new exceptions that are generated by this. And this has, this is related to execution locality. So if the data structures and the code segment and the stack that I'm using, if that all fits into within the amount of virtual memory I can map in the TLBs in a small cache, then I can do a lot of work in my program before the operating system has to load new translations. Eventually I break out of that loop and I go off and program to something else and the operating system needs to load some new translations so it can use some other part of its virtual address space. But to the degree that the clustered accesses over short time windows fall into this amount of memory, I'm good. Another way, an easy way to think about pages is just as fixed size segments. So we don't talk about a bound with pages because there isn't one. The bound is the same, 4k or whatever the page says. So for page translation, because these are powers of two and because they're fixed size, we can play, there's some games we can play here. We can optimize a little bit. So what we usually do is you, any memory address, is in some page. So if I count pages from left to right across the address space, I can break any memory address into two parts. The first part is the page number which we call the virtual page number. That identifies the page that the address is on and then there's an offset. The offset is between zero and what for a 4k page? A 4k page, once I've identified the page my memory is on, the offset is between what and what? What's that? Zero, okay, so someone is forgetting their hex, right? So that's, should I accept that answer or not, right? It's like jeopardy. Zero and three, nine, nine, nine, nine, no. How about zero and four, nine, four, zero, nine, five, right? So it's zero to 4k because what I do to figure out, I find the page and then every page is 4k and so the offset within the page has to be between zero and 4k. When virtual pages are resident in memory, the virtual pages map to physical pages. Now there are other places that virtual pages can go. Talk about that on Friday. But when a virtual page is in memory, when the memory is, when the virtual memory is actual memory, the virtual memory, what we do is we just map a virtual page onto a physical page. So you split up physical memory into page size chunks as well. And because each virtual page maps to a physical page, by construction all the addresses within that virtual page map onto the same physical page. So here's how we do this and again, I have a diagram in a second. So to check whether or not a virtual address is valid, we need to make sure that there's a valid virtual page translation to physical page translation that exists for this page. And then translation is very easy. So to translate a page, what I do is I take the, I take, I compute the offset on the virtual page. I map the virtual page to a physical page and then I reapply the offset. Because the pages are 4k or four megabytes, we can do this using fancy hex number tricks, which I'll show you in a sec. Oh, by the, oh, okay, so I just wanna show you guys this. How many people have seen this movie? Yeah, you guys remember this scene? So I was actually a TA for this class. And when I saw this movie, so did you guys see that slide that's up there in the middle that has like 60,000 arrows going into that box? Remember thinking they clearly made that up. There's no way that my advisor, who's supposed to be the professor in this, Matt Welch actually used a slide like that. And then when I was preparing this course, I found that slide, that exact slide. Like wow, that was real. Yeah, I don't remember Mark coming to class that often. I do remember his partner in the class who came back years later and was a TA for the class, fell asleep in class once, and we squirted air in his ear using one of those compressed air things. That's a really mean thing to do. I don't think he appreciated it very much. He did wake up though, that was kind of the goal. All right, so let's keep talking about virtual memory. So we're using 4K pages, and here's how we do the translation. So the nice thing, the TOB here is not mapping virtual bytes to physical bytes. It's now mapping virtual pages to physical pages. So for any page of memory, we can divide it into a virtual page number and an offset. The fun thing about 4K pages is you can actually do this visually. So can anybody tell me what the page number is? The virtual page number is for this virtual address. The offset is 4K. Can anyone see how to do this? Anyone want to guess? So the offset is the bottom four hex digits. The page number is the top. So you can just, and this is only because the pages are 4K, if they were something else you'd have to do something more messy. But with 4K pages, bottom three hex digits of the offset, the top, however many you have are the page number. So this is virtual page number 800. What physical page number does this map to in my TOB? Yeah, 306 right here. So I search the TOB, identify the entry. What physical page number, what physical address is this memory access going to hit? So I've looked up my virtual page number, how do I reassemble the physical address? It's pretty similar to how I de-assemble the virtual address. So I put the physical page number, I replaced the virtual page number with the physical page number, and the offset's the same. So that's my physical address. All right, let's do this again. So a virtual address, bottom three hex digits are my offset. So I split it into the offset and the virtual page number, which is 800. I look up the virtual page number in the TOB and map it to a physical page number, and I reassemble the physical address by combining the physical page number with the offset. And because these are 4K pages, you cannot, don't try this at home with a 1K page, it won't work. With 4K pages though, I can just smack these guys back together, and I'm good. Questions about this? Yeah. Yeah, I think that's just me being sloppy. Yeah, sorry, the virtual page number, the virtual page number here was 800. 346 is the offset. Just, good question. Any other questions about this? Yeah, yeah. So heck, I wish I knew this. There's some limit on a 32-bit system. Is it eight? Yeah, I think it's eight. So I think 32-bit addresses will go up to OX, F, F, F, F, F, F, F, F, F. That's like, buffalo, buffalo, buffalo, right? So if I had an eight-digit hex address, how would I compute the offset? It's the same. It's the rightmost three hex digits. Everything else to the left? So if I had eight digits here, I'd have a five-digit virtual page number and a three-digit offset. Does that make sense? Yeah. Let's do another one. So I want to cut to the chase here. Who can map this to a physical address? Who can play TLB? Yeah? Yeah, split off the virtual page number, look up the virtual page number of the TLB, place the virtual page number with the physical page number, and snap the address back together. Any questions about this before we go on? So what you can notice is that rather than using the TLB to map bytes, which is what we were doing before, I'm using the TLB to map pages. So my address translation granularity has gone from one byte to 4K. And that's what allows this small cache, which is only 128 entries, or this one has four entries, to map, in this case, how much virtual memory would this TLB be able to map with 4K pages? 16K. Each page maps 4K of virtual memory. So if a process started to run, and pretty soon, all of its virtual addresses were clustered within a 16K region, the operating system would not have to get involved at all. The TLB would have all the information, or the MMU would have all the information it needed, in the TLB to map all of those addresses without the operating system being involved. Yeah, so these are also already at translations that have been loaded by the operating system. So who controls the TLB? Where do entries in the TLB come from? Yeah. Yeah, the operating system has to load them. This is how I provide processes with access to physical memory. If the operating system doesn't have control over the TLB, then anything can happen. If I allow a process to load TLB entries, the process could have them mapped anywhere to a physical memory that it doesn't actually control. So that would be bad. So the operating system has sole control over mapping of loading entries in the TLB. How is that enforced at hardware? What would happen if a program, a user process, tried to execute the instructions that I would need to run to manipulate the TLB? Those are just instructions. They're part of the instruction set. What happens if a user program tries to use one of them? How do I make sure that this is something that only the kernel can do? Permission level. So what happens if a user program tries to execute one of these instructions? Generates an exception. So these are instructions that have to be executed in privileged mode. If I'm not in privileged mode, if I'm not the kernel, I can't execute these instructions. So if a user program tries to run one, I trap it into the kernel. The kernel sees what happened. It said, that's a terrible thing to try to do, no way. And kills off the user process. Yeah, there we go. OK, sorry. So this is different. So if a process, now here's the thing that can happen. A process is running along, and it tries to access a virtual address. It tries to access a virtual page, but it is not loaded into the TLB. So in that case, this is the normal exception handling path. The TLB traps into the kernel, asks the kernel for help. The kernel needs to load a valid translation or kill the process, in the case that the process has gone haywire and it's accessing memory that it shouldn't be able to access. All right, so what's good about paging? So paging allows us to maintain a lot of the benefits of segmentation. I can layer segments on top of pages. And a lot of systems, memory is organized into what are called memory objects that map a certain region of the address space that consists of multiple pages. Those memory objects have information like permissions, sharing information, allows you to share regions of memory between multiple processes and stuff like that. The unit of translation granularity is still the page. But the segments allow me to sort of organize pages into groups that have similar properties. So that's nice. And pages turn out to solve two of the problems that we have with segmentation, both of the fragmentation problems. So how do pages help solve the internal fragmentation problem that segments have? I feel like I'm just going to watch these videos and write these questions down and put them on the exam. It's always hard to write midterms. So there is both internal and external fragmentation that I had with segments. How does this solve the internal? Or pick one. Well, it's pretty much no wasted space, or at least. So it's possible that I'm only using one byte and a page. It's possible that there's a data structure that I'm only using one byte of, and the rest of the page is wasted. But even in that case, I'm only wasting 4,095 bytes of memory in a segment, which could be very large. I could have a segment that's megabytes in size and only be using one byte of it, and then I'm wasting everything else. So the maximum amount of memory I can waste in a page is the page size minus one byte, in the case where for some reason I needed a whole page of memory to get access to a one byte data structure. That's really the only way that would happen. Even if I'm looping, and even if I'm in the tightest loop that you can write and see, that still requires, I think, two or three instructions. So there I would be wasting 4k minus three instructions or something like that. What about the external fragmentation problem? So I'm limiting internal fragmentation. How does this handle the external fragmentation problem? This is very nice. This is even nicer than the other. In the case of external fragmentation, there is now zero external fragmentation. Why? Yeah. Yeah, I mean, remember, I'm splitting virtual memory into pages. And when I need a page for a process, I find a page of virtual memory. All the pages are the same size. And so there's no case where I could try. I would need, I always need, think of it this way, I always need 4k. If you always need 4k, it's very simple to write a very, very efficient allocator that suffers from no external fragmentation. Now, this isn't quite true, because if I have different sized pages, I might have problems. And the kernel sometimes needs bigger allocations that are also contiguous in physical memory, blah, blah, but more or less, when I'm talking about user memory allocation, every user memory allocation needs a page. One page, two pages, three pages. And those pages don't have to be contiguous because of how memory maps. So no external fragmentation or fixed allocation size. If you ever want to reduce external fragmentation, pick an allocation size and stick with it. That's the easiest way to do it. OK. Now, the problems with paging I really have to do with the fact that pages are sort of small. And so now I need this special hardware to help me out to do the translation. The other issue with paging is that you might have noticed is that pages have the potential to require a lot of state in the operating system itself. So when we talked before about what does the MMU need to know for base and bounds. So for base and bounds, how much state per process does the operating system need to store? The entire mapping between a process's virtual address space and physical memory really boils down to how much state for base and bounds. For base and bounds, how much state does the operating system need to store? Anyone want to guess? The base and the bounds. So we're thinking eight bytes. That's pretty good. What about segmentation? Now the plot thickens a little bit. So if I asked you for a particular process, how much state would the operating system need to store for if it was using segmentation and not paging, how could you answer? Can you know exactly? Why not? Depends on how many segments the process has. So how much per segment state do I need to say? Each segment has a base, a bounds, and a start virtual address. So now I've got 12 bytes per segment. So that doesn't sound so bad. A lot of programs don't have very many segments. Code, heap, stack, three, maybe one more for some of my statically initialized variables. What about pages? How much state do I need? You still can't answer exactly, but how much, what does it start to depend on? Yeah? Page size? Depends on the page size. What else does it depend on? Yeah? How much pages? Eh, close. Yeah? The size of the process. The size of the process in what? How many virtual pages it has? So for each virtual page, I clearly need to store some information. And so now in terms of scaling the amount of operating system state that's required, I've created a lot larger problem. So now it pays us to do some of the type of bitwise engineering that the social network lampooned. So now here's the challenge, right? Here's the state maintenance challenge. So you can think about it this way. When the TOB creates an exception, the kernel needs to be able to answer questions about address translations. So first of all, I need to make sure I can store those translations compactly. And I also need to be able to locate the information rapidly. Because this is another source of overhead in the operating system. If the operating system takes forever to look up page table entries or to figure out how to map virtual addresses to physical addresses, the whole system is going to slow down. So usually, now I don't know if this is true anymore. This may on modern systems, we've sort of gone to 40 bytes of 40 bits, bit wide addresses or 48 bit wide addresses because you guys have too much memory to address in 32 bytes. But on a 32 bit system, 32 bits, on a 30 bit system, it's usually possible to pack all the information I need to know about each page into 32 bits. I think now I suspect that these data structures are 64 bits on modern systems or at least bigger than 32. Now the nice thing about it is that the virtual page, the physical page numbers are only 20 bits wide. The offset is 12 bits. The rest of it is 20 bits. You can work that out at home. And then here's other stuff that I might wanna know about each virtual page. I might wanna know where it is. Is it in memory or is it somewhere else? Talk about where it goes on Friday. And then I can remember I can apply these permissions to memory now in a way that's analogous to what I might do for files or what you guys are used to for files. So I can say, can this page of memory be written to? Can it be executed from? Am I allowed to load and execute instructions from this page? And this sort of dramatizes what I said before. If the operating system is the source of slowness here, this will start to become overhead that can cause the machine to run extremely slowly. Part of the problem is, when I get here, I'm already slow. I was slow right here, right? So by the time I get to the kernel, something already went wrong. What's the thing that went wrong? I'm already on it, well, you would think of it as a slow path here because something didn't work out for me. What was I hoping would happen? What do I rely on to make this all fast? Yeah. Yeah, I hope that the MMU already knew how to translate this address. So by the time I get into the kernel, I'm already in trouble. I'm already on a slow path. I've trapped into the kernel, I had to do a context which is super expensive and my cache has failed me. So this is already bad. And if the kernel takes a long time to figure out what to do and how to reload the MMU, it just gets worse and worse and worse. So I need to be able to locate this information extremely rapidly. There's another requirement. So now we're really talking about data structures. What's the other requirement for the data structures that I use to map virtual addresses to physical addresses? What's that? Remember, I'm running in the kernel and the software is now manipulating the TLB so that this address can be translated and the instruction can complete. But I need to make sure that these data structures allow me to look up the information rapidly but I also need to make sure, what else? Whenever you design data structures, there's usually a trade-off between speed and some other things, space. So if these data structures are huge, what are they going to consume? Space, physical space? Where are these data structures located? Memory. The more memory the data structures take up, the less memory there is for processes to use. And we'll talk about on Friday, once I start having to move things around out of memory and onto the disk, things really get slow because memory is already kind of slow compared to registers but disks are like Pluto slow compared with memory. Okay, so we refer to the data structure that we use to perform this mapping as a page table. Okay, page tables are responsible for storing information about virtual to physical translations and access it efficiently when needed. On Friday, we'll pick up here, talk about some page table structures and hopefully get through swapping. So I will see you then. Good luck on assignment two.


The Greens will bring a motion to Parliament this week to reverse the Parliament's support for the invasion and it is time for Labor to change. But it is devastating to see Labor act so quickly to cut aid to the people in the UK and yet they drag their feet and continue to back the invasion month after month after month even after 26,000 people die. Well what does it mean to talk about freedom for Palestine? Well right now it means that a Palestinian child can live in freedom, the freedom to know that a bomb won't be dropped on them tomorrow. It means that a young Palestinian is free to walk the streets knowing they won't be arrested and put in jail just because of who they are. It's the freedom for someone who lives in Hebron to be able to walk out their front door and not have a world that's just because the street is unavailable to them. It's the freedom for the student in Nablus or Ramallah to be able to go to her exams at the University and know that she'll be able to make them and not be detained at a checkpoint along the way. It's the freedom for someone who lives in the West to be able to turn on the tap and know that water will come out and it won't be turned off further up because water has been diverted off to an illegal settlement. We are demanding a ceasefire now and an end to the occupation because that is what will bring lasting justice to Israelis and Palestinians.   Authorised by J. McColl, Australian Greens, Canberra.