Our first question is from Rolando in Germany. Hey, what's up, Rolando? What's going on, man? Hey, is that Sal? How you doing, Sal? Hey, what's up, man? And I got Adam with me over here. What's up, what's up? I think Doug is switching up the cameras. Hey, Adam. What's going on, brother? How you doing over there, man? Man, it's a long day, long week. We're doing some COVID training right now. So it's been one hell of a week, but it's, you know, we're getting it done. Excellent. So what's your question? Oh, so my question is, I'm looking into changing my job to a job that's more physically demanding on the body. So my question is, how do I build a strong, durable body to prevent injury? And what type of nutrition would go well with that to prevent that? The type of training that you'll have to go through for this is like rucking with like 60 pounds for miles, running for miles. You have to be lots of calisthenics, carrying lots of load. So yeah. OK, so that's what you're going to be doing. What do you do now? I want to know what the contrast looks like. Oh, I'm actually just doing maps anabolic right now. I just had eye surgery. So I'm trying to get my strength back. So I'm doing maps anabolic. And I'm doing, I'm on the strength phase. So phase one, week three. OK, OK. OCR, man. Now, do you have any areas where you tend to have pain now, OK? So ankles, knees, hips, back, shoulders, neck. Are there any areas now that you think I better be careful because these tend to flare up on me? Oh, yeah. Yeah, so I do actually have a little bit of, I know I have some hip mobility issues. I use some techniques I learned from Prime Pro. I have some shoulder. So I've been trying to get that range of motion going for sure. OK. When you say hip, give me a little bit more detail. Where does it hurt and what makes it hurt? So it's like my lower, where my glute is, I guess, a little above that. OK. But that is sometimes just from standing too long. Or if I have a little bit of, if I'm carrying too much weight for a little long period of time, I'll have to kind of take a break and try to do some 90-90s to stretch it out. Excellent. OK, so you're saying right above the glute, sounds like SI joint. Are you familiar with the SI joint, the sacroiliac? Joint, right above the glute? No, that's unfamiliar. OK, so it sounds like you're getting a little bit of pain there. And in my experience, that comes from definitely some issues in the hip. But core stability, believe it or not, makes a big difference there. If your core is not firing and activating the way that it should, then you're going to get a lot of the pressure of the walking and hiking is going to go straight to the hips. And then this is just something that we really figured out later on in our careers. Believe it or not, the ankles and the feet make a huge difference with the hips. If your ankles and feet are not doing what they're supposed to do, the hips tend to, it's either the knees or the hips that tend to suffer from that kind of stuff. What are you doing for your core? Like I said, sir, I'm just following the what's on maths on a ballerke. And then instead of doing the trigger sessions, sometimes I like to do farmer carries and sleds. And then I'll do some cable, what they call it, with the cables. I can't think of any side chops, some side chops and stuff. OK, so a couple of things I'm going to recommend to you. I'm going to recommend that you do planks. But when you do a plank, I want you to do to tuck your tailbone, OK? Sorry, YouTube video. Yeah, we have a video where I show people how to do this.  So we're going to strengthen the core while the hip flexors are being active. This is great for people like you, right, who get some of this hip pain from walking and hiking. You want the core to do more of the work than it's probably doing right now. There's a second exercise, there's a second video that we have, it's called hip flexor deactivator crunches. I think this will also help you out a lot. Now these are not like big muscle building exercises, but they're great for corrective type strength. And in your case, I think that they would be phenomenal. Let's move up to the shoulders now, OK? You said you had some shoulder pain also. Where does your shoulders hurt? What causes them to hurt? What was that last part?  It's just like right here in the front, but it just gets exhausted. It's more like after I hit bench for after four or five sets, and then it's like, oh, I mean, I mean, like trying to the windmill going on the wall to both sides, both sides are one side more than the other. Just this side, mostly this side. I don't really feel it anywhere else. OK, so you know what that sounds like? It's quite common for people to have bicep tendon inflammation. And that is the bicep tendon runs all the way up above the top of the arm bone, the humerus under the shoulder. OK, so when this happens, it gets tight. If you push on it, it hurts. Your bench press, overhead press, a lot of times aggravates this. Believe it or not, static stretching for the biceps makes a big difference with this kind of shoulder pain. So I would recommend maybe a few times a day to do some bicep stretches, some long hold bicep stretches, and then even massage the bicep a little bit while you're doing this. In fact, next time you bench press, do this before you bench press. Stretch your bicep, hold the stretch for a minute, then go bench, and then after the first set, do it again. See if you notice a difference. Oftentimes, front pain, the shoulder pain in the front is coming from something like that. And then of course, then you would also want to do shoulder mobility work, which you said you were already doing. I think if you add the bicep stretch to that, I think you'd be OK. Really common with people that have to hold something, I noticed this after I had max on that one side of having to carry him all the time. My bicep in that isometric position, this being so tight, and then you feel the pull. So pay attention if that's a side that you carry like your, I don't know if you carry in your bag and your gear on that side a lot. But just even if it's not super heavy, but just holding something in that kind of flex position for the bicep for long periods of time during the day, a lot of times that'll cause that. And if you become aware that that's what's causing the shoulder pain, you'll be good about stretching right after that happens. So after I hold max for 10 or 15 minutes now when I'm with him, I try and stretch it out real quick right afterwards, because I know if I don't, and I keep doing that, it ends up causing shoulder pain too. Now aside from those things, because those are the individualized things, so I'm giving you advice that is specific to what you're telling me. Besides that, generally speaking, your best workout program to follow that's going to help you with what you said earlier, which was the running and the rucking and the long distance stuff. Adam said it earlier, Maps OCR. Maps OCR would actually be perfect for that. So I would do the core stuff that I said, do that daily. I would do the bicep stretching daily, the shoulder mobility stuff daily, and then follow Maps OCR as your workout. That would be, I think, the perfect kind of routine for what you're saying. Hook them up. Yeah, do you have more? Yes, sounds great. Do you have Maps OCR, by the way? Oh, no, I have all the other ones. Actually, I think I'm only missing like two or three.  So you're going to have Maps OCR, so follow that program. Oh, I appreciate you. Thank you so much. No problem, man. Hey, and I know Doug told us earlier before we turned on the cameras, you're serving our country, so I want to thank you for your service. No, thank you guys for that kind of support. And I've been listening to you guys for years, and I appreciate everything you guys do. You guys helped me grow so much as a person to become a better father leader and take care of my teammates and the people around me. So I really do appreciate what you all do. Hell yeah. Hell yeah. How you guys bring to us the audience. Thank you, man. Thanks for calling in. Yeah, thank you. I see you. See ya, brother. You know, it's great. You could tell that he's obviously been listening for a long time. I mean, he's doing the work from Prime Pro. He knew to do the shoulder circles. Like, that's cool to hear like somebody trying to troubleshoot and still have, he's got a pretty good idea of what he needs to do, just the SI joint stuff and then maybe the bicep. The front of the shoulder pain like that with the bicep is so money because... Yeah, because the shoulder pain. Oh, shoulder mobility. I wanted to hear him say it. I bet you money, he's carrying his... That was so good. Yeah, I guarantee. I wish he said that. Yeah, I guarantee he's carrying his gear on one side. 100%. Yeah, yeah. Or it's his gun or whatever. Yeah, yeah. Something that he just carries on that. Well, that's why when I asked if it's on one side more than the other, it's for sure it's something like that, you know? Yeah.


