So Very much here. This is about real time is coming to Linux now You might be all laughing about that because we've been saying that since 2004 Maybe that 2004 I think we were saying it about 2008 so as a whole joke was you know This is a year, you know real time is going to be merged into Linux It was like saying this is a year that you know Linux is going to rule the desktop It was equivalent This time we actually mean it and how do I know we mean it? and how I know we mean it this time is the fact that all our focus is our talks our Meetings are not about what do we need to do to get real time into Linux all the meetings are now like oh crap We're getting into Linux The job is not done Not the fact that it's not done that there's not more work to do to get into Linux It's saying that our job is not done is once it gets into Linux There's a whole new set of problems that come up one thing is it's now needs to be maintained Girl developers can't break it if it does it's our responsibility to teach them not to break it again So before I go further ado.  That was the first okay So who is this talk for? Well, it's mainly for Linux kernel developers. I mean how many links curl developers are here Okay, how many people are not legs girl developers? Well 5050 I'm actually pretty impressed pretty good So if you do core kernel driver codes file systems, you know pretty much anything that touches the Linux kernel you're This talk is for you And it's also for those that are just curious about what is this weird weird thing we call preempt RT? You know what makes it different It's also for those who want to see how fast I can talk. So what is real time? It's kind of like the question of saying what is your favorite color? So the term is ambiguous I Always hate that term so I looked it up last this morning actually started writing these slides at 5 a.m Seriously, and I went there. I'm like when we're going to talk about real time. Let's see what the internet says about it So I went to one of the most Most common sources of information Urban Dictionary and I got there and says real time instantaneous taking place at once as all other things are also in progress When I survived the situation in real time, there were only four people who met the qualifications Or surveyed the print and sorry I survived surveyed instantaneous and it is blah blah blah Okay, I was actually pretty impressed that from Urban Dictionary. I had something decent Then I went to what is comm and it says real time is a level of computer responsiveness that a user senses as sufficiently Immediate or that enables a computer to keep up with some external process. I Need definitions for that. I continues Real time is an adjective pertaining to computers or processes that operate in real time. I Love definitions that include what you're trying to look up is included in your definition And they actually had more real time describes a human rather than a machine sense of time actually.  By the way, that's another hint why it's getting into Linux We no longer call it the real-time patch because it's not going to be a patch anymore And we call it preempt our tea now means determinism Has nothing to have speed has to do with Knowing what's going to happen? So we care about latency. We always calculate. What's the worst that could happen? Because I always say it's knowing What will happen when it will happen? So that's what really real-time is to us. I Always say this should be not called a real-time operating system It should not be an R toss. It should be a deterministic operating system So what's our strategy to making Linux into a real-time operating system? Well, the first thing is we have to make it as preventive as possible We don't want we want any time a high-priority tasks wants to do something We let it do it as quick as possible So let the user determine what's important and as soon as their Defined task of importance wants to do something it should be able to do it and give it as much You know power as possible and try not to interrupt it in any way So we try to remove preemption interrupts everywhere that we can so we go is have scheduling as powerful or everywhere So let the most important highest priority tasks run when they want to run. That's what we try to do so if you When real-time comes into the Linux kernel and you go do make Menu config and go to processor types and features There's going to be a window that pops up in the preemption. There'll be a preemption model before The first three is only what's there today. You'll see the first three. No force preemption volunteer voluntary kernel preemption and preemptible kernel will see desktop two new things are added and for full preempt RT That's what we get so No force preemption is the old days. I only know does anyone ever run with no force preemption with our config preempt none Anyone do that a couple people. I almost want to say why Voluntary preemption is probably it's like that's mostly the default red hat. I believe sluice sluss Debian voluntary preemption basically any time you hit like a might sleep within the kernel. It will say hey We're telling there was a debugging option put called might sleep to trigger if you had Case where you're in a critical section and you call this function and it might have a path that it might sleep because a lot of Times what would happen is you could run your code and everything's fine But there might be a function with a path in it that will actually go to sleep And you'll sleep while holding a spin lock and your system will crash and we're like, oh, no And these bugs kept boiling up so we throughout the kernel we put these might sleeps throughout the kernel So that if you hit a function that might have some if conditional some strange conditional path to a sleep You'll know right away that oh, we can't call this function from a critical section. Let's call something else So let's fix up our code. So that's solved a lot Well, what they realized was all these might sleeps that are scattered out because these functions can sleep We can sleep there. It's just also told us that this function even though there's one little path that might sleep It means that we can sleep so voluntary preemption took up on that and said hey when we hit this might sleep if There's a scheduling something needs to be scheduled. Let's schedule right there So that's what voluntary preemption is it took this debugging app option that helps save us from They'll calling these might slips and just use it to say we can schedule because we know this function can sleep It's okay to sleep. It's okay to schedule out. Let's let's use it great It actually helped a lot. I I don't think I would love to get rid of serve or none because it's pointless I think they might sleep ones are perfect Then preemptive curl is what we have today low latency desktop. That's where Basically spin locks become preemption points. So when you grab a spin lock it will disable preemption and you could sleep almost anytime You're not holding a spin lock or don't specifically say I don't want to sleep. So that's throughout the kernel So it's actually very very already a lot very reactive. It's basically a soft real-time system But we have two new things so what I'm going to kind of ignore is just the basic the first one basic RT That's more for testing purposes on us But the next one is where it's full preempt RT and this is why we call it preempt RT because that's the config option So if you're wondering why we always say hey It's the preempt RT patch or preempt RT now and not the RT patch This is why because it's going to be a config within the mainline Linux kernel So interrupts as threads You can always do One of the things to help get preemptive kernel is to have interrupts be able to thread because even a long-running interrupt You can't do anything what it's going on. So we have to be able to preempt it So the only way you can make it preemptible is it has to ask has to have its own scheduling context and be able to switch so Request IRQ or request threaded IRQ. It's been there since 2009 How many people have used request threaded IRQ? Hey, good. Thank you. Appreciate it. Awesome Because that's even a mainline kernel. You were your thread is or your interrupt is not keeping Important processes from running. That's that's nice of you Also, if you ever want to do it, there's this thing called threaded IRQs Which was added as a debug option to debug certain criterias where it was really because we want to get our RT Linux our real-time patch into the kernel so a lot of times we would Dress it up as a trojan horse and say hey guys. This helps you so much This is something we always had rationale that had all the real-time patches that may or all the real-time stuff Or all the patches that came from the real-time patch We're basically Hidden as gifts to developers Locked up came from the real-time patch mutex came from the real-time patch Let's see generic IRQs the IRQ making all the IRQ systems basically Into core architecture it came from the RT patch This was because we couldn't do RT without it But people like to code like hey, this makes things cleaner because one thing is real-time patch requires Clean code so our gifts are cleaning up code to give to you So but this one was kind of like hey You could debug your system with you know making all your threads or all your interrupts threads That way when so if you have something crashing you could debug it easier. That was our rationale That's what we said But almost all threads everything becomes threads except for maybe no if you mark especially market to say no thread And those are timer interrupts IPI processors don't get saying I this my interrupt is so important I don't want it ever to be a thread because people will hate you for that. Just let you know Normally no handler is basically so you have a high priority task This is why we don't like interrupt handlers that are not threads because you'll preempt of the task The handler has to finish and boom so when you request an IRQ you'll get you give it a single Function called hand or a handler which is a function that's going to run when your interrupt vector is triggered When you do a request thread at IRQ you're given a handler and a thread function now the way that happens is when your handler takes Executes It'll go up do the handler in this way if you want to shut off your device because say if you have shared interrupt line then you have like a big law if you have a One of your threads or your handler takes a long time shared with other devices You may want to run it as a thread this way you could go Acknowledge your device and then go away and just do your handler Amazing enough. I searched the kernel and very very few People do this which is actually a good thing. I'll explain why in a second When you do forced threaded interrupts, which is basically when you enable preempt RT it does force the force threaded interrupts becomes on and What that does now is there you have the interrupt triggers you can't stop interrupts You know the hardware has that's a mechanism of hardware so you trigger interrupt and you say okay all it does the interrupt says okay, we're going to With disable that interrupt line and then wake up the thread for the interrupt thread to handle everything else so basically all we do is turn off the line so no more interrupts will come in and We wake up a thread and that's all that so I would have made that smaller the interrupt smaller But then the word interrupt couldn't fit in there because it's really actually this isn't this is not to size It should be a sliver So it was off boom right back. So it's really really fast. You know a microsecond at most Then it runs to your high-priority task and when your priority tasks you schedule now Here's the kind of interest interesting thing if you use both I say if you have a top half and a bottom half Now it's I'm like I'm sorry But you're going to have to scheduling search because your top half is still going to run as a thread And your bottom half is still going to run as a thread So we were working on ways to make it run as maybe a single thread You know, maybe so then get rid of the schedule switch. We have to we're looking at ways of fixing that But for now So we enable preempt RT. Here's the big thing. This is the big hammer This is what's getting into the kernel and this is exactly what we mean by real time is coming into Linux It's the it's the option. We've been all dreaming of Turning spin locks into mutexes They're not really a spin lock anymore. Are they? So they don't disable preemption. They don't disable interrupts Even if you tell it to disable interrupts if you do spin lock IRQ or spin lock IRQ save nope It's the same as a spin lock same function. Boom So, how do we do this? Why do they do this? Well The reason why spin locks disable interrupts if you do spin lock IRQ save or spin lock IRQ the reason why you do that is if you have an interrupt or a spin lock spin that's being shared between Thread context and interrupt context so if you were to take a lock and not disable interrupts and your process gets preempted or not more Interrupted by interrupt the handler interrupt handler runs and it grabs the same lock. Boom deadlock. Don't want that so This is why we don't need to disable interrupts Because everything's a mutex everything's schedule. So you take your lock your handler I should have made that smaller again. The handler is less than interrupt. I could have made that shorter. Okay. I was lazy Remember I started this at 5 a.m So he takes up the handler only thing is wakes up the thread say this time. It's not a high-priority process going on So the product the thread the interrupt handler goes right away and it takes the lock But the thread that had it The thread that it preempted or yeah, it's yeah preempted now not interrupted preempted and scheduled had the lock So it has to block so it schedules out it can interrupt handlers can now schedule out you run your task Once it releases a test releases the lock schedule back in your thread So priority inheritance Right now we have priority inheritance within the kernel, but it's only for few ticks fast user fast use space mutex When you do use p thread mutex attribute So if you use your if you use p thread mutex within your application, and you were to say turn on the attribute Pryo inherit you actually get priority inheritance now explain that Preempt RT does that inside the kernel to all this mutex is all this sleeping spin locks and to the mutex So my talk can't be complete without me doing these slides I did this this slide is actually for my first time I ever talked about real time It's been every single talk of mine. So it's like me taking that picture where the battery died So normal the best Example of where this could go wrong Came in 1997 The Pathfinder flying up to Mars They got it started resetting it would suddenly would reboot And they didn't know what was going on, you know got to Mars it would reboot every so often reboot And like what's going on these things just normally going on it would they lose communication for some time And then suddenly it would reboot and they would get communication back and this geared them So they took all the code and they they were able to simulate the exact same things I was going on up in space down in their labs, and they found out what was happening. They had this Process a very very low rare process that seldom ever ran and let's say it's process C That's up on the chip and this process would just collect meteorology meteorological. I can't pronounce the word meteor data and it would Wake up collect some things to put out to the bus and then go to sleep In the meantime the bus manager highest priority process in the in the On the system would be accessing that bus and we'd have to grab a lock before Would touch that bus and for some reason priority heritance was turned off on that lock Because I think they did for performance reasons and they did it roof. They forgot about this little lowly Task that was sharing that lock And what would happen would be the process when we wake up get preempted The bus manager would go run try to grab the lock. Okay. I got to go sleep go back to sleep the little Logging data continued and then there was an intermediate Process that came in that one runs for a very long time And it started up and it preempted the guy preempting a and now when a was stopped that all bus management stopped And the system had a watchdog timer go off and it did a reboot boom But since things are not things are locked up. We got to reboot the system So the fix was simply send in a pair or send up a little command They were able to upload a little switch that turned the that into a priority inversion Task or a lock and they never had a recent the resets stopped What happened? They so what happens is C goes once a runs in blocks It gives a priority here and inherits C inherits a priority of a so it runs a so when B wants to run It can't so it has to wait so C releases a lock loses priority a runs it sleeps B can now run normal RW locks has been our Nemesis for some time. We've done things. I've actually done. I actually wrote code to make Multiple priority inheritance now priority inheritance people don't like priority inheritance because it's kind of complex, but I Actually even made it more complex people. I don't know if you know me, but I kind of like code That's complex. I usually complex algorithm or complex problems which require complex solutions. I love that I Revolve around it. So I made multiples things and Thomas looked at it says no get rid of it So what do we do about reader writer locks? He's real right locks everyone loves because you think reader writer locks are really really good for multiple CPUs Because you can have a reader multiple readers Grabbing something because reader writer locks are basically the body, you know do a lot more reads then you ever have to write So if you sell them right, you just do a lot of reads you want that all in parallel. That's great So you want that all going on so read a writer lock perfect So each time a reader goes to get to look at the data and read it grabs a lock fine Multiple readers multiple CPUs all group find a Danny a writer comes along It's got a block and wait for all the readers to finish depending on whether it's a fair lock or not That could have issues and but finally when all the readers are done It will get the lock and do its data and then or do its updates and finishing that all the readers come back in again It sucks for multiple CPUs Don't use reader lie writer locks where you don't have to use RCU get rid of the reader Right locks for those of you you guys are hardware guys. This is ELC here. I'm sure a lot of yes ELC people here Cashline bouncing will kill you I could show lots of graphs of performance when you are sharing the same cashline That is now the bottleneck that we're hitting almost everywhere reader writer locks That's a bunch of readers hitting the same cashline. We've actually made spin locks special to do the spinning outside Off the cashline on local memories So we wouldn't have the cashline bouncing that was killing everything So a lot of work's been done to try to make the cashline better because that's what speeds things up again If you use reader writer locks, it's not much faster. You're actually it's kind of It does that it's a more CPUs to get it flattens out So avoid that with more CPUs with RCU. It's still exponential Not really but pretend it is So we compromised We just said reader writer locks or mutex is still so even if you do a reader RW lock It turns into a mutex, but that's fine. They just won't any priority inheritance So avoid it for another reason you can get get priority inversion with reader writer locks now on the RT patch So avoid those paths try to avoid it. We're trying to get rid of it. So that's what we're going That's what when we analyze real-time systems We look at the device drivers and make sure we try to avoid all real reader writer patch paths That will at least make sure that there's no writer involved in any of the Real-time threads or anything But writers do still have inheritance from themselves. They're normal mutex basically The try lock issue The try lock issue Okay, how many people have ever done something like this a few hands you're afraid to raise your hand you should be This is usually what happens is you got this mixture of Work where normally let's say you grab lock B first Say you grab your locking orders grab B grab a and if for anyone That's not a computer science, and you're just here to see B talk, which I think I'm talking very slow right now If you grab B and a always in that order you're fine You're not going deadlock But if you ever have any place where you grab a then B you could deadlock because you know the mixture of B a B a up. We're dead. So we always grab in one order So one of the ways around doing this because there's sometimes there's times You're doing some data that requires protection of a but then you want to do something that requires protection of B You don't want to drop your lock and redo everything.  This is great. Okay problem solved But doesn't work for you know, it's great for spinning locks, but not for mutex's So what you have in a real spinning lock you have CPU 0 CPU 1 so in the try lock You know the CPU 1 takes its lock. It's lock a CPU 0 takes lock B. Now you want to try lock on B so you actually go into this little loop this is you spin while CPU 0 has lock B And you're waiting for lock B.  Hey, we're done. We got B. We go. We're all happy What happens when you do it with sleeping spin locks worth mutex's on a single thread and say if the green guy is much higher priority Then the yellow guy. So the yellow guy grabs lock B We go try to take or we get take lock a oh, we're going to try to get B So we go through that whole magic of release a try to grab a try to grab B again Ba da da da da da da da da da da da and guess what you preempted a Or B or the owner of B. You'll never get that lock. So you'll just spin forever So one solution that's a hack Best is don't do the trick But if you haven't figured out what to do yet Here's one hack that will work for you and that is to grab B after you released a And then release B and then grab a again so How's that work? So the test has be B Test the first test gets B and then you grab a So they try to get B. You don't get it. Okay. So what you do you release a and then take B again No, so you're going to block you're almost guaranteed the block now because you tried a or tried B It's not there you if you preempted the guy your own guarantee the block B blocks Not only that priority inheritance kicks in boom You just boosted that guy to your priority so here if it's of a lower priority He gets your inheritance he'll run once he releases B. Boom. You get it and go on. It's a hack. It works Try not to do that. Best thing to do is avoid that little trick Next thing is per CPU variables well This is when you have a per CPU variable. It's only associated to your CPU This is something that we like to encourage people to do use per CPU variables. Yes This is awesome. Like I said, we don't want cashline bouncing to scale You need to do everything as much as you can on one CPU without looking at any other CPUs. That's great We love it. Well, how do people usually protect per CPU variables? They disable preemption and something they do it for a long time and What sometimes they say hey spin locks disable preemption So I'm way grab a spin lock and do my per CPU variable stuff and then release a spin lock Hey, great. I just protected that preemption there Well, guess what? We don't disable preemption anymore but So this is what you'll see sometimes you see spin lock, you know Let's say I have two per CPU variables I want to add them together and show them to a third per CPU variable So I grab a or x y add them to Z. Boom bright Spin locks do disable migration. So this still does work. This is okay. You don't have to change your plans Preemption RT comes in it's still okay to do this. We disable from my migration. So As long as you protect that data by that spin lock if it's a per CPU spin lock, then we do have per CPU spin locks That's okay. We love them too But don't do both So if you had task a that said hey, I'm doing spin lock Here or one guy does a spin lock. I'm disabling preemption here No, you're not and you do your little magic and task B has another thing where it doesn't need to grab a spin lock So like we don't need to grab spin like we'll just call preempt disable and preempt enable and you do your same little magic And what happens here is you get this? so That operation supposedly has to be atomic you got to do all those three commands without anyone jumping in between well Guess what you start yours?  So say you have a higher priority past process comes in you get scheduled out boom Primp disable great now you turn off preemption. You do your work preempt enable fine So this is bad, but prems preempt disable itself is not bad We don't want to tell people it's bad The only thing is if you can't see why would I tell you this if you use a print disable And you can't see the print enable on that same screen that's small on your phone You did it too much Something like this I could put on a slide say it say that to yourself Could I put this code on a slide and projective where people in the back row can see it's fine Okay, I think that's good enough Almost don't call functions. There's no functions in between in there either Don't do this. This is something we've seen Just because they did something like oh, I need it Malik something and they just happen to be in a preempt disable Location and they don't really want to reorganize their code. So they're kind of being lazy and said I'll just allocate right here boom and Now you're now you also it's a gfb atomic So you have to use the atomic which is bad at batting itself Because you know you don't want no came Alec to schedule out or anything problem with this is came Alec called spin locks It's been locked sleep now So That's not good. We don't do this do this do your allocation up front if they fail don't disable preemption do your work It takes a little more organization. Guess what though? It's cleaner code It does you it's makes your code much nicer and much easier to look at people will be pleased They'll read your code when they go to bed at night Do this with gfb kernel So now you do a normal Malik because you can preempt you could sleep great You don't have to do these crazy things and get special memory and all that So print disabled is not bad if it is short Keep slow operations out of print print disable. This is not only good for real-time, but it's also good for just a reaction of the system Because it's good for mainland to Disabling herbs so avoid local IRQ safe Most likely if you're doing using local IRQ safe It's a bug There's a lot of times I've seen in old drivers local IRQ safe where they just figured they were written when everyone had a single CPU They needed a spin lock. I think we got rid of most of those But that was a lot of things but you really shouldn't have to disable interrupts and also you're being I say you're being greedy you're being Selfish whenever you use this because especially for a device driver. They say I use the local IRQ save You're just a million Arabs for everyone else not just you okay, I Make a political point right now about my country's leader right now, but I don't want to go there I'm American Proud of this okay, so anyway that contract There is a case where if you have per-CPU data that's shared between actual interrupts And you don't want to grab a spin lock You could make it we have something that we're we have in the real-time patch something called the local lock I didn't add it here because Thomas doesn't want to add it He's like I'm trying to get find better ways to write code so we don't need it But we haven't come up with the situation where yes You could have you know shared per-CPU data between the thread and inter-pandler So on mainline the best thing to do is look like you saved because you stopped the inter-pandler going on that way But then again you are stopping everyone's in your panel or you're not being you're getting selfish with that too So best to rewrite your code. Maybe try to find another mutex or Spin lock we have this thing called a local lock Which is basically just a local IQ save without or preempt disabled without a mainline, but on On RT it's a Mutex, so it's fine to do and we also what's also nice about that is you're Annotating why you have this local IQ save because a lot of times well We've actually had this where we go back to you guys developers and say We've studied this for three days. We have no idea why you have a local IQ save here and the developer went Oh, I forgot about that. We don't need it anymore We just deleted it. That was the solution so Reason wise because they had no they didn't they didn't know why they had that look like you say because there's no annotation about it It's just local IQ save I needed stop interrupts on me, but they changed their code had spin locks the local IQ save was not needed anymore Don't do this And we've seen this some people say hey, I could be fancy I could put local IQ save do a lot of work and then spin lock and then I spent a lot can do a local IQ restore No, those local IQs. That's just spreading the pain out to everyone. Don't do that. You want if you do local IQ save You want to keep it with the spin lock if you not move the spin lock out. You're not saving anything It's not that much.  I'm not going to go and talk about the history What they do is they ray you raise a soft raise it from the dead and Then you're basically asking it to run and when It will run when it can and right now the way it does it it does it by interrupts and it's interrupt Soft air cues are in interrupt context most of the time So if you write an IRQ our soft IQ handler a lower tasklet or something you think that you're always going to be an interrupt Context you're not because there's times when we get too many soft IQs We kick off case of dark you do that runs in a thread and runs your handler as a thread so we have this thing called local BH disable and Spinlock BH spinlock BH does actually do something different than it does Our other ones I think Yeah, because it will kind of do a special lock for Soft IQs so it disables preemption on preempt RT But doesn't but all right sorry non preempt RT kernels, but it stays preemption stays enabled But migration is disabled so you can use per CPU variables. That's fine So currently a mainline Soft air cues are indiscriminate in what they run So when you raise one although you might raise the networking soft air cue if there's like a block Soft IQ that wants to run it will run to and you got to wait for that as well So there's no way to change the priority between them There's no way to that make it deterministic so soft IQs really do suck on mainline And night they hurt people actually are working on fixing it now in mainline that they're using RT ideas to do so So we do things differently with software compute our cues and we went through several iterations to get this right so almost every in the bit from Probably every three years we wrote the soft RQ log logic completely different So if you go back like well not now actually we've been consistent ever since the four boy on curl So four point old curl. I think it's the time we went. Hey, we got soft RQs finally right Before that it changed all the time because we had no idea what to do because we we wanted to separate them Change the paradigm because we wanted every soft air cue to have its own priority so you could run the networking of Networking software cue at a priority of like the networking stack let people Changes we had soft RQ threads But then they caused deadlocks because it changed the paradigm of how things work and and because soft I could go soft RQs could run on any CPU at the same time But not on the same CPU at the same time So things are really really weird and what we finally figure out what we could do is Just let whoever said I want this off to RQ to run run it Run the soft RQ. So whoever raises it. That's the priority. You know what the priority is So if your high priority task raises the soft RQ it runs the soft RQ logic under its own task works great But main line is currently suffering from soft RQs with starvation Like I said the networking soft RQs can't run because the block soft RQs are going too long And it's they're having issues with network performance and everyone wants real good Response time even on mainline Linux. So there's work right now. That's going on That's taking ideas from Frederick vice-pecker who also came through the real-time guys He is influenced his work is influenced right now in LKML the first series. I wrote is Not the best and He it's going through you'll see soon what we're going to do is now start doing annotations You can actually say I only want to run like when you enable or raise a soft RQ when you with the Low guard you save and restore it's going to record. Okay We know what you saved and when you enable soft RQs It will only run what you enabled and when everyone else go to case off to RQD that type of thing So we only those that are important like the RCU case off to RQD We don't that no one really needs to run that the RCU one That's a garbage collector. It could run whenever it gets a chance to run as long as it eventually runs That's fine, but things like that don't need to run and those could take up a long time because those are running like RCU cleanup code which could take forever. So you don't want those things running. So We're actually working to get mainline to say hey, just pick which software Q I'm going to raise and it's gonna be all done magically for you. Hopefully we'll see we'll find out what the Patches from Frederick come in but the way we do it now is once you do the raise It sets a flag in the the task struct saying okay, this guy raised it So he wants this run we run out of his priority. He asked for it. Let him take the penalty for it So soft IQs are not Real-time looks like this high-priority task Has it raises a soft RQ Arab handler goes off and then when the handler before it goes back to user space It runs soft RQ handlers all of them RCU whatever it has it could go off So this high priority tasks has to wait for that So what we do in the real-time task is save interrupt goes off and triggers Soft RQ within the handler it will come back and the handler itself actually I should have I just forgot I put soft This slide is a mistake The green should have ran first then the handler swap that just in your head put swap schedule there and Then it runs a soft RQ logic within its handler itself Finally what I want to talk about this is getting close to be an end Raw spin looks this is actually our gift from Lina's Back in 2009 Raw spin lock has been introduced to the Linux kernel. You probably how many people have seen Ross been like in the kernel Just people just tired. They don't want to raise their hand Yes This has no meaning in mainline Zero none niche we came up with excuses, but they're all BS This is just a way that we could differentiate What when you have a spin lock that can't sleep For instance the scheduling spin locks the timer spin locks those can't sleep You can't have the scheduling spin lock schedule It kind of gets into an infinite loop that way So there are things you actually have to have as a raw spin lock. Well, this is it raw spin lock scheduling mode We have it in there Don't use it if it becomes a problem for you See makes because it makes order important. Yeah, this is what I wanted You can only use them for critical usually I would say hardware or scheduling Activities or CPU going down that major events could use them not your normal device driver Not saying that all my code is special Don't do it If you do it it could cause problems and actually it Defeats the point of being a preemptible kernel fully preemptible kernel the more spin locks Ross me locks you add the less real time it becomes it's less deterministic. It changes time. It's horrible Don't do it. So Your lock is not as important as you think it is questions What an anti-climatic ending? Okay Think we have like four minutes if there's any questions. There's microphones because I guess this is being recorded So come and show your pretty face to the TV. Oh Guess someone coming up here. Thank you Can you go one slide back, please regarding if you cannot figure it out? Yes Actually, we had a problem and it was What you write a scheduling while atomic I had a lot of error messages in my kernel lock and It was actually because we ported from 4.9 to 4.14 when the IRQ safe flag inside the HR time a struct has been removed. Oh And Yeah, we got it compiled again But then we saw a lot of scheduling while atomic is for main line or preempt RT a preempt RT patch set Have you reported that to Thomas? No, please do because that could be that could be that a case where you said We switched IRQ what that means when he removed IRQ safe flag from the interrupt handlers What that means is he didn't think there was any path that could get there That's not from an actual hard interrupt Yeah, we are using it in hard interrupt. Oh, no, no, no, sorry turn around stop it turn around I Started these slides at 5 a.m. Okay No, I meant the other way around he thought there was no path that it would be used from a hard interrupt context He thought to get here it had to be threaded and if not Something about his assumption is wrong or maybe something at your assumption about using that function is wrong So that's where it's a communication thing. I would highly recommend reporting that saying hey I found the path when you change this to that this broke What can we do to fix it or should that be an IRQ safe? You can always set a patch and see what happens Okay Someone else. Yeah, right near the beginning you mentioned Were you number two there or who's I thought I was I was stood up Yeah, where were we but wait? Yeah, they stood Geez I'm like I thought I'd keep patiently so I could take part You're right. You know, it's just that the speakers over here. I thought someone was yelling. Okay I think you're proud. Sorry You talked about basic RT at the beginning and then the do me full arty. Yes. What was the difference between those two? I believe It's been a long time since we used it and we kept it in and some of those things that if anything breaks We come back actually what I believe it turns on everything but the Spinlocks sleeping spin locks. It does everything else. It does This thread thread our cues everything else. It's just to say basically it's ways Is it the bug because of the sleeping spin locks? It was a bug for something else because basically the sleeping spin locks is the big thing that we want everything else is kind of like There might be a bug there too, so it's when you have both on it's hard to differentiate I've never used it Thomas I can see still uses it because I said should we get rid of that because he He doesn't expect that to go into main line That's the one thing he wants to rip out before actually makes it into main line I only put it up there because if you download and install the preemptor T patch, you'll see it I just want to explain what it was Anything else? Yes, yes, yes slight comments You put on some slight use RCU if you can I could correct it if you may Because RCU only for high priority task better to use mutexes Yes, I would say I would say you can and may are two different things Reason why I say use RCU when you can which means that it's not going to suffer the performance and everything else because yes RCU is extremely fast for writers extremely slow for reader. Sorry swap it I Need more coffee Extremely fast for readers horrible for writers. So yes, if there's a case you could do it But yeah, it's going to kill your performance because you have a lot of writers That's a case Maybe you could try to rewrite your code as I've actually worked to try to rewrite and get rid of the writers Or put them elsewhere and try to constantly piggyback and do use more RCU because that really RCU scales RWD mutex does not Okay, thank you and one more comment about drivers and actually this slide row spin locks We did several patches to fix GP a driver because they implemented an RQ chips So in some drivers, it's only way, okay I'm going to say something reason why I said it so strongly is I don't want people because I've seen it thrown too quickly There's been a few cases where we said, okay, they grabbed a lock. That's only basically it's the same thing as the Primp disable thing if you could see on your cell phone or on a slide with no function calls Just grabbing a lock or this law raw spin lock and only a few things and it's I think slab We might do this too because it never grabs it and does anything for more than a very very short time That's perfectly acceptable But anything more than a screen full or function calls within it. No does that make more sense? Yeah, but this GP our drivers is basically are you always registered so nothing else We have to we well, we're slowly fixing thing one thing at a time What is in place what is in place and being put into place to help catch regressions early on pre-emptority? Are you coming to plumbers? Anyone coming to plumbers links plumbers. We actually have an RT micro conference That's actually one of the agenda. How do we catch the regressions because like I said when the beginning of the talk I said we've doing we got it in great. Oh, no, we have a lot more work to do. That's one of the topics We have ideas. We have answers. I'm not saying anything yet because it's still a work in progress What about sec looks this good for RT bad for a T try to avoid them if you can they're not good for mainline No, they are they're not there they think they because they're like a repeating lock. You know like oh, we did I mean it matters. Okay matters how much contention there is but that's one of those things That's okay. I think RT if I haven't looked at the code recently I think we do make it more deterministic because right now that's a non deterministic functionality depending on your load or something but most of time like in time catching a time Sam So that's usually a reader. That's usually not something of prior most paths that hit that are not usually real-time tasks So if it's not a real-time task, we really don't care about determinism, but that's one of those things You have to audit. So yes sick locks or yeah Anyone else? Yeah, we're here. Are we are we still trying to get rid of the semaphores? the traditional ones um I don't think we've seen much left. What's left? No, they're actually getting more. Oh what what the semaphores? Yeah, they're getting added faster than they could remove With we we were down to 30. I think at some point now. We're over a hundred Good to know. Thank you You know that yeah, we would like to get rid of some ideas about what how we can Improve that. Are you gonna be in plumbers? Yes. I'll see you then Anyone else? Well, you gotta come up and get a mic It's being recorded, but if you don't listen to short question, I can repeat the question Okay, the question is if we get preempt RTA into the kernel, what will happen to the patch set? Will it go to zero? hopefully yes, we might have a niche patch set for things that there are some things in the kernel that May not got get into the main line that's For some device or for some weird situation We may have a patch set just to do that It might just be like a staging to try to get the main line come up with a new solution knew that But the big hammer is that sleeping spin lock once that's in that's real time That's everything else is sort of one of these little fixes everyone says looks at the patch Say wow you got 300 bites or you know 300 patches in there 290 of them are basically little fixes like that So and it's like once we get one thing into main line. It'll take out 200 patches So because those 200 things are hacks because we don't have a solution for this one thing What's it got that solved? Boom, those go away. We may have little things like that, but hopefully everything Yeah, it'll be optional. Yes. Yes at that point. It'll be something that you could it's going before those Cases where you just have like someone I want to get this in we say that's not a great Solution, but we may we may maintain like a patch set for those cases where We don't really have a real solution for yet But those are like that's going to be for them 99.9% of the people here. You won't care about that In fact, I probably would never run it. It might be this like hey, I got this Okay, we got figure out how to solve that here We'll put this patch here for so everyone that want has a same issue could use it shared The links kernel really is always forked everyone says, you know the people I say what happens if links gets forked I hate to say us. There's hundreds of thousands of Linux kernels out there Not one of them are those hundreds of those are the same. They're all for example Android even Debian red hat They're all forks red hats its own system. They have their own patches Susie has their own patches same thing Anything else? When will it happen? We're okay. We were hoping this year it looks like because of Because of recent events, it's not going to happen. It has nothing to do with technology Anything else? Okay, thank you One it's actually well. Yeah, go ahead. Sorry practical. It's just very practical It's this I mean with all these things are we getting really deterministic clock cycle? You know it'll happen within this many clock cycles or are we just saying it's guaranteed 99% of the time that kind of thing And what's the what is the time the latency that we're guaranteed to the jitter? That is not determined by the RT kernel. It's determined by your hardware. Thank you. Yes