Alright guys, how are we? What is going on? Welcome back to another video. Today's video, we are beginning or I am beginning a bit of a question and answer series on my six month bodybuilding prep that I finished on October 23rd or 4th. Today's day is November 10th. It's taken me over two weeks since finishing my show to actually well feel good enough and feel content enough with my physique and how things have gone post show to actually be able to sit down happily and with a positive attitude and start to answer some of these questions because post show I went and binged hard. Not ideal, something I told myself I wouldn't do but I did and I've spent the last five or six days trying to bring that back and I'm happy to say that I haven't got back to where I was but I've brought it back considerably so the damage that I did post show physically and mentally has been cleaned up and that's only happened through a whole heap of discipline by myself and I'm pretty proud of myself for doing that so anyway we're here and I'm going to answer my first question of the day and the first question is how did I get to 5% body fat without tracking a single calorie? You know I'd mentioned to a few people throughout my cut and throughout last few months that I was you know they asked me how did you get that lean or how do you get to 5% body fat? I was putting up my body fat percentage readings each week and you know people were intrigued and I couldn't tell them originally because I literally was not tracking a single thing not a single calorie I mean if I yeah certainly not a single calorie maybe the only macronutrient I was tracking was protein basing my meals around a protein source which is you know something if you're looking to drop weight and if you don't have a huge amount of you know knowledge on nutrition all I'd say is create your meals around a protein source nothing too big and look get away with the least amount of carbohydrates and fats surrounding that that you can what that's gonna make you start to think about is is is foods that are higher in volume you know in general for lesser calories you know foods well not foods condiments and sources that are lower in calories that you can add to foods add to your protein sources to make them really tasty without you know a huge amount of extra calories so there's plenty of things I did and I've got a bit of a list here so I'm gonna I'm gonna I'm gonna run through my journey which started on April the 13th two weeks into New Zealand's coronavirus lockdown and I had absolutely smashed myself with food for the first two weeks and alcohol so we had a house full of four people and we're all just loving life really you know you could still go to the supermarket you could still go to a bottle store you know most things was well most things as far as consumables were still open so yeah eating just got ramped up so for those first two weeks everything was good then one morning I looked in the mirror and I thought fuck man I've let this go I'm out of shape I don't know what's gonna happen I certainly didn't have any any inkling of competing at that point but I did want to clean things up and so I began doing that with the exact same strategies that I used throughout the entire prep just like I said using more volume foods with lesser calories basing my meals around a protein source such as chicken or salmon or eggs you know what I mean and just reducing the shit in my diet so that's how it started that was April the 13th on that day I began a six week fat loss transformation which you can see on this channel and that actually continued from six weeks to 12 weeks and that continued from a 12 week diet into a competition prep so for the first few months first two or three months it was literally just overall reducing the amount of food reducing the amount of shit and increasing slowly but surely my expenditure my calories burnt so I began weight training after having a fair few months off it was only at home it was with very light weights but at least it was something I went for walks in the morning I began going for walks in the morning my passion for actually getting up early in the morning getting outside when it's still dark you know for a walk came probably about two or three months in it didn't happen overnight and now I can safely say sitting here in November that my attitude changed my attitude towards being in shape you know living a lifestyle that's going to allow me to be in shape which includes regular exercise that includes you know sticking to these diet principles and that's how I got through the first few months in fact that's how I got through the whole the whole entire diet was was using my intuition looking at a meal and thinking no that's too much I shouldn't be having that I probably shouldn't be having that and being disciplined bro that's what it's about it's about knowing what you've got to do but also following through with it and being disciplined and putting down that cookie at times now I'm a big sweet tooth and I can safely say that I cheated on my diet a lot but would you call that cheating or would you call that just staying sane or would you call that just having a wee treat or would you call that just having a cookie I mean is it really cheating on your diet if you're not actually dieting I'm not sure but I certainly did have a lot of cheats it kept me sane I wake up the next morning I go for my walk or my jog I sort of reset and move on and that's how it happened basically I figured okay how am I gonna track this well I've got my fit bit okay so I'm gonna be able to track my calorie expenditure I'm not tracking my calories in but I can use the mirror okay the mirror is a fantastic tool it's a tool that's always gonna be there it's not gonna go away it's gonna be consistent well whether I've got my glasses on or not is a bit of a factor but so I looked in the mirror in the morning if I was soft if I knew that I'd smashed some food the night before well you know I'd fast for most of the day intermittent fasting was certainly have to be one of my tools that I used and that is just to control the overall amount of calories throughout the day also the fact that I can get up in the morning and easily go six to eight hours working mentally on things such as YouTube videos and and writing and and and planning and conversing without the need for food you know it's just the way that my brain works in fact I'm very productive on a hungry type of feeling which is something that Foo Art RBI art has actually touched on in the past and a lot of bodybuilders touch on when they are when when we're dieting and we're getting leaner and we can feel hungry and we know in our head that that's only gonna mean we're gonna be we're gonna be getting closer to our end goal that's actually a good feeling and you know it can it can push you to to be motivate motivated to do certain things such as a whole heap of work in a pretty condensed period of time you know what I mean you can really just hammer it out that's that's how I feel if I start eating if I start taking a break from that work to sit down and have a meal that's when who knows what's gonna happen after but if I can fast I know that I'm not gonna I'm not gonna stop my my workflow through you know having to have a meal it's a fucking good feeling man and I make the most of it pretty much every morning and I certainly did throughout my my competition diet so you know I figured if I was hungry if I was feeling hungry I'm losing fat and I'm just gonna push that feeling as long as I can a danger with that is obviously over eating at the end of the day pushing a fast for too long too often and when you're not tracking exactly what you're having in that extreme feeling of hunger can mean that at the end of the day you'll get through a couple of thousand worth of calories you won't really know exactly how many have taken in but you'll still feel hungry you know I mean you'll still feel empty so you be like well well I can keep eating so I'm not feeling full yet and I guess it's I guess it's just a matter of me having tracked on my fitness power for so many years in the past I just know I just know at this point how many calories protein carbs fats so yeah intuition was big so in July at about 10% body fat and managed to bring my body down to about 10% body fat stayed there pretty consistently for a good couple of weeks and I decided this was the point that I needed to connect up with a bodybuilding coach not so much for the nutrition but just for you know some help definitely for help with my posing and just to have someone with experience locally that I can I can rely on and I can meet with and discuss things so that's what I did I ended up meeting up with Steve Orton he is a local Christchurch coach and a professional bodybuilder and if you don't know who he is and you're into bodybuilding what rock have you been living under that's what I want to ask so originally I just went for posing he did give me a diet but what I realized pretty early on is that in July I was I was playing rugby I was going for for my walks but cardio man cardio with rugby was very taxing actually it was 90-minute training twice a week and a 90-minute game or 80-minute game also I began my course at the NZIS to become a personal trainer which I'm still doing now which included cardio which included weights training you know my my expenditure was huge at that point and so any diet that Steve was gonna give me if I was gonna stick to it 100% you know with the ups and downs of of my calorie expenditure it just wasn't gonna work so I continued to go on intuition I continued to if I haven't if I had a massive day of cardio training I would eat carbohydrates that night to fuel me for the next day because I knew that if I woke up the next day and I had to continue if I woke up the next day and I had to go to NZIS and smash a big workout you know after being very depleted it just wasn't sustainable and I still had a fair few weeks to the show so that's how I continued for the next four or five weeks leading up to my first show of the year because we did do two with Steve in my corner I was able to drop my body fat from 10% down to 5% we did that over about an eight-week period slowly but surely I remember the the first the first reading I had with him was I think 10.9% and then it's slowly but surely went down from there I actually gained a huge amount of confidence with the fact that I was able to bring my body fat down to 10% without tracking anything you know and it hadn't actually felt that hard so I was really pleased with that and that motivated me to continue the cut and that's what we did so we got to 5% body fat over the next eight weeks or I did I didn't actually listen to his diet one bit but I did listen to him in peak week because you know we got to the point where there's a week to go I didn't know exactly what he thought I should do and in fact I didn't know what I should do so I did listen to him and we had a bit of a peak week protocol which I will discuss in future videos but basically it's just a full depletion of carbohydrates which I hadn't done ever throughout this whole entire thing because carbohydrates were my fuel source and I was still getting lean on it on a quite a big amount of carbs and calories but that was only because my expenditure was so high so got to the show got to the show it was a great day I've discussed that day in a previous video so if you want to see how things went please look at that but basically from that point I didn't plan on competing again so that was at the end of August and it took me about a week to decide not you know what I want to I want to continue this I actually want to compete again I wasn't happy with with my look completely even though it was just for fun I still wasn't happy I thought you know I can do a bit better and this next show that was coming up was a natural show so this the first show that I did was untested was with the IFBB but it was completely untested and this next show was with the IFBB still but it was drug tested so I thought you know what I'm gonna I'm gonna finish 2020 off right with two shows and the final show being a drug tested show which is something I'd always wanted to do so now the hard part starts all right so it was hard enough getting to 5% body fat but the fact that I had to maintain that if not improve it over the next eight weeks from the end of August to the end of October when I competed again was not easy man it wasn't easy I'm gonna say it was pretty much like torture torture at times you know what I mean mentally if things are going well in life if you're looking in the mirror each morning you're seeing progress you can stick to it pretty easily but if things in your personal life or whatever come in and and start to affect your moods then sticking to a fucking diet for eight for eight weeks when you're only maintaining you're not actually trying to lose lose a huge amount of weight or gain a huge amount of weight fuck it was hard but we made it we made it and that's the main thing I followed through so I'm proud of myself anybody's guys this video has gone on for far too long it's about how I got to 5% body fat which I clearly was for a lengthy period of time without tracking a single calorie and I think we've gone through you know most of of what I did I guess I did use a few tools at my disposal to help with the fat loss without having to track things and they were things such as intermittent fasting like I've said you know more volume foods meals based around a protein source I backloaded my carbohydrates usually so I go through the first part of the day obviously fasting I would have one meal of carbohydrates then train and then most of my carbs for the day would come post training now that would see me up until basically an hour before I went to bed I'd wake up the next morning knowing that I'd adjusted those carbs knowing that I had you know probably a fair few of those still in the system so I'd get up do my fasted cardio that would effectively burn those off in my head and then throughout the rest of the day until I began eating would be a fat loss phase honestly I don't know if that if that makes sense but it made sense to me and it worked I did you know at least 15,000 steps per day that was something I was able to track and that was something I kept consistent which meant that my daily calorie burn was at least three to three and a half thousand per day you know I did make mistakes I certainly did I drunk alcohol multiple times in copious amounts like I said I cheated on my diet if I if I wanted something I'd have it but I knew that the next day I had to wake up in and forget about it and move on and use it as the tool that it was to keep me sane so the last thing I've got here is consistency is key and that's what I just said you know consistency is key as long as you wake up that next day and crack back into it you'll be fine and basically at the end of the day I could have got to for even 3% body fat and looked so much better on stage you know it's amazing how different a body can look with 1% body fat less once you get down to 7, 6, 5% body fat you know I could have looked so much better on stage but and I've written this right here I simply wasn't I simply wasn't prepared to suffer as much as I needed to and I don't know if that's because I didn't think I could physically I thought maybe that's dangerous or what but you know I've since realized especially in the last five or six days having brought my physique back down after binging post-show I know that I can suffer and I know that I can train while suffering I know I can train with zero calories it's possible it's all in the fucking head it's all in the mind and that's what half half of bodybuilding and half of getting down to 5% body fat is about it's all about your mindset so guys that was how I got to 5% body fat without tracking a single calorie I've probably included a whole heap more shit in there but I do have more videos to shoot today about the same subject so I hope you've enjoyed guys and if you do want to know more about you know my bodybuilding journey definitely head over to my Instagram page if you are into bodybuilding or into the gym or know someone that is and you're looking for new gear you're looking to support a business that's from New Zealand definitely head to my business major key physics com we've been in operation for almost two years now and I'm extremely proud of our products major key physics is a bodybuilding and fitness brand it's my brand and I'm proud of it so I welcome you to check out the website I welcome you to hit the like button I welcome you to subscribe and I'll see you in the next video thanks for watching peace


This algebraic geometry video will be about elimination theory. So in his book on algebraic geometry, Hodgshorn rather briefly mentions it as theorem 5.7a and I want to expand on this a bit. Incidentally, in theorem 5.7, Hodgshorn refers to van der Waarden's book on algebra for the work on elimination theory. Unfortunately, we won't find it there anymore because the chapter on elimination theory was eliminated in the second edition of van der Waarden's book. Elimination theory has caused a fair amount of controversy. So Henri Wey in his book foundations, it's a famous book, Foundations of Algebraic Geometry, had a rather notorious footnote that I can show you here. I'm going to need to magnify it a bit so you can read it. There we go. So he says the device that follows which it may be hoped finally eliminates from algebraic geometry the last traces of elimination theory. Okay, so Andre Wey did not like elimination theory. On the other hand, Abhyanka wrote a famous poem about elimination theory with this line in it saying eliminate the eliminators of elimination theory, which is it's compulsory to quote this whenever you discuss elimination theory. So this is a poem titled polynomials and power series may they forever rule the world. Anyway, what is this elimination theory that people get so excited about? Let me just use the magnification back down. So here's an example. Suppose you've got two polynomials such as x cubed y to the four minus seven x squared minus x y to the eight and three x squared y to the five plus four y squared plus x to the four y to the seven. And what we want to do is eliminate y. What I mean by this is to find a single equation in x that you get by working out why from this equation and substituting into that equation in some sense. Well, that looks like a rather hairy problem because you have to find why by solving an equation of degree eight here, which is going to be rather a mess and substituting that in here is going to be a real nightmare. In fact, you can see roughly what answer you're going to get because this equation has degree nine. And this equation has degree 11. So by Bazou's theorem, there should be nine times 11, which is 99 points of intersection. So there should be 99 possible values of x you get by eliminating these. So x should satisfy a polynomial of degree nine by 11. And now what I want to do is to write down this polynomial explicitly. And how on earth do we do that? So let's look at a more general problem. Suppose I've got two polynomials f of x, which is a m x to the m plus a m minus one x to the m minus one plus a naught and g of x, which is b n x to the n all the way down to b zero. What is the condition for them to have a common root? So I want to find some condition on the coefficients a i and b j, which is a necessary and sufficient condition for these to have a common root. And first of all, there are some slight complications if a m or b n are zero. So let's just assume a m is not equal to zero and b n is not equal to zero for the moment. And I'll remove these conditions later. Well, the condition for these to have a common root can be written as follows. If they have a common root, then f of x times p of x equals g of x times q of x, where degree p is less than n and degree q is less than m for some polynomials p and q.  And conversely, if this condition holds, then you can see that they do in fact have a common root. So this is the condition for a common root. You must be able to solve this equation for polynomials p and q. p and q must of course be none zero. Well, if you expand this out and look at the coefficients of each power of x, you get a whole lot of homogenous linear equations in p and q whose coefficients depend on the a's and the b's. Now the condition for a set of homogenous linear equations to have a non-trivial solution is that some big determinant vanishes. So we have to write down a determinant that vanishes if this has a common solution, which basically means writing down the matrix of all these equations. And the matrix is not difficult to work it out, but it just requires a certain amount of bookkeeping. It looks like this. First of all, you write down the coefficients of f and then you add a certain number of zeros and you write down the coefficients of f again, only shifted by one and then a certain number of zeros. And all together, we're going to do this n times. So we go all the way down to here, we get zero, zero, then a naught, sorry a one, up to a m. And then we do the same thing all over again with the other polynomial. So with b n going down to b zero, some zeros, zero, b n, b one, b zero, zero. Then we have a all the way down to here and then we get zero all the way up to b n and b zero there. And we do this with m rows. So this is the, we take its determinant and set this determinant equal to zero. And this determinant is called the resultant. This word ant, the end of a word, means two things. First of all, it means that you're probably referring to some sort of invariant. So the determinant is the most, the best known example. The other thing it probably means is that the terminology was probably invented by Sylvester, who loved inventing funny names for things. He invented a whole collection of names for similar invariants, like catalecticons, determinant, harmonizant, canonical, and so on. It's been more or less forgotten. Determinant still lives on obviously and resultant is common enough for people to remember. People later invented more of them like bazootian and so on. Well, there's a slight problem. What do we do about a m and b n being zero? You can see this massive resultant also vanishes if both of a m and b n are zero. If one of them is zero and the other. So the condition that a m is zero can be sort of a saying that the polynomial has a root at infinity. So if we look at a m x the m plus a naught, this normally has m roots. If m is none zero, if m is zero, then it will have less than m roots. So we pretend it's also got a root at infinity. We can make more sense of this if we look at the corresponding homogenous polynomial a m x the m y to the naught plus a m minus one x to the m minus one y and so on plus a naught x to the naught y to the m. And then we can think of a root as being a point in projective space, which is just our field k together with a point at infinity. So the point at infinity will be point when y is not and the other points will be x colon one. And then you can see that the resultant is zero is equivalent to the two homogenous polynomials a m x the m plus a naught y to the m and b n x the n plus all the way down to plus b naught y to the y to the n have a common zero in one dimensional projective space, which is k union of point at infinity. So let's see an example of this. First of all, let's just ask when does the polynomial a x squared plus b x plus c equals naught have a double root. Well, the polynomial f has a double root if f and f prime its derivative have a root in common. So we're going to take f to be our polynomial here and g to be f prime, which is equal to two a x plus b. Now we work out the Sylvester matrix. Well, it has a b c at the top of the coefficients of f.  So we just take this determinant. And this determinant is really easy to work out.  And here we have the usual discriminant. And we've also got this possibility a equals zero because we said that if a is zero, then f and its derivative both have a sort of zero infinity. So if a is none zero, then this has a double root if and only if the discriminant is none zero, which is the result we all remember from high school algebra. So let's have a look at a slightly more complicated example. Suppose f is equal to x cubed plus b x plus c. I'm missing out the term in x squared just to make things easier. And we want to know when does this polynomial have a double root? Well, we look at its derivative, which is three x squared plus b. And then we look at the Sylvester matrix, which looks like this. It goes one, zero b c zero zero one zero b c. So these are the two rows of f. And then we have to put in the coefficients of b three times. So we get three naught b naught three naught b naught naught three naught b. And we want to know the determinant of this. And it's not terribly difficult to work out because it's got masses of zeros all over the place. So you can quite quickly subtract three times the first row from the third and three times the second row from the fourth and reduce to something that's easy to evaluate. And you find it's four b cubed plus 27 c squared. This isn't quite the discriminant of a cube because the problem with the resultants is there's always a sign problem. You never quite know whether it should be plus one times this or minus one times this. And in fact, the discriminant of the cube because in fact minus this expression. So it should be minus four b cubed minus 27 c squared. But anyway, the vanishing of this expression here is the condition for this polynomial to have a multiple root. So in the next lecture, we will use resultants to show that projective varieties have a property known as being proper, which is a sort of analog of compactness.