We're just going on guys real estate gaming here today. We're back in Roblox We're gonna be playing sponge because they finally drop chapter 3 which is on the goat ship. Oh my god So it's a Dutchman ghost gonna be around here That would be awesome if he is oh the red key, okay, let's take this red key yo look at this ship It really resembles a Dutchman ghost is ship a lot. Oh my god. We got like some squid captain. Wait. Is it the red key? Okay, nice We're out to a good start so far My god, okay, we need a purple key over here. We need two purple keys. What's like two shades of purple in this game All right, man, whatever. Oh green key Or sponge has a woken I can hear the heart beats every time he's near you you hear like these heavy heart beats Which is pretty creepy.  Oh, there's a note here. It says I woke up today and the captain was gone Where did he go? What did I do? Oh my god, so the captain just abandoned us. What's it? What are you doing over there sponge? Looks like he's having a little fun of his own Right little just let him mind his own business.  I am the captain now. Okay. I am the captain now Hey, no, I am the captain get away. My god. This guy just don't understand. Oh wait. Can we go up here? Oh we can My god, okay, so there's two floors to the ship. Oh No, we need the plank. I saw the plank down there. I don't know if they grabbed it or not Dude, he grabbed the gun instead of the plank. Come on, buddy. I mean I would grab the gun too right to feel safe What is he doing? He places traps everywhere. Yo, where's your other shoe at and why does he shoot horn? Oh like that dude the plank is right here. Let's grab the plank Let's go up there to the top And let's see what we can figure out up there. Dude, I have no clue what is going on down there It's like Spud just having a party with everyone Okay, we crossed over now we need a green flag up here. Oh We can drop down from up here. Okay, a little escape Okay, so pretty neat. There's nothing up here that we can use. Oh, I did we not die from that fall It was pretty high up. Okay, let's grab the green key. Somebody took my green key. How dare they month three day 28 I believe I haven't covered something truly harrowing Sponge isn't who we think it is. I need more proof and I intend to find it update If you are reading this beware of the beware of the what it got cut off Oh, this is the day before so we were supposed to read that one second and this one before we read that one So says month three day 27. Hey, can I just read this note and I'll be out of here Okay, I'll be quick man. I've been noticing some odd occurrences below. Who are these strange humans? Where have they come from? Why is punch chasing them? Hey, you know what?  Oh my god, but just right there. I Just heard a good shot Okay, so we know there's an okay. We read down Dude, where is that green key? We had it or they unlock this down here We had the green key and someone took it from us And now we can't find the green key Which we need it To open that green lock up there. Oh my god sponges down here Good lamb. I suppose. Let's go look for it over here. Maybe they open the door already go check it out. Oh How did he just run through? Oh No, okay, so the green kid is not here. Nope All right, my boy has the green key right here. There you go. Oh, no put sponges coming Oh my god, so it just opened up another pathway to go downstairs Right, let's check these out. Oh a purple key Okay, I did see that. We needed like a purple key somewhere else. Oh Look the green flag. Yo, take the green flag. Take the green flag. So okay, you know what just leave it there I'll come back for it. Why is this door open? Wait, I saw like a note there Guys there's like some secret thing in here, but you can't get in that room. It's like parsley open I saw like a note. Oh, there you go. Oh, you know what? Let's just get out of here because time is ticking Yeah, we need to get out of this place. Oh great. We're stuck down here Hopefully sponge doesn't drop in here with us Okay, let's climb up here and we do need a head on over To the other side okay, so we managed to get away from sponge because he was creeping behind us. Oh look there's a hammer What do we need this hammer for? Okay, oh the green flag yo get the green flag, bro Okay, take that. No, okay. There you go Catching on. Oh, there's a red one down here. Okay, we're gonna need the red one and the green one my god There's more doors Feel like more Doors keep on appearing the further we unlock more stuff. Okay, so we need a hammer We we need the wrench now where we're gonna find the wrench in this place. Maybe behind that door Okay, you know what? Let's go place these because we're gonna need them. Oh He dude. He just opened up like the entire an entire whole different parts of him back Okay, so we need this key to escape.  This is not good. I'm out of here, man I'm not gonna take another chance and wait for sponge to swing at me Because we do have to run all the way to the top to place these flags Which is a bummer? All right, there you go. Yes, okay So we got the red one and Brian's gonna place the green one. Okay, so we did see the other one Um, can we drop here? Okay. I thought we were gonna die good thing We did and we did see the other one over here. Where was it at? It was down here if I'm not mistaken It was in one of these rooms. Oh, there it is Okay, yes, so we can place this where it belongs and let's see what it does Because these are for the ship Okay, we play this on down here. I think Where sponge I hear the heartbeat Oh my god, he's coming up It's hide from him Well, I don't think we can exactly hide from him because my dinosaur head is peeking over But we'll try our best and place this Right here. Okay. So what did that do? I think it opened something up Oh, we need a sword for him Okay, so I have no idea what that does Oh my god, we got sponge there. No Okay run Let's run away Make a piggy related game No, there's already way too many piggy related games, bro It's like piggy took over my I mean roblox Okay, so we need this key for that lock. I believe grab this bad boy And open this door. Oh, we found a sword. It's like a cutlass sword Oh, he got the wrench. Okay, nice. Come over here. No, wait, where's the where do we need the wrench? Yeah, right here You got it, man Okay, so now we need the lock and then I think we can escape But you know what I'm gonna go a key. Oh no, where's that key?  Oh What did that do? We need the hammer. Where is the hammer? Oh my god, okay, so now we need the hammer. Please don't take soon I have no clue exactly what sponge is doing, but he's not getting me I guess I'll just keep on going about my own business Oh, no, where's the hammer? I know he had the hammer somewhere Okay, the hammer is not Wait, is that the hammer? Nope. That is a gun That is not a hammer. That is a gun. Okay, where can the hammer be? Come on I think it's down here Okay, that is a bullet. There's the wrench. Okay. I think we're getting near the hammer Voila, there you go. I told you guys the hammer is down here He escaped Dude, he escaped through there Okay, I'm gonna do the other escape The main escape that looked like it could be the main escape up here You know what? Let's just try this escape. Let's see what the difference is My god, sponge is right there Oh, we're gonna walk the plank This is some real pirate stuff right here. I see you man. We're walking the plank. Let's see what happens here You escaped. Okay, sweet. That wasn't too bad actually I mean it was a little hard because there was like doors left and right But even then that it was it was a little fair quick And plus the uh Plus sponge not actually chasing us and doing his job. I don't know what he was doing man He was insane. He was having like a little party or something Gigi, I think we all escaped actually. Oh, we did. All right All right, so that was the escape of the ghost ship Mr. Dutchman's ghost ship to be more exact And it would have been cool if they added like a little Dutchman easter egg on there Which they did it because it is his ship after all But I mean it was cool overall. Oh my god. No Okay, let's just chill here. All right, you guys.  All right, you guys. Well, thank you guys for watching Thank you guys for the amazing support if you guys enjoyed the video. I just noticed he's SpongeBob That's funny. Make sure to slap the like button If you're new to the channel, make sure to subscribe and turn that notification bell on and I will see you guys in the next one. Ye