Election 2020, Route of the Technocracy, by Zachary Yost, an audio-mesus wire narrated by Michael Stack. Regardless of whether one supported a specific candidate for president or no candidate at all, Lovers of Liberty should be rejoicing over a glorious victory this election cycle. This victory is not of one candidate or party over another in this race or that, but rather a resounding ideological defeat of one of the most illiberal and menacing forces we face at the moment. Technocracy. Technocracy serves as a useful veneer to cover the lust for power and domination that motivates most political actors. On paper it can be understood as rule by the smart, but in actual practice this is merely a myth to justify one class of society maintaining power and control over everyone else. Buoyed by the magic word science, experts claim to possess final knowledge and make pronouncements on truth with the authority of holy writ. Those who dissent, no matter how educated or reasonable their disagreement, are bludgeoned with slurs of being a science denier as if science were a sacred canon rather than a process of inquiry constantly evolving and changing. One of the key components of this technocratic charade is the myth of inevitability. According to this myth, those who disagree with the technocratic consensus are not merely wrong, they are opposed to the inevitable and inexorable march of progress and history itself, which the technocrats have themselves foreseen thanks to their unrivaled intelligence, of course. The unironic use of the term the right side of history is usually a good indication that someone is a technocratic true believer. However, simply making prophetic pronouncements smacks too much of religion, which all right thinking people of course know is unscientific mumbo jumbo, humans have always sought to divine the future, doing so via various means such as tarot cards, tea leaves, and mapping the movements of celestial bodies. None of them ever worked very well, but thanks to the power of science, technocrats believe they have moved beyond such primitive superstitions. Instead of throwing bones in the fire and reading the cracks, technocratic soothsayers use such arcane techniques as public opinion polling and database modeling to scientifically scry the future and discern the arc of history. The legitimacy with which vast swaths of the public holds these technocratic prophecies is one of the technocrats greatest strengths and allows them to get away with many things that would otherwise be impossible. Just consider the response to the COVID-19 crisis. Technocrats have been given virtually free reign to reorganize society at will. Few people would listen to the crazed, anti-social lockdown proposals that threaten the quintessentially human aspects of our existence, were it not for the ability to use science to browbeat dissenters into submission. However, this election has demonstrated that not only do our technocratic overlords not have the power to scry the future, but tens of millions of our fellow Americans are skeptical of these prophetic powers as well. The degree to which the prognostications were off by double digits in some places has revealed that perhaps all this scientific polling and modeling isn't much better than reading Goat Entrails after all. Thanks to the pollsters, millions of people were expecting a blue blowout that would sweep away Trump, secure the Senate and increase Democrat margins in the House. Instead, the presidential race was very close, the Democrats have barely hung onto the House, and the Senate is likely going to remain Republican. Had a soothsayer been this wrong a thousand years ago, he would have soon found himself having his own Entrails read. This disastrous record not only discredits election-specific polling and modeling, but public opinion polling and modeling in general. This is perhaps an even greater blow to the technocrats, as it removes a tool by which they can loudly assert that they have a mandate to carry out whatever status scheme they are harping on for the week. Perhaps even more important than the discrediting of technocratic soothsayers is the complete exposure of the pundit and intellectual class as self-deluded charlatans. For years we have been constantly lectured by smug, self-righteous talking heads about how America is polluted with the sin of racism on a genetic level and is in need of repentance and absolution via their preferred public policies, of course. This intersectionality and critical race theory reached a fever pitch after Trump became president. Relying on intersectional assumptions, political scientists have predicted for years that eventually, thanks to demographic trends, all the oppressed peoples will unite and rise up against their cis-heteropatriarchal white oppressors and vote Democrat forever and that the Republican Party will soon be relegated to permanent irrelevance. Yet election returns indicate that millions of supposedly oppressed peoples don't believe any of it. Trump crushed it in southern Florida among Cuban-Americans and obliterated Democrat margins among some of the most Mexican-American counties in the country along the southern border. The situation looks even worse if one thinks exit polling has any validity, an open question.  The only demographic with whom Trump's margin decreased was white men, so much for that prediction. At the end of the day, this election has demonstrated that the future truly is unknown. Those proclaiming to know the end of history have been left looking even more foolish than usual. They would have people believe that everyone else is powerless against the inexorable forces of historical progress and that those who disagree are merely reactionary holdouts who will be swept away in due time. But as Mises argues in the concluding section of his book, Theory and History, it is the individual choices and actions of actual living and breathing people that determine the course of history, not the agnostic scryings of intellectuals. Far from being something foreseen, Mises points out that the outstanding fact of history is that it is a succession of events that nobody anticipated before they occurred. With so much technocratic propaganda perpetually inundating us, the future may indeed look grim at times but take heart.  The future is not written in stone, but rather is a blank canvas waiting to be filled by the choices of millions upon millions of acting individuals, individuals whom we are capable of persuading toward the liberal cause of property, freedom and peace. The future of freedom is as bright as we work to make it. For more content like this, visit Mises.org.