Hi my name's Catherine, I'm 22 years old. I am a head boosterer at Century. I'd make approximately anywhere from five to seven hundred coffees a day. I love making someone a really good coffee. I love the expression when they when they realize that I'm blind. I had really mixed emotions when guide dogs said I could, I was eligible for a guide dog. I was scared because I'd never had a dog before. I was excited because it means that I could travel independently. I had never thought that having a guide dog would be something that I wanted until I met Sammy and then I just knew that it was right for me. Century was a very different experience applying and being interviewed and actually getting a job there. My now boss is very accepting. He for a lack of better word doesn't care that I have a vision impairment. He doesn't see me any different. He actually thinks I work harder because I have a vision impairment. I have something to prove. Sammy and I are inseparable now. We do everything together and even if I'm away from her too long she just knows if I'm upset she comes over to me and sticks her nose in my face. It's really adorable. She knows how to cheer me up. Guide Dogs Victoria means to me independence. Raising a guide dog is very expensive and I wouldn't be where I am today without the services of Guide Dogs Victoria being free.


in now Simon Michelle from big securities to get more on the bond markets and how they're sort of reacting in the lead up to the Brexit vote on Thursday night and Simon what are you seeing in terms of global yields because they were up slightly but we are still seeing obviously these mixed polls absolutely so I think you know we had such a big reaction last week in grid when we saw investors really fly to safety and huge demand for bonds pushing those yields down that's been reversed and really I think as the polls have looked a little bit more risk mixed as you say and the remain vote looks you know increasingly more likely investors have been happy to sort of reverse those positions back out of bonds missing that reflected in equity markets for example so pull back but look very cautious leading into that vote at the end of the week what about here at home I mean in terms of Aussie yields they're sort of reacting to different things at the moment obviously the RBA minutes for one and Guy De Bell's speech this morning that's right so we had the RBA minutes and look they were pretty upbeat really I think the only real concern that the RBA mentioned or mentioned specifically was the lower inflation that's likely to remain low they also said market suggests in the US Fed you know later this year so July it's not looking too likely if you look at pricing at the moment so pretty upbeat really and certainly no real cause for a further rate cut at this point they certainly didn't leave that on the table so that's pretty positive and we also saw as you say a speech by Guy De Bell the assistant governor around the bond market liquidity in the bond market we've seen some significant changes there so a good speech there the other thing I just said as well we've had optes coming out looking like they'll be doing a new bond issue they've got a 300 million Aussie issue maturing in 2018 so the issuance continues yeah I was going to say is the corporate bond issuance still sort of solid at this point in the market very solid in fact the RBA minutes mentioned the large amount of bank issuance we've seen obviously the hybrids we saw the ANZ do a US dollar hybrid issue QBE did a tier two issue uh this week as well really high strong demand I think the QBE was four times bid so you know really strong demand for corporate debt at the moment especially given where those sovereign yields have drifted lower you know investors want to take advantage of higher yields and they're moving into the corporate sector all right so I'm Michelle really interesting thank you very much for joining us thank you and good sign Michelle there figure securities and


Amanda Black opens up about record label Split. I go home. It is hard to think in the city. Amanda Black is looking for a new record label after leaving ambitious entertainment in June and says the battle with her label has sometimes led to her going home to the Eastern Cape to escape it all. Asked by Metro FM's DJ Fresh on Tuesday morning if she had left her current record label, Amanda was shy to comment but said she was currently in the middle of a dispute with the company. She said the situation was emotionally taxing and she often went home to get a bit of perspective. I go home. It is hard to think in the city. It is very hard to have clear thoughts and make the right decisions. It gets very confusing. When it goes really really tough and I don't know what to do. I go home. She said that she was unsure of how her battle with the company would pan out but just wanted to sing. I just want to continue with my career. I just want to sing that is it? Whatever happens now, I want to come out being able to sing my songs. I want to be able to record and release new music. I want to share what I have. This journey that I am on, I am meant to be on. All the hardships that I am going through right now I understand that they are meant for me. I am supposed to go through them. In a statement released by ambitious in June the company claimed that the two parties failed to agree on certain terms. It also included a comment from Amanda speaking about the move. I am very grateful for ambitious entertainment and how far we have come. I am embarking on a new journey and I needed a team that would work with me in realizing the plans and dreams I have for my career going forward. The new management looks after my bookings, brand, and publicity as well as assisting me reach wider audiences in Africa and beyond, it read. The star has come a long way from her time on TV music competition, Idols Essay, and after wins at the 2017 Essay Music Awards and Metro FM Awards. She scored an international BET award nomination in June.