Good Okay, so Carl got you to the point When we talk about sort of the CPU when we talk about memory we talk about the disk We sort of go through three stages we talk about a little bit about the details of the hardware so you guys And we talk about some of the abstractions that the operating system creates in order to hide some of the unpleasant details of hardware So you guys learned about threads and about how I switch back and forth between them And then at some point we get to talk about policy so how The operating system is responsible for understand how Threads get moved back and forth on the CPU some of the mechanisms that underlie that how the kernel gets control of the system And today we'll talk about how it uses that control Today and tomorrow and Friday how it uses that control to try to make the best use of system resources When it has to choose which thread has to run so this is something called thread scheduling we'll sort of set the stage data by talking about some of The goals on inner interactive systems, so what do you guys expect your computer to do? What would be some of the things that you would notice if the scheduling that your computer was doing really broke down really got bad And then on Wednesday we'll talk about some scheduling algorithms And then on Friday we'll do a case study of sort of a more modern scheduling algorithm talk about that. All right Three cheers for Carl. Let's give Carl a round of applause You know, I don't I don't think the right question is was Carl awesome The question is how awesome was Carl right because I can I can imagine that was fantastic According to him. He has some of his own verbal tics to work on just like me, so On that I don't know how many times he said that but I'll go back on the video and count But yeah, I really appreciate the Carl lectured assignment to checkpoint So Scott and I were you know that the core staff were pretty happy with the numbers for assignment 2.1 How many people didn't submit assignment 2.1, but tried to submit assignment 2.1? Okay, a couple of people right Yeah, I mean, I hope that it's at least got people moving right even if you didn't manage to get the 20 points Maybe at least you understand what you're up against so If you haven't got that far then then you really are behind at this point in the assignment I know that's hard to believe You know in the assignments that we've given you you be before there's no way to be behind until like two hours before They're due right, but you're actually behind You know like under three weeks left to go This week as I suggested I would I would focus on finishing the file system system calls again To the point where you can pass the file only test and some of the other tests to pass to that point Which would leave you a couple more weeks for doing the process related system calls We're actually quite a bit more difficult. There's more code to write In the file system ones as you guys are understanding you're sort of connecting two interfaces You're essentially writing You know a code that's sort of connecting the system call interface with the lower level VFS interface and a lot of the code that's there is already written for you When you get to the process related stuff, that's not true, you know, you're writing those from scratch Okay Any questions on assignment? to logistics blah, blah, blah, but I mean this is all Going to work. This is how we're gonna do things from here on out There's really no changes to how you submit how we grade things blah, blah, blah Next target is assignment two or two point two. I think you can use both and And Off we go. All right, cool All right, so let me I just want to just a quick public service announcement today About how sort of people treat each other when you work in groups When you're in a class together when you're on the forum, so let me put it this way There's like an exchange rate between being an asshole and being good at something and that exchange rate is really high Like you have to be really really really really really good at something to get away with just being a tiny tiny little asshole from time to time Okay, so think about how you're gonna allocate your resources here, right and and you know to some degree I can confess I've performed this experiment, right? It didn't didn't work So the the point is that what matters at the end of the day what matters in the day is You know, did they come away with a good impression of you? Maybe the impression they came away from of you is that you can't do that particular thing That's fine. That's an okay impression. That's a positive Since a jerk, right? So just don't do that. It's not that hard It is it is hard a little bit because again, remember you're overestimating how nice you are about things, right? You need to round up a little bit there. All right, so just you know, please keep this in mind that you guys work together Work with your partner communicate on the forum and things like this This trust me like you talk to people in tech They don't care how talented you are They will not hire you if you have a some sort of problem get in along with people and in the way you treat other people They just don't want that. Nobody wants that. It's not fun. Okay Questions from last week's material any lingering doubts. I don't know what was covered because I wasn't here Interrupts, threading, context switches, so it all makes sense Carl, Carl preached the truth He brought wisdom. Okay, good So I think where we left off is talking about threads and thread states So the thread is this abstraction that we use to represent the state of the CPU when I context switch a thread off the CPU I need to save some information so that I can restore it later When we think about threads and this becomes important when we talk about thread scheduling The threads in the system are in one of several states at any given point What's what are some of the states that they can be in? What's an obvious state? Running so what does that mean? It means a thread is actually executing on a core Remember a thread thread can only be on one core at one time a process can have multiple threads So a process can actually be running on multiple cores at one time, but the thread is only running on one core at one time So a thread could be running Executing instructions, you know do doing business. What else? Sleeping so so what is sleeping or waiting imply? There's implication here If I'm waiting or sleeping What has to happen? Well remember if I'm not running that I'm assuming I performed a contact switch where I can get myself off the CPU, but but what? What has to like? So so from a scheduling perspective, can I pick a thread that's sleeping and put it on a CPU and run it? Yes, no Yes. No, I Hear both. I like this confusion Carl's not perfect. I thought maybe I just let Carl do the rest of the class But clearly clearly Carl has left some seeds of doubt. It's probably my fault in the slide. It's not his fault Waiting so can I take a thread that's waiting and just run it? Yeah Right, so threads that are blocked or waiting are stuck they cannot run they cannot run until something else happens What are some examples of that thing happening? Lock right so imagine I'm using a lock to defend a critical section I cannot let a thread continue until it acquires the lock if I do then the critical section is broken So the thread that is sleeping on that lock cannot run again until that condition changes. Yeah No, usually usually I could but that would invalidate something that I want to happen, right? So for example, give me another example of what I could be waiting for so if I'm waiting for a lock And I just jump in there and start executing I'm inside a critical section probably with another thread Right, and that's the exact reason I created locks in the first place was to avoid that. What else could I be waiting for? What's that? Okay, yeah, so give me give me an example waiting to print something. That's awesome I've never thought yeah, so so what would happen if I if I was waiting to use a printer and I just jumped in and started printing I Have no idea actually, but it probably wouldn't be good for the printer Right like jarbled stuff would come out or whatever If you ever guys printed raw post script before every department has somebody who does that periodically And there's like thousands of pages with like two characters on each line, you know, anyway No, yeah, so so but more common for an OS level I might be waiting on like a disk read or write to finish so I said, you know remember sys write I've got a buffer. I want that printed if I'm reading. I've got a buffer. I want that filled I don't want to continue to execute until that's true because if I start running the buffer doesn't have the data in it That I wanted just got garbage so threads that are Blocked cannot run right something else has to happen in order to free them The other the other state that's interesting here is ready So a thread that's ready can run but it's not running and So why do I end up with threads that are in the ready state? What has to happen? Before I get threads that are in the ready state. I mean threads can block for all sorts of reasons I owe blocks, you know timers all sorts of reasons Why do I end up with threads in the ready state? What's that? That's how I get them there But what has to be true in order for a thread to be in there to be threads in the ready state? There's a there's a property of the system that has to hold. Yeah, you're close, right? Just because all cores are busy doesn't mean anything's in the ready state. I need one more thing to be true I need another thread that's ready to run, right? So when the number of threads that can run is greater than the number of cores that are available I'm gonna end up with threads in the ready state and so to some degree the the process of thread scheduling boils down to How do I move threads between the ready and run state? So that the whole system makes as much progress as possible All right, and and you know and and we can think about some of the the transitions here, right? So a thread goes from running to ready So what happened here? Gave it away remember it goes from running to ready so it's running and at some point it gets stopped But it's still ready to run so what had to happen here So I'm gonna cut like hi It was this was what we call Descheduling the the kernel said you've run for long enough performed a contact switch That's the exact mechanism that I used to get it off of the CPU and put it in the ready state, right? What about this running to weighty now note that these are two completely different transitions Right a threat can go a threat can be running and suddenly the OS says you've had enough time I'm pulling you off or it can go into the weighting state. What triggers this? Some sort of action that the thread itself took I tried to do IO. I tried to grab a lock whatever, you know So this is you know a thread performed some sort of blocking operation It could have been a system call it could have been some sort of synchronization primitive I was trying to use inside the kernel whatever right and so the difference between these two is that in the top case The kernel is doing this to the threat the kernel says you're done. I'm going to schedule something else There's a few cases where a thread can ask to be Rescheduled through something like yield, but that's rare We use that you probably you guys have seen that in our test cases We use that in our test cases to try to get a good mixture of threads at the beginning But that's not a normal thing to do right normally a thread wouldn't voluntarily say oh, I don't need the CPU Somebody else should go ahead, right? But it's aren't like that. Remember they're male. They don't do that All right, so running a waiting a thread before the blocking system calls So that's something that the thread itself would do right that would cause it to not be able to continue It gets put on a queue somewhere and it and it off it goes waiting to ready So a thread was Waiting for something and now it goes into the ready state. What does this imply? Whatever it was waiting for happened. I was waiting for IO to complete. It's done. I was waiting to get a lock I have it whatever And then finally ready to running This is the scheduling operation So a thread was scheduled again. Remember what I said before Scheduling is adjusting what threads are in the running state and what threads are in the ready state and the way the operating System does that is it moves them back and forth as needed. What's the mechanism just a little bit of review from last week? How do I perform these transitions? How does the operating system get a chance? To move a thread from the running to the ready state. I Mean I'm a thread. I'm running on the CPU. I'm happy off. I go I'm not going to yield. I don't want to give up the CPU ever. I've got important to just apply the compute How does the kernel get control? How does the kernel get to run? How do I get to yank that thread off? Timer it drops, right? So did these top two things correspond with preemptive scheduling? It means that from time to time as needed the kernel is going to preempt the thread that's running move it out The CPU and run something else. All right Running determinate it. I can I can exit or hit a fail exception So that's how the threads leave the system, right? And then if I was wanted to be really accurate you put fork on here or something like that a way to create new threads all right Okay, so scheduling is the process of choosing what threads to run So moving threads back and forth between the ready and and the running queue And you know one thing that you might think is interesting is is I have machines with more and more cores The this this question is is more interesting There are some interesting features to multi-core scheduling that we're not going to talk about but on some level multi-course make Scheduling a little bit easier right because on a single core machine if anything is working I always have a problem because if once I have two threads, I have a scheduling problem How many threads do I need to have a scheduling problem on it? How many threads do I need to have a skeleton problem on an eight core machine? But it's even more than that's nine that are actually ready to run Keep in mind a lot of threads spend a lot of their time blocked waiting for network packets to arrive or for you to type a key Or something like that I mean bash spends most of its time waiting for your slow fat fingers to type in keys Right, that's what it spends most of its time doing just sitting there waiting for you If you ever look at the CPU time of bash the the amount of time It's actually been running is tiny tiny tiny fraction of the amount of time you've been using it because most of time It's sitting there waiting for your slow fingers, right? Especially if those of you that can't type very well so Yeah, so scheduling, you know And so I need to have a scheduling problem on multi-core machines I may not always have all right and and we're going to talk primarily about multi single-core scheduling There's some interesting features of multi-core scheduling. Maybe we'll get back to that at some point Particularly when you start to think about caches and locality and stuff like that But but you can think of the problem is simply you can reduce the scheduling problem to single-core scheduling And it preserves most of the interesting features. Sorry that we want to talk about All right, so why does the kernel? Have to perform scheduling like why is this our problem? Yeah, I mean, you know the Wind once we have more threads than we have CPUs. This is CPU multiplexing. Remember, this is the kernel's job You guys talked last week about how no kernel the kernel gets this privileged role on the system It runs first, you know, and it becomes the gatekeeper for how everything else gets access to the system And so this is our responsibility along with that privilege of you know making these decisions comes the responsibility of trying to make them Well, and you know bad scheduling can really reduce application performance. Yeah Yeah Right Yeah, and and I think the question has to do with Multi-threaded processes and how do I accommodate those? I mean on some level what the kernel is scheduling our threads So if a process creates a bunch of threads those threads are being scheduled independently now, that's not entirely true I mean, I have to think about fairness issues between multiple processes and I also have to think about There's some consideration played in certain schedulers to the fact that two threads are from the same process, right? They might run better on a core that has better cash locality or other things like that, right? You could you could do that Yeah, but but on some level remember one of the reasons of having multi-threaded processes is I want to take advantage of this concurrency Right. I mean the reason that a lot of new languages give you a lot of concurrency is because I want one process to use all of the cores Right. I mean, that's one of the cool things you can do with languages like go is I can very easily create Single programs that make really good use of 8 cores 16 cores 32 cores, right? If all I'm doing is running one task from any process or one thread from any process that I lose that, right? And again on a high-core count machine if there's nothing else to do I might as well let your process have all the cores, right? Yeah, it's a good question, but yeah, certainly multi-threaded Processes complicate this a little bit further, right? All right When is so so going back to our thread say transitions? When do I have the chance to make scheduling decisions? There's a couple of points, right? And this is sort of good review So when does the kernel get a chance to make a scheduling decision? What's that? Well, that's when I have to make them but when in time do I actually have the chance to Shuffle things around when can I move threads between the ready and the running? What are some of the events that take place? Yeah, please Yeah, what's an example something that would generate an interrupt that would give me the chance to do this So the timer interrupt that I set up to enable preemptive schedule and absolutely like that gives me that's remember What I do to make sure that I have a chance periodically to reschedule threads But what else do threads do that give me a chance to do this? They do they do blocking system calls and other things so anytime a threat makes a system call It doesn't have to come out You know it can make the call and that call might be like get paid It might be something that doesn't have to block at all, but the kernels like aha This is my opportunity right you're running in the kernel now and if I want to I Can move you on to the ready queue and run something else, right? But certainly anytime you do anything that sleeps when a thread does a blocking system call I have to run something else I've got nothing else to do that thread ends up on a queue waiting for Io to come back and the kernel has to Choose something else to run so that makes me make a scheduling decision If I have a timer that goes off that's a way to grab control from threads that aren't making system calls It may not give me that opportunity What happens when there's nothing to do? It's something I've never covered before in the slides, but maybe it's not obvious Anyone know What's that? Well, yeah, hopefully right there's like ghosts in the machine that get a chance to run It's like ooh now that's steady at home. It's built into your machine. It runs in the background all the time Yeah, there's usually something called the idle idle thread or the idle task I think on sys 161 that just consists of a bunch of no ops on on modern machines if that goes on for long enough The kernel may decide to turn cores off It may say I don't have enough work to do so I'm going to power that core down Saves some energy Particularly on battery powered devices, but it's usually some sort of meaningless little calculation you can find in every kernel that just kind of like sits there either doing nothing or Sometimes that you fire a timer periodically so you can wake up again and see if there's anything else to do But you basically just sort of go into some sleep. Hopefully nothing else all right Okay, I'll set that so And what I just said, you know, I mean in certain cases there are places where particularly in user space thread libraries It's useful to call yield but The modern kernels don't depend on threads calling yielding voluntarily giving up the CPU So there are on most systems ways to say you can you know, I'm not I didn't do a system call But hey, here's my chance. Here's your chance to de-schedule me if you need to All right, and then you know and some of this you guys already talked about so we talked about the mechanisms of how we do scheduling We do a context which and we just moved the thread around internally So we need to keep keep track of what's going on, but this is all based on stuff that you guys talked about last week Now how we do this is what we're going to talk about today and on Wednesday, right? How do we choose which which that's right? All right, this is the first example of something that we're going to see Repeatedly like I said before I mean we usually build up We start with the mechanisms in this class and then we get to the point at which we're talking about policy But one of the things that's really important to notice is It's usually a goal when building complex systems to try to separate the policy and the mechanism as much as possible a Well-designed system gives me mechanisms that allow me to build lots of interesting policies What happens when these two get intermingled is there's something about the mechanism that? Biases the system or maybe in you know There's there's something that causes it to behave a certain way That's built into what I'm trying to do and I can't make as intelligent decisions on top Does this make sense have people talked about this before? Paul has anyone ever heard this before? Heard these two words in the same sentence all right, so this is also connected a little bit with Good interface design, which we talked about in the past I Good interface tries to make sure that the mechanisms can change while the policies are described by the interface and not not changing You know deciding what okay, this is a stupid slide right so these were examples of policies and mechanisms There's a making decisions about which thread to run. That's a policy The ability to move threads around is a mechanism, right? What about maintaining cues that have different threads in them? Is this an example of a policy or a mechanism? Who thinks it's a mechanism? Yeah, this there's no scheduling policy Described here. This is just bookkeeping. It's just making sure that I don't lose track of threads I don't accidentally like forget that a thread existed and like it vanishes into the ether or never runs again, right? Because that would be bad About what about if I try to give preference to interactive tasks? It's a policy and you can think about I mean giving preference to them involves Performing context, which is at the right time and moving threads between those cues in a certain way About using timer interrupts to stop tasks as they're running It's a mechanism this allows and on some level This is an interesting mechanism because it gives me ability to to implement certain types of policies If there was no way for me to stop like a runaway Thread that started to compute pi or something like that Then the policies that I would implement in the scheduling would be different What about choosing a thread to run at random Policy or mechanism? Yeah, this is a scheduling policy. It may not be a very smart one, right? But it's still a policy about how I choose threads to run Alright So let me try to emphasize how important CPU scheduling is You guys may have never thought about this before but in order to do pretty much anything on your machine Something has to run It doesn't matter if it wants to send network packets Use the disk draw to the screen You know detect keystrokes whatever it is the application has to run on the CPU Does that make sense? I mean there's there's no like Mystical magical ways for a sleeping thread to be like let's draw some pixels to the display That's not what happens sometimes you can put things in a buffer and that happens later But there's there's this process by which the CPU starts to gate every other resource on the system So in order to do anything I have to get to the CPU first now frequently All I'm doing is I'm getting to the CPU in order to tell some other component to do something And then I'm going to end up on a waiting queue or whatever, but I still have to run Right. There's no way to kind of like there's no way to get around this So the CPU ends up being sort of the top level gate to every other resource on the system Now like I said, it's it's common that what threads want to do is just use the CPU So that they can get to some other thing and they go to sleep And that observation guides some of the scheduling policies We're going to talk about right this idea that a lot of threads don't want to do lots of computation They just want to use the CPUs so that they can you know write to the disk or you know Take some data from the network and move it somewhere else, right? I've just but I still need to run Now And I wish we could do this experiment. I wish there was like a I don't know Maybe if I ever work for Microsoft again I'll convince them to put some like crappy scheduler mode on their computers, right? So you can see what really bad scheduling is like right because that would be fun Right like turn you see how slow your computer can feel right?  It's like you know you hit keys and it's like oh there goes the screen, right? So there's no reason for that because I know that this is like a super powerful machine It's just bad software somewhere right so trust me if you want to come use my system sometime and get a sense of like What several thousand dollars worth of CPU will buy you in terms of poor interactive performance go for it, right? But again, this is my this is my proof because that machine should fly and it doesn't always It like sometimes like even the browser windows slow down. I'm like what is going on down there? Like what are you doing? Maybe there has a virus who knows? All right I'm gonna focus our discussion today on interactive expectations for computers We'll talk a little bit about servers along the way, but that's one big Sort of gap here when we start talking about how we allocate resources between different types of machines I think it's more interesting to talk about interactive performance because you guys experience it in a visceral way Now with the cloud and things like this.  What do you guys expect from from your machine? Another way to address this question is How do you notice that something is going wrong? All right, sometimes we don't understand our expectations until they're violated So what's something that your computer will do that you find really annoying that makes it very hard to use? Yeah, damn All right, so like unexpected high CPU usage, right? But what is that typically accompanied by? Because on some level okay, it's a little annoying if the fan is on right, but what else is happening?  Okay Got some curmudgeon's over here. Just let the fan run sometimes the fantasy wants to run You know like I've been I just need to get going it kind of loosen up a little bit Yeah, yeah, so like okay startup delays, right? You double click on an application. It takes a long time to load Okay, what else what about as you're using an application, right? Yeah Yeah, like this does well, that's usually buggy code, right? That's usually not the result of bad scheduling But what's like what's something that happens on these devices?  Does anyone sorry I'm gonna just yeah Yeah, yeah, let's get there But yeah, so so anything where it's like it's hard to and you guys have gotten the point where it's like hard to enter text Because it's like a little bit laggy like you click somewhere and you think it's working But then it doesn't or you click again, and then you get two clicks, you know So so my little story, but does anyone shop at Wegmans here other than me? Okay, does anyone use those things in the produce area where you can put the those things are terrible, right? Maybe it's just my store, but like you hit the key and it's like Wait, where am I I'm still in a grocery store. All right, okay Like I'm supposed to let you you're sitting like what is going on like and then of course You know I've hit the key four times by that so it's like four four four four, and that's like asparagus or something like that It's like no, it's not what I have right those things are miserable I don't know who made that but that's like if that's what you build when you go out in the world Like don't do that right don't be that person like somebody's responsible for that code Okay, and it will be fun if we could get a hold of that code to make fun of it Of course we can't we just make fun of what became but think about it like Anyway, whatever I'll stop here, but my smartphone is more interactive that thing I guarantee Wegmans paid like a thousand dollars per unit for those things. Yeah, I haven't used those I don't use the self-check on right now. They only there those are new it Yeah, those are new at my store and you have to have under 15 items. I never do that, but yeah But I hate those products But yeah, so we expect responsiveness right when I click on something I want either one of two things to happen I wanted to do something do the thing I wanted or at least I want some visual indication that something is happening And you might start to notice this when you interact with your machine all the different little visual cues that it gives you that Something is happening right the button background changes color a little bit like even if it takes a second for something else to Happen that's still indication to you that okay. I heard you I got it you clicked on that thing I'm working on it. You see waiting indicators other things right So here's here's another expectation right so so YouTube movies I mean how many people have ever experienced interruptions in their YouTube movie, right? I'm watching something and then suddenly in the middle it stops like that is I don't know why it's kind of irrational But that's like one of the most irritating things that the computers can do right is like that would like right in the middle Of like a really funny joke, and it's like or buffering, you know So that's not good There are certain cases, and this is for certain types of behavior where we expect computers people to continue to do something Sort of reliably over a long period of time, okay And then the last thing is this idea of being able to complete certain tasks So like compiling your code, right now that may be at the If most of your machines are fast enough that a lot of compiles become like a almost like a responsiveness thing Like is it done yet? It's been two milliseconds, right? But on older machines It was like I fired up my compilation of the Linux kernel and then I went away and I got coffee and you know I did some shopping and I came back and it was still going right But I actually do want that thing to finish right and and whether Whether it takes ten minutes or ten hours is kind of important to me, right? Does anyone do anything with their computer that falls into that category? Does anyone ever got in the point where like you're really praying for like a 2x speed up Like a 2x speed up would really help me right because it would mean like a week to three days You guys got to find some cool stuff to do with your computers, right? Yeah Yeah, yeah, so Ed builds Android platform The Android platform for our phone lab phones and that can take like what an hour Hour and a half yeah, so imagine if I could get 10x out of that it goes from being 90 minutes to nine minutes Right like that introduces a new development cycle into my life, right? Okay, so responsiveness So this is probably I would argue one of the core components of good interactive a good interactive experience, right? You don't even have to finish the thing that I asked you to do I just need to know that that we're on the same page, right? If I'm typing if I'm trying to click on stuff if I'm scrolling down a page, right? I mean the ability of the machine to respond to these type of events is really critical, right a Lot of what we do with our computers consists of these type of interactions To some degree right once you guys find the YouTube video that you want to watch then it's more like a TV But getting there and doing other things online. I mean that's kind of what distinguishes computers and television, right? And again, it might not finish right away But the idea that my input has been accepted and the computer is working on it and I understand that is really critical So examples of responsive tasks, I mean you guys already mentioned a couple of these Clicking on stuff right when you click on a link in a web in a website, right? You know it may take a minute to load that new web page But there's a series of signals that the web browser is sending me that this is what's happening, right? So I can avoid clicking on the same place a couple of times Same thing with editing, you know moving around in an editor typing these types of things You might think this is kind of basic But if you think about all the work that your editor has to do to do syntax highlighting and layout and all sorts of things This can actually be be a little bit of an issue not for me I use Vim right which does end of those things, but if you use like these fancy new editors Actually, I started started trying to use Adam recent lives like this is a little laggy like that's not good I don't like that Anyways, but yeah, if you use like a very very dumb editor doesn't do anything But modern editors do and so there's a fair amount of work that they're trying to do behind the scenes Same thing with chatting text messages hang out stuff like that, right in any delay that you introduce into this process Is is problematic, right? so So what's the what's the sort of scheduling goal that comes out of this when you guys Input data when you guys click touch tap whatever it is the computer should should jump to right something should happen and There's a there's a very very sort of short timer that goes off in your brain when you click on something Where you're starting to expect something else to happen and when that timer goes off or goes off ten times in a row When I'm at Wegmans, right like you start to get very frustrated all right Continuity so when you ask a computer to do something and continue doing that Thing over a long period of time now. This is an erase Okay, that's the difference between this and the next task You don't want to watch the YouTube video as fast as possible, right? You're not asking your computer like download it and show it to me as fast as you can, right? You're saying for the next half an hour I want you to at intervals Continue to fill the frame buffer and deliver, you know smooth video or smooth audio if you're using things like spotify And and there's there's there's some active waiting involved here, right? There it's not the same thing as click where it depends on your input But you guys notice when this breaks down, right when the spotify fee goes out or it starts to get a little Jumpy or when the YouTube videos starts buffering or whatever or when there's a little bit of jitter in it I mean we're pretty sensitive to this So so we'll notice this Blinking cursors does anyone still use a blinking cursor? No one Of course you do everyone does Okay, good There's this whole you can if you Google blinking cursing you could find this whole web page about how blinking cursors are like the equivalent of Chinese water torture So maybe they finally got rid of them in most places I think a bunch of for a while still came with blinking cursors and you had to like Issue these magic spells to get it to stop But yeah, but blinking cursors. I mean have you guys ever looked at your machine and see the cursor Blinking get a little wanky, you know, it's like Yeah, yeah, you know see if you use it just goes up Anyway, I mean, maybe that's just me maybe there was something else going on when I was looking at the curse Anyway, so like playing music playing movies, you know again You know little stupid web animations, right ads that run on the side of websites I mean these are things that we expect there to be the smoothness of purpose now again These are not necessarily loading the machine down in every minute But there's this expectation that I can schedule little bits of work Periodically over a long period of time and and make sure that certain invariants are met All right, the last thing here is this idea of completion so the idea that I'm going to be able to give the computer some work to do and The work's going to get done eventually Now you may not be even aware of this happening You know a lot of the things that the computers that we use are doing passively are not necessarily things that were even Cognizant of you you may notice when they stop happening if they don't happen for a while, right? Now like I said, I mean these these may not be things that you're starting But these are the things that computer is doing periodically Anyone give me some examples of these like a long running background task something that should finish That the operation of the computer is predicated on it finishing, but you may not really realize this happen Yeah, okay, that's fair window software updates, right? I mean like those usually notice because there's 82 pop-ups that that are generated and warnings and stuff like that But yeah, I mean if your computer stops getting Windows updates for a while There's gonna be like angry red messages flashing everywhere right and eventually Chinese hackers or Russian hackers or Hackers from somewhere are gonna have control of your machine So okay Windows updates. What else? Legal torrenting I like that. I mean I mean illegal torrenting also falls in that category. I'm just gonna point that out, but I like I like that like a legal torrenting Torrenting of which I only perform the legal variety. That's that thing, right? Yeah. No, that's a great point, right? And and here's the thing about torrenting. I mean torrents to some degree the existence of The the torrent ecosystem relies on people not noticing that they finish right because you're supposed to not notice and then you're gonna seed for like 30 years until the FBI shows up, right? Like that's how torrenting works System backups does anyone backup their system? Okay, well anyway Okay, let's put it this way restoring your system without a backup good that that you'll notice, right? Indexing files this one of the things you guys don't even there's anybody use spotlight or the windows Does windows still have like a dog that comes up to help with things or is that? See you guys are so young. You don't even remember that come on. There's like a whoop whoop. Hope you find things It's like I mean it's like a The thing I never figured out is dogs are not good at looking for things Dogs are good at like fetching things. I have a dog So I know I first-hand knowledge like knowing on bones, but why they thought a dog was like good Oh, go look for your files.  It's not gonna help you find files But anyway, I mean does windows still has that right like a fine files thing like the way these things work is they build indexes constantly, right? Spotlight or whatever the Mac thing is I mean it doesn't actually go look at your files every time you type a search query that'd be way too slow That'd be like Google being like oh you entered something into my search engine Oh, okay Well now let me run my web search indexing and find all the no it's not how it works. I mean it's all done before him So yeah in file indexing Antivirus software falls in this category. That's running. It's doing things, you know, you might notice if it stops But you don't notice it's happening. Okay So a lot of applications, you know on some level build Multiple of these expectations in some music player is a great example or I no one uses music players anymore This is all just web browsers web browsers web browsers, right? So but imagine a music player page loaded into your web browser I hit click Well, what's a click type expectation for a music player? What's the place where I like I wanted to do something based on my input? Yeah play stop You know imagine if it hit stop and it was like I'll cue that later, right? You know like yeah, you got some song player I'm like I'm in here playing a song and the mad guy from geology comes in It's like I'll get to that later like what's I'm done with my file indexing. Oh, yeah, so responsive, you know Change tracks. What about like a continuous sort of thing? That's obvious, right? I mean playing that playing the track itself That involves a series of actions that have to be continued a period of time Updating album artwork building indexes of my music collection stuff like that Oh, these are all sort of like long-running tasks that get done in the back web browsers are obvious, you know This sort of thing all right Now the the thing that makes scheduling fun Okay, the fundamental core tension between scheduling particularly on interactive systems is balancing two goals The one is the ability to respond to new things and the second is the ability to get things done and Make best use of system resources in order to accomplish a lot of things at once So if you if you do optimal resource allocation It's very difficult to meet deadlines because meeting deadlines Requires that the system constantly be ready to drop everything and do whatever sort of weird new thing That you told it to do so imagine your system is constantly like, okay I'm gonna plan for the next 10 minutes like here. So I'm gonna lay out the CPU here So I'm gonna lay out disc here's what I'm doing with an artwork. This is awesome. I know exactly what's going on Oh, no, we switch applications, right? Like and you're doing this all the time, right?  Right? I was just on that other website So, I mean, you know, your your unpredictability is something that the system is constantly trying to try to keep up with You know and responsiveness it has these unpredictable deadlines whereas continuity has these predictable deadlines, but again your your Unrisk, you know your unpredictability be can be constantly changing the mix of system resources and causing the system to focus on new things, right? I mean Switching pages in a web browser is a mild version of this right the extreme version is like you've been using chrome It's only we'll launch Photoshop. It's like, oh my gosh. What just happened. I mean, there's a totally different thing, right? So the the tension between these is what makes this interesting, right? It's what motivates some of the schedule in the algorithm to talk now, you know on interactive facing systems The preference now again, this is where we this is where the goals of servers and user-facing systems diverge slightly This idea that on an on a user-facing system deadlines typically win, right?  You know, you know no one and the other thing that you guys don't care about is How well the system is using the resources it has, right? Like you don't care if the system is using all its RAM that means nothing to you, right? Does anyone has anyone ever noticed that like you guys measure this does anyone care? Okay, I've got two hands up, right? Yeah No, the system should use all its RAM But I don't want it to use its ramp at the price of not paying attention to me, right? Like you're supposed to use the RAM in service of this goal to be honest If my system can do all this with one stick of RAM, I don't care like don't tell me because I bought the other seven, right? But yeah, I mean to the degree that the system could do meet its deadlines and do the things I'm asking in a responsive way Whether or not it's using its resources is totally irrelevant and you guys don't care. You don't track this You know and here's the fundamental difference, right? And here's what makes this fun, which is that your time You know my my just like with my dad the other day and he's convinced that like robots are going to take over all of your jobs Okay, he's like I'm really glad I'm retired because he's reading some scary book about robots and You know and okay, fair enough. I mean computers are really powerful That's a good thing to think about when you make life choices Like if you can do a job that can be easily replaced by a computer. I would probably find a new career, okay? But right now your time is still way more valuable than your computers You know so when your computer is wasting your time, that's when you get frustrated, right? When you're trying to do something that you think should take just a few seconds Like I just want to send this text message and it's like hangouts is loading loading. What is going on? I just didn't do what I want The wasting of computer time let's put it this way There is a lot of computer time out there to waste, right? If you want to waste some computer time this computers have time to waste, right? All these phones that you guys are using they sit there at night plugged in for eight hours doing nothing, right? I mean if you can figure out how to get them to cure cancer in that time Please do that right because they've got they've got scores to kill like Google is like desperately trying to give away CPU cycles Because they've got so many machines in their data centers to handle diurnal fluctuations at night They're not doing anything right again if you have an algorithm to solve cancer and you need 10,000 machines We will find those machines for you. It is not hard, okay? There's a lot of a lot of power out there in the world and it doesn't matter if a little bit's wasted a lot of its wasted Right software is terrible. Okay software waste a lot of cycles, but it doesn't matter because there's a lot of cycles to waste Okay So before we almost done I think we're almost done before we finish up today. Let me let's go through some Scheduling goals, right? So this comes back to our expectations How what does it meet deadlines both predictable deadlines the deadlines that you know? I can imagine in the future because I know periodically I have to wake up to fill the audio buffer and unpredictable deadlines you deadlines that are created by your stupid fingers touching things right or moving mouses around or Talking to your computers. I guess people do that now not me, but How completely does the system allocate resources again? I don't want it when I have really Beefy stuff to do. I want to make use of all the resources in the machine and On human-facing systems deadlines way on servers not always right, but you know bring this into the cloud errors, right? So why why are cloud servers now potentially a lot more interested in deadlines than they used to be? There's actually a fair amount of deadline attention now being paid in big data centers, why? Yeah, I mean there's a lot of applications and websites that are built based on cloud backends, right? So that cloud API call that's in your interactive loop, right? When you guys use discourse like the way discourse works is it loads of web application in your browser And then it's making API calls to the back end so that thing may think it's a server But when you click like click new post again that latency is now inside of your brain, right? It's not hidden back away in some dark room, right? You're waiting for a cloud server, right? And understanding how that latency fits in to the other forms of latency on the device is actually something that people are Still working really hard on all right, so We're not going to talk about real-time scheduling any questions about this So on Wednesday, we will talk about some simple schedulers. We'll talk about some ways to evaluate their performance And then we'll talk about some slightly more sophisticated schedules and on Friday. We will talk about obscene scheduling