Immunotherapy with histamine dihydrochloride and low dose interleukin II, HDC Illinois II, reduces the risk of relapse in the post chemotherapy phase of acute myeloid leukemia, AML, but its clinical efficacy is primarily beneficial for patients with AML of normal cariatype. This article was authored by Marlin S. Nielsen, Alexander Horner, Matt Sproon, and others.


All children dream big, but where they're born often determines if those dreams can ever come true Because 250 million children around the world can't read, but we're changing that the 15 million dollar global learning XPRIZE It's challenging you to develop tablet-based software to teach kids to read write and do basic arithmetic So join a team or start your own and compete in the global learning XPRIZE sign up at learning.expris.org


Meijersdal Eco Estate touring another grand mansion. Absolutely incredible. From its open, airy design to all of its little features.


This study investigates the role of M7G methylation modifications in lower-grade gliomas, LGGs. It finds that individuals with LGG can be divided into two groups based on their M7G scores which are associated with different clinical outcomes. Additionally, it identifies five potential genetic markers that correlate with the M7G score signature index. This research provides valuable insights into the features and classification associated with M7G methylation modifications which may help improve the clinical outcome of LGG.


welcome to module 17 of chemical kinetics and transition state theory. In the last module, we were discussing partition functions. We looked at translational, rotational and vibrational partition function. Today, I just want to connect with another very related concept which is the quantum partition function. What we have done so far is it integral over x and p and x and p are classical concepts, Newtonian concepts and that is what we have been doing so far. Everything has been Newtonian, but as it turns out in some occasions, a little bit of quantum mechanical effects are important. We cannot ignore them. So, we will discuss quantum partition functions today and we will end up with a little bit of physical understanding of what partition function means really. What I am describing is from Atkins chapter number 15b of volume number 10 of 10th edition. But again, if your edition is different, do not worry the same information you can find in a different chapter number. So, just a quick recap what we have covered. We have defined the partition function as this integral over phase space divided by h to the power of 3n of e to the power of minus beta h. Then we looked at separating the variables and Hamiltonian into translation, rotation and vibration. And so, we get our partition functions also separated into translation, rotation and vibrations. So, we get 3 different qtr, q rotation and q vibration. And in the last module, we calculated these and showed that q translation is equal to this. For rotational, we did not provide the full proof, but just an intuition on how these come about. But you get importantly two different rotational partition functions for linear versus non-linear molecules. And for vibrational, we showed that the partition function is equal to this for one vibration. If you have multiple vibrations with different frequencies omega 1, omega 2, omega 3, so on, you just multiply the respective partition functions for vibrations. So, now we will move on to how to define quantum partition function. So, I will not get too much deep into what is quantum mechanics as much, that is not really a part of this course. The main thing to know is in quantum mechanics, there is no such thing as phase space. So, the notion of q comma p that we have been using so far, it disappears. What we instead have in place of q comma p is called wave functions. And I will not get into what wave functions really are. But we denote a wave function by some state i, which is given label. So, under point main point here is that this q comma p is completely continuous. I have q can take any number from minus infinity to plus infinity and so can p. But these states are discretized, they are quantized. That is the origin of the world quantum. So, q comma p gets replaced with state i, Hamiltonian of q comma p gets replaced with E i energies. And these E i's are the eigen energies of that system. So, we solve something called the Schrodinger equation and get these E i's. Again, we are not going to cover the Schrodinger equation really in this course. And the final thing is the integral over phase space that we have been doing so far divided by h to the power of 3n gets replaced by a discrete summation over all possible states. So, we had earlier shown that the equilibrium density matrix for classical mechanics is 1 over q e to the power of minus beta h where q was a partition function. I apologize, this should be a normalization constant. In quantum mechanics, that thing will become 1 over n into e to the power of minus beta E i. This will be rho equilibrium of state. So, wherever you see q comma p that gets replaced with state and wherever you see this h that gets replaced with energy. And finally, we have to define this partition function in quantum mechanics. So, in classical mechanics, we are doing this integral. In quantum mechanics, we replace this integral as a sum over all states e to the power of minus beta and h gets replaced with E i. So, in this slide, I am not really giving you proof on why you can do it. I am simply giving you a recipe because the proof of all of this is much beyond the scope of this course. We have to understand quantum mechanics much deeper to derive all of this. So, we will just use this recipe to calculate quantum partition functions now. So, we have now a quantum partition function defined as this q equal to sum over states of i e to the power of minus beta i. I will just provide one little comment. So, imagine you have these states. So, what happens in quantum mechanics is you have different states with different energies. So, let us say I have a bunch of states with different energy. This is let us say state 1 and its energy is E 1. This is state 2 and this is state 3. But interestingly, you can in quantum mechanics have states with equal energy. So, this is energy E 2 and this is energy E 3. Sorry, this is also energy E 2. So, state 2 and state 3, let us say equal energy and so on and so forth. You have different states and all states, some of the states have equal energy. So, if I am summing over states, what I will have is something like E to the power of minus beta E 1 plus E to the power of minus beta E 2 plus E to the power of minus beta E 2 will appear twice. One for one for state 2 and one for state 3 plus so on. So, you see that whichever states will appear twice will get a factor of 2. Similarly, if a state is occurring 3 times, it will get a factor of 3 then. So, in general, I can write this as sum over energy levels into G i into E to the power of minus beta E i where G i is the degeneracy. Degeneracy simply means number of states having energy E i. So, I can go from a summation over states to a summation over energy levels. So, now whichever version we write over states or energies, we want to do the same trick we did in classical mechanics. We do not want to deal with the full partition function which is much harder. We want to do divide and rule. We want to separate the states and the energies in terms of translational, rotational and vibrational levels. So, how do we do that? The point is it is a same trick as before. So, states i gets divided into a translational states j plus rotational states k plus vibrational states l. Now, in quantum mechanics, we actually get another one which is the electronic states as well, which we will discuss later. So, in quantum mechanics, we have an extra term other than this translation, rotation and vibration which is the electronic energy. So, that is the same thing as 1s energy versus 2s energy. That energies are different and so, we have a different electronic state energy as well. And the energy themselves get separated into translation, vibration, vibration and electronic. So, what we do is we divide this summation into the other different parts j, k, l, m and this also we separate a same thing as before. Instead of an integral, we have a summation. That is all. So, vibration and electronic. So, again we play the same trick and we separate the terms out. This is rotation, sum over l which will refer to vibration and sum over electronics, which will refer to electronic levels. So, this we then define to be q translation, this we define to be q rotation, q vibration and q electronic. So, the same decomposition we can also do in quantum mechanics. So, let us calculate the partition function for 1D translation. So, my system again is I have a box. This is particle is located in between 0 to some lx and the potential is 0 inside and infinite outside. So, we had shown for this potential the classical partition function is here and we will calculate it for the quantum part now. So, for this part actually the first thing we need to know are what are the energies and degeneracies Gis and Eis. So, we will see in this course simply provide that this comes from solving Schrodinger equation to be more precise, but we are not solving Schrodinger equation and simply providing you the final answer. So, the q will be sum over i G i e to the power of minus beta E i. So, this becomes sum over i G i is 1 e to the power of minus beta i square x square over 8 m l x square. Now, one important note about this quantum partition functions we do not include the 0 point energy in here by convention more or less. We can choose the energy whatever we want. So, we set the first ground state energy to be 0. So, my summation will start from 0 to infinity. Now, this summation is actually a very hard summation to do analytically, but if temperature is large that is I have a lot of these terms a lot of levels are populated. Then I can put this thing as an integral over dx e to the power of minus beta x square x square over 8 m l x square where I have replaced i with x and the summation with an integral dx. So, now what you get is a Gaussian integral and we know how to solve Gaussian integrals. So, again do not end up memorizing these integrals we will always provide you integrals. So, the answer for this is half root of pi over A and A here is the coefficient before x square which will be h square into 8 pi k B T m l x square. We will just simplify it a little bit. First thing we note 8 is 4 into 2 and 4 I take out of square root. So, I get a 2 that will cancel with this 2. I take x square out l x square out and get this and you can note that this is exactly the same as this. And the reason we get it the same is because we have made the approximation that temperature is large. We went from that summation to integral. The summation will not come out exactly equal to this. It will be slightly different but in the limit that T is large it will be equal. So, that is actually a general result. It is called classical quantum correspondence whenever temperature is large you will get the classical result back. So, now let us look at the rotational partition function. For classical we had given you two formulas one for linear and one for non-linear. Right now I will just derive it for linear and non-linear is slightly harder. It is not fundamentally harder it is just computationally harder. So, we are not going to do that derivation that we will assume to be true. So, we will look at the linear part. For linear part again the energies rotational energies are given by b into j into j plus 1 where b is your h bar square over 2 i and g j is given to be 2 j plus 1. This again comes from Schrodinger equation. So, there is some mathematics behind which is solving this rotational partition rotational Hamiltonian in 2D in linear for a linear molecule. What we have to do is sum over j from 0 to infinity g j which is 2 j plus 1 into e to the power of minus beta e j. Again this is a very hard summation to do. So, we are not going to attempt to solve this. We will approximate this is equal to integral from 0 to infinite dx 2 x plus 1 e to the power of minus beta b x square plus x. Now, this integral actually might look complex, but it is not really so. We are going to make a substitution y equal to x square plus x dy is 2 x plus 1. So, you know see that this is exactly what appears here. So, our life is simple. So, our integral becomes 0 to infinity dy e to the power of minus beta by which is an easy integral to do. This is equal to e to the power of minus beta b y divided by minus beta b from 0 to infinity. Once you put in the limits you can show this is equal to kbt over b. So, let us just put in the value of b from here h bar square h bar is h over 2 pi square divided by 2i. So, let us just simplify this. This 2 pi square will go in the numerator. So, I will get 8 pi square kbt kbti over h square and you will note that this is exactly the same as this. Once more the reason is because we went from a summation to an integral is the reason we get it the same. So, every time you make this high temperature approximation you will end up getting the classical answer and often classical answer is easier to calculate because we know simply how to do integrals better than we know how to do summations. So, the non-linear part I am not going to prove to you, but there as well at in the under high temperature limit this equation will also hold true quantum mechanically as well also true quantum mechanically. So, finally, let us look at the vibrational partition function and here we have a little bit of a surprise. So, this is not the same as translation and rotation we have to be more careful with vibrational. So, our q again is sum over i g i e to the power of minus beta e i where e i here are vibrational energies provided here and g i's are the degeneracies which is equal to 1 for vibration. So, let me substitute this energy is h bar omega 1 i plus half, but what we always do is as I have mentioned earlier we set the 0 point energy to be 0. So, we ignore the half part of it. So, the point is that our e 0 is h bar omega 1 over 2. So, that is our base we consider all energies now as e i minus e naught and what we are doing here is summation over this e i tilde. So, that 0 point energy gets removed away. It is a it is a matter of convention only it is nothing more I can I am free to choose my base energy where a energy is equal to 0. So, that is all I am doing I am not really saying that 0 point energy it is does not is not there I am simply calling that 0 point energy as 0 value that is my choice it is just mathematics. So, I will just provide you a summation sum over i or x to the power of i i equal to 0 to infinity is equal to 1 over 1 minus x if x is less than 1. So, I am going to call my x as e to the power of minus beta h bar omega 1 note that this is less than 1 you are taking exponent of some negative number beta h bar omega 1 is positive. So, e to the power of something negative which is less than 1. So, I can do this is equal to 1 over 1 minus x. So, this summation q has become sum over i x to the power of i vibration quantum mechanical. So, here we have to be more careful for vibration. First we can do the summation exactly that is good for us, but more importantly for vibration the high temperature limit does not really hold for rotation and translation high room temperature is usually high. So, the approximation that we made in the last few slides of calling the summation as integral and calling the high temperature limit is a good approximation. But here generally it is not and we will show it to you. So, we have looked at the quantum vibrational partition function and we have realized it is slightly different from the classical version. So, let us get back to our favorite example of HBR for which we have found all the rotational classical either rotational translation and vibration. And if you go back to your last module we showed the vibrational classical partition function was came out to be 0.078. So, let us see if the quantum version makes a difference. So, the quantum vibration partition function that we just derived is equal to 1 minus e to the power of minus H bar omega 1 divided by kT. So, this is equal to nothing but 1 minus e to the power of I will just use this number here 1 divided by 0.078 which is 1 minus roughly 12. What you realize is e to the power of minus 12 is actually a very very small number it is 0.000 something right it. So, we can almost neglect it. So, this is roughly equal to 1. You can of course, put it on a calculator and calculate this out exactly and what you are going to get is 1.000 something that is a lot of zeros after 1. And so, we do not care about that level of significant figures. And so, you see that the quantum partition function is very very different from the classical partition function more than a factor of 10. So, that is very important to know that the vibrational partition function quantum mechanical version can be very very different. So, unless otherwise specified for vibrational partition function we all always use the quantum version and not the classical version. So, finally, let us also look at the final component of the partition function which is the electronic part. So, remember we had divided our energies into this translation rotation vibration and electronic. And for each partition function we write this basically as sum over alpha e to the power of minus beta e electronic alpha. Now, the point is typically the electronic energies are much much more than temperature ok. Hundreds of time more than temperature thousands of time more than temperature. So, generally we approximate this thing as simply e to the power of minus beta e ground state only. I had forgotten the degeneracy I am sorry g of alpha into g of ground state. But by our convention this is chosen to be 0. Remember once more for a quantum partition function we always chose the e electronic ground state to be 0 or e ground state itself to be 0. So, we get this is equal to simply g of where g is the number of states with equal energy for the ground state ok. So, we will go let us look at a couple of examples. For example, if I want to think of hydrogen atom. So, for hydrogen atom you have 1 s orbital and you have 1 electron. But you note that this electron can also be in the down spin state. So, this is a little bit quantum mechanical each orbital can have up spin or down spin. So, with that basically your degeneracy is 2. So, every time you have an unpaired electron your degeneracy becomes a more than 1. So, your q electronic I am sorry electronic is equal to 2. The same thing I do for let us say h 2 molecule well h 2 molecule in the ground state has only one configuration ok. So, both electrons are paired when that happens your degeneracy is simply 1. There is only one possibility that the ground state can be in which is this 1 sigma 2. So, this is important how do you calculate the electronic partition function as well in quantum mechanics ok. So, now we have looked at the different partition functions. I want to just spend a few more minutes in explaining how do we understand partition functions what is the meaning of partition function. So, what we have been looking at is a partition function at a given temperature ok we had beta. Actually you can also define partition function at a given energy and if you do that that is simply the sum over states of that energy. So, quantum mechanically partition function at a given energy would simply mean the number of states at that energy which is actually exactly the same as the degeneracy. So, that is what partition function at constant energy means. And classically that would mean the area or the volume that that constant energy surface occupies. So, think of a contour plot of that particular energy in a high dimensional space in q, p space and find its volume that is your classical partition function at that energy. We can also define the partition function at a given temperature which is what we have calculated. So, the meaning changes slightly, but essence remains the same a quantum partition function is essentially the number of states that are accessible. So, you are at a given temperature which means you have a distribution of states. So, the quantum partition function is essentially telling you at this temperature these are the number of states that have some occupancy. This is a very broad and rough definition the exact definition is a summation. So, this is just an intuitive definition of partition function and classically that number of states becomes a volume in units of h. So, the accessible phase space volume at that temperature in units of h. So, that is the fundamental meaning of partition function. So, we have found the partition functions for HBr. So, the translational in the last module you can go and we calculated these numbers out. So, the translational partition function came out to be 7.2 into 10 to the power of 29. The rotational came out to be 24.6 and vibrational the classical number comes out to be 0.078 and today we calculated the quantum number and quantum number is very close to 1. So, what these numbers really mean is that the translational states you have roughly 10 to the power of 29 or 10 to the power of 30 states that are accessible at 300 Kelvin. The translational states are very, very closely the translational energy levels are very closely spaced and so you have a lot of translational states. Now, rotational states are somewhat far apart for HBr they are roughly like 5 to 10 wave numbers 20 wave numbers actually. So, at 300 Kelvin you have roughly 10 or 20 states that are accessible and in terms of vibrational quantum mechanically you have only one state that is accessible. So, what is the reason for that? The reason for that is that the vibrational frequency. So, the vibrational frequency is roughly 2500 wave numbers room temperature is roughly 200 wave numbers. So, you can do this calculation at 300 Kelvin what is it in wave numbers it is 200. So, you see the frequency is much more. So, the vibrational levels are very far apart vibrational levels are separated by 2500 wave numbers while temperature is rare this is 200 wave numbers. So, you do not have enough energy to access excited states at all and therefore quantum mechanically you get a quantum partition function of 1. So, that is how we understand partition functions. So, in summary, today we have looked at partition function and looked at what its physical meaning is it is essentially the number or the volume of accessible states at a given temperature. We have looked at the quantum partition functions today and we are going to use the same classical formula for translation and rotation, but for vibration we will use a different formula when it comes to quantum mechanics which is 1 minus e to the power of I apologize there is a little mistake this is beta h bar omega. Thank you very much.


Hello everybody hooded co recommender 788 here and I am happy to announce the question and answer video for 2019 This is a tradition on this channel We've had it going for a few years now the last video of the year is always an answers video for a Q&A I wasn't sure if this is a tradition that we would keep going because I do a weekly Livestream now and that gives viewers an opportunity to ask a question and get an answer in real time But maybe not everybody can make it to the live stream So maybe some people still want to do a Q&A video So we're gonna try it and we're gonna see how it goes and now is the opportunity to ask your question If you want to ask a question that will be answered in the answers video Make sure you type your question as a comment on this video in YouTube Don't ask your question on Twitter or Facebook I'm trying to keep everything in the comment section of this video that way everything will be in one place And I won't miss anyone's question even though you can ask almost any question you want I will be ignoring questions that are too personal or are Insulting I will also be ignoring any comments that are not questions So if you want your question answered make sure you ask a question The question period will start as soon as you see this video, which should be on December 16th It will end on December 22nd and the answers video will go up on December 29th So yeah, that'll be the last video of the year as it usually is So go ahead and start typing your questions And we'll see how it goes Maybe this will be the last time we do this Maybe the live streams have made these Q&A's obsolete But we'll see how it goes and we'll see if this is a tradition that we will keep going So go ahead and start typing your questions right now in the comment section of this video I can't wait to see and answer your question So let's get it started and we will see you again on the 29th for the answers


Since 1947, the United States Air Force has realized the potential of air power to defend our country, our citizens, and our friends. Our mission is to fly, fight, and win. Air power, anytime, anywhere. The adversaries we confront today are constantly changing and adapting, and we must do the same. Our focus as airmen must be to challenge the status quo, to make necessary improvements in our Air Force today, so we are ready for tomorrow. To accelerate change, four action orders have been developed that focus on airmen, bureaucracy, competition, and design implementation. These orders will help guide the force into the future. Bureaucracy exists in most large organizations to include the Air Force, and is a necessary reality to help address complex problems. Inbalances in organizational structure and subpar bureaucratic processes, however, can stifle innovation and hinder effectiveness. To go fast, empowered airmen are executing action-ordered bureaucracy and cutting through processes and layers that don't add value to Air Force operations. For example, airmen across the force recently used the Enterprise Decision Rights Process approach to refine more than 800 work streams into just 226 processes. Their challenging of the status quo has helped speed up decision-making timelines and processes that make the Air Force faster. This was the case at Royal Air Force Milden Hall in the United Kingdom where two empowered airmen took it upon themselves to eliminate hard copy forms and old-school data in an effort to improve availability of aircraft readiness data. Their innovation and willingness to accelerate change also saved the 100th Air Refueling Wing $120,000 and 2.5,000 labor hours annually. Fine-tuning operations like these and eliminating unnecessary bureaucracy will take consistent and purposeful action from every echelon of our force. Ultimately, this will ensure we are able to continue outpacing our competitors' decision cycles and undoubtedly preserve our efficiency and effectiveness as the most dominant and respected Air Force in the world. Accelerating change is critical and speed is paramount. Every airman is key to developing the force we need, cutting unnecessary bureaucracy, understanding our competition, and innovating new ways to reshape the design of our Air Force. We must accelerate change. All airmen have a role in shaping our future. Together, we will succeed.