Welcome, ladies and gentlemen, and thank you for joining us. I try to avoid those words that too quickly become cliches. One of the recent ones is icon. But because it applies tonight, I'm going to announce that we're in the presence of one. You're in the presence of a lot of history tonight. And Purdue University is so very, very proud that George Schultz, soldier, professor. I'm a soldier. I'm a Marine. See what I care? This is not a game. This is a weapon. So keep your questions short and polite. We're so fortunate and grateful that he's come to share this next hour with us. And as many of you will be veterans of these, but I've got a few questions that I would like to ask to get us going. But after we have for a little while, there are microphones to your left and right. Summon your courage and come on down with a concise question, something that ends in a question mark, please. And we'll cover as much ground as we can. You're rarely, if ever, going to be in the presence of someone who has lived a life so far, nearly so accomplished or varied. So let me start there. Mr. Secretary, you have been at various times in your life an academic leader, a professor, a dean. You have been a business leader for quite some time, by the way, of a Purdue-led company, the Bechtel company. They're all boiler makers. And you've also been in, you've had extensive service in government, academia, business, what a bizarre background. What's the difference? They're very different. I quickly learned in government, if you tell somebody to do something, you don't have to worry about it too much. Because if they don't like it, they'll leak it to the press or go to the Congress or something. But in business, you have to be really careful. Because if you tell somebody to do something, they're very likely to do it. In the university, you're not supposed to tell anybody to do anything in the first place. So I'm telling you. I want a little sound check here. Is everybody hearing us in the back? It doesn't sound as loud as usual. So you who back there, you guys got a volume there. How's that? Better? Yes or no? Where's that vaunted Purdue technology I'm always bragging about? Is that better? This is Purdue, isn't it? You know about this kind of thing. OK, thanks. Mr.  I don't think anyone else. I'm not aware of anyone else whose life matched that. But the one that most Americans may associate with you most closely was Secretary of State. You led our foreign policy through some of the most eventful and successful years. So let's start there. Take us on what they call a lightning round of the world here. Let's just talk about three or four parts of the world. Tell us what you see and what your take is. Let's start with China. Well, China is nowhere near as strong as people think it is. Here are two of the many reasons. Number one, demography. Starting about 30 years ago, the fertility in China dropped like a stone. The one child policy actually reinforced what was already happening. Meanwhile, the labor force was rising. And people were moving from rural to urban areas. And in that process, productivity rose. So the rate of economic growth is growth in your labor force plus the productivity of the labor force. So they had these astonishing rates of growth, during which time the number of people I had to support was not increasing. Now, that 30-year period is kicking in. That's where the additions to the labor force come from. There's still movement from rural to urban, but it's not quite what it used to be. So the rate of change of labor force is leveling off. And the productivity isn't going anywhere particularly. So the rate of growth is bound to go down. There's no, the more you try financially to rig around with it, the worse it's going to get. So their rate of growth is going to come anywhere near what it's been. And they have geared themselves to a high rate of growth, so they're going to have problems. Furthermore, if you look into Chinese history, you'll see that the safety net for older and younger has always been the family and the community. But now all these people have moved from rural to urban areas. And in that, some have moved back, but mostly they haven't. So they're living in relatively anonymous urban settings. And China has on its hands a completely different kind of safety net to worry about. So China has lots of problems. Furthermore, China has lots of diversity in it, much more than people realize. But the regime realizes it. And they try to suppress it and act as though it isn't there. And in this day and age, I think the principal problem of governance is governing over diversity in an age of transparency. With the information age, people know what's going on pretty quickly. They all have cell phones. They can communicate. They can organize. So you can't ignore the diversity too long. It's going to explode on you. So China has plenty of problems. Not that it's a big, important country. And they have a lot of talent. That's for sure. But it has big problems. Europe. Europe has been trying to be Europe as distinct from different countries. And I think it's been a very important development. Nevertheless, they now tend to overdo it. And they're trying to homogenize these ancient, different cultures. And it won't work. Italians are not like Germans, and they never will be. And then they're like Finns, and they're like Scandinavians. So these ancient cultures, again, they're different. And you have to have a way of unity over this diversity. I remember when they introduced the euro. I was in Berlin with a group.  You're trying to put a fixed exchange rate system over very different economic units. It just doesn't going to work. You're going to substitute relative austerity for letting exchange rates do their job. And that's part of the way it's worked out. So Europe is struggling. And now they're hit with this refugee crisis. And it's a gigantic thing. They don't have much experience in Europe with assimilation the way we do in the United States. So these people come in, and they will be little enclaves, different culture, different language, different religion. I think it's going to be a struggle for Europe. Yeah, their birth rates are lower than the Chinese. And the people coming in have the highest birth rates in the world, at least coming in. It's going to be a different reality if this persists for very long. I think, however, I think that all of us need to face up to the implications of this so-called refugee crisis. Because all of the world, people can see what's taking place. And they say, it's not so good here. It's a lot better there. Why don't I move? And this is not a refugee movement necessarily. It's people trying to get a better life for themselves. And I think that's going to accelerate. And we're going to have to face up to it. In the United States, over the years, over the centuries, we have where people are here from everywhere. I bet if we went down this crowd here, we'd find at least 40 different countries of origin. And that's typical. But we managed to assimilate people and let them have their origins, but still be part of it. I'll give you an example. I have a fantastic granddaughter. And she, girls don't do engineering, right? Well, she did engineering at Stanford. She got Phi Beta Kappa, she's great. And she met a man who she married at Stanford. He is Vietnamese. And his grandmother was a refugee. And apparently, they were in the jewelry business. And she sewed into the hamburger skirt a lot of jewels. That's how she got them out as a refugee. And so here's this grandson. And he gives to my granddaughter an engagement ring. And the jewel is one of those jewels, this grandma. Isn't that a neat story? About how we assimilate people. When they got married, they had a Vietnamese kind of wedding where her parents live not too far from where we have a place. Then it came into a big American wedding. So people can come here and they can still have some sense of where they came from, but nevertheless become Americans. Ronald Reagan put it this way. You can go to France, you'll never become a Frenchman. You can go to China, you'll never become Chinese. You can go to Japan, you'll never become Japanese. But anyone can come from anywhere and become an American. In one day. I might say there's a lot of talk about a wall. You know, we better have that wall because the more Mexicans leaving the United States now, they're coming in. So we need a wall to keep them here because we need them. Russia. Russia is. We thought you fixed this problem. I had a fix, but some other guys took it over. Russia is playing a relatively weak hand very aggressively. And we have to stand up to it and take that aggression down. And bring them back in. Mikhail Gorbachev has just come out with a new book. It's a very interesting book. His observations on when he was there and what's happened since. And I hope Mr. Putin reads it. Probably if he does, he'll execute Gorbachev. Oh, no. But Russia also has a demographic catastrophe on its hands. Longevity for men in Russia is just in the early 70s. Something like 25% of men in Russia died before the age of 55. They have potential explosive situation in the Caucasus. They are very dependent on high oil and gas prices. And those, of course, have crashed down. So it hurts their economy. But nevertheless, they have a lot of weapons. They have a lot of nuclear weapons. Putin keeps talking about them. So it's a very dangerous situation with Russia. It's got to be handled strongly, but capably. And so he's playing a weak hand aggressively, and he's managing to get away with these. Back in the Middle East, the Russians got thrown out. Back in the days when Henry Kissinger was Secretary of State and Nixon was President. Now they're back. I saved the easy one for last. What about the Middle East? The preoccupation with ISIS, which is understandable, is leading people not to be aware of what Iran is doing. Iran is trying to develop a Shiite Middle East. They now have lots more money than they had before and access to weaponry. So they're bad news. They are stirring up the Shiite population Bahrain where we have a naval base. The Shiite population in the eastern province of Saudi Arabia. So there's a big problem there to be confronted, not alone the weaponry that they will be putting in southern Lebanon in behalf of the Zabala. I might say I was in Israel a few weeks ago. And I said to a crowd, including the Prime Minister, that you have to establish the fact, and it is in the Geneva Conventions, that the war criminal is the person who puts the weapons in a civilian location, not the person who hits them. That's sort of a counterintuitive these days, if you. But that's what they do. They put a very explosive weapon in a hospital or a school or something.  It's the other way around. And Israel has publicized where a lot of these weapons are in order to tell the people where they are. It's not healthy to have these things around you. I ought to do something about it. But there's explosive problems in the Middle East, great, great problems. And I think that we have to recognize that for centuries, since the Treaty of Westphalia way back then, we have kept religion and war separated. Now they're joined. And what that means is there's a different kind of war. There is a place, but there's more than one place. And they're tentacles. We had at the Hoover Institution, where I spent my time, we had the head armed forces guy from Pakistan recently. And I was stunned that he was more worried about ISIS than he was about India. I was sort of reassured in a way. Because with India and Pakistan at tension with each other, they both have nuclear weapons. And if there should be a nuclear exchange, it's a global event, not just a local event. Let's pretend for just a minute you're still Secretary of State. I wish we weren't pretending. President's on his way, maybe there, to Saudi Arabia. So just pursuing some of the thoughts you just mentioned. So the Saudis, longtime allies, possibly historically the counterweight to Iran. On the other hand, funders of Wahhabism and the madrasas at which hundreds of thousands of young people are taught hatred and so forth. On top of that, a new reality where they've been displaced by, guess who? Us as the number one oil producer in the world, a rather stunning turnaround. What's your advice to the president as he goes to meet with these folks? Well, he just gave an interview that was printed in the Atlantic magazine, in which he called the Saudis freeloaders. Maybe I wouldn't go under the circumstances, but if that's what you think you're going to, well, they have done a lot, and our allies have done a lot. So the world is imperfect, and you deal with it as you see it, and probably these problems need to be brought out. You need to talk about them. But you need to say to yourself, are we better off with them as allies or enemies? That's an easy question to answer. Thank you. Let me ask a question about how foreign policy, how do you think about foreign policy? How should any of us think about foreign policy? How is it, what's that term even mean? There are a lot of times when one can't, couldn't answer the question in any succinct fashion, what the policy of this country is. Sometimes it's very obscure to us. You have shaped it in some of the most important eras of our history. How did you approach it? How would you now? Well, first of all, you have to establish the fact that you mean what you say, and you can carry out what you say you're going to carry out. Ronald Reagan had something happen early in his presidency that made a big impact. You remember, the air traffic controller struck, and people kept running into the overlap. Mr. President, Mr. President, this is very complicated. He said it's not complicated. It's simple. They took an oath of office, and they violated it. They're out.  These are the air controllers. But one of the things he learned as governor of California is you've got to pay a lot of attention to execution. And he had a secretary of transportation, a man named Drew Lewis, who had run been chief executive of a major transportation company. So Drew understood the problem, and he also knew how to get something to happen. And he kept the planes flying. And all over the world, people had to say, you know, watch your step. The guy plays for keeps. So he established early on, and he established, as he went along, we established the credibility of, we mean what we say, and we can execute. I might say, earlier I told you I was a Marine. I'm a Marine. But I can remember at the start of World War II, I was on the Marine Corps boot camp. Sergeant hands me my rifle, and he says, take good care of this rifle. This is your best friend. And remember one thing. Never point this rifle at anybody unless you're willing to pull a trigger. No empty threats. Boot camp wisdom. We've got empty threats littering the landscape. So boot camp wisdom, mean what you say, execute. Second, be realistic. No rose-coated glasses. Describe the situation as it is. You describe Saudi Arabia realistically, OK? That's where you've got to start, realistically. That doesn't mean you don't see opportunities when they're there, but you're realistic. And then third, you need to be strong. And you're not going to be really strong militarily unless you have a strong economy. And there are a lot of things we can do about our economy, I think. But you have to be strong, not only militarily, not only economically, but strength of purpose and self-confidence. You've got to have that. And then you have to say to yourself, what is our agenda? What is it we're trying to achieve? Don't start thinking about the other guy's agenda, or you'll start negotiating with yourself. What's my agenda? And then on the basis of that, I'll engage. So that's the way to go about it. You must have applied those principles because you presided over many great successes. Maybe one that'll be best remembered was the dramatic reduction in nuclear arms, which you and your colleagues and the president eventually affected. I remember serving at the time when you all went to Reykjavik, a very climactic series of events, very dramatic. But it worked out well in the end. And I'm curious to know, hear a little bit about that, how it looks with the perspective of hindsight, and in particular, missile defense, over which those talks broke down temporarily. But to me, it doesn't look like a bad idea in an age of rogue nations, nuclear armed and testing missiles. What's the legacy of Reykjavik and what do we need to do today? Well, as you mentioned, missile defense, Ronald Reagan once went to the Cheyenne Mountain Air Force Place. It's a dazzling place we've ever been there. If you have a chance to go go, the whole world out there and they see what's going on, you're just blown away by it. So he was there. And as he was leaving, he said to the general in charge, what would happen to this place if a Soviet nuclear weapon hits somewhere near here? The general says it would wipe us out. And the president says, well, what can we do about it? The general says, nothing. Didn't seem like a very good answer. It's not that if there is a huge offense, many, many weapons, there's no way anybody's going to take them out. But if you've got a few, probably you can develop a system and maybe we are somewhere developing a system that can do something about that. After all, Israel has a so-called armed dome, which doesn't work perfectly, but it works pretty well. So that's something worth working on. The Soviets were very concerned about it. They thought probably we were further ahead than we were. And there was a proposal that we both agree not to deploy anything for seven years. And President Reagan was thinking about it. I said, Mr. President, you're giving them the sleeves and give us. We don't have anything to deploy. So he liked the idea of giving them the sleeves for the best of the negotiation. But Reykjavik happened in an odd way because there was a commitment that the next summit meeting would be in Washington. And the Soviets said, well, we want to have a preliminary meeting, serve a warm-up. And they suggested either London or Reykjavik. It was an interesting suggestion Both of those are capitals of NATO countries. And we thought, well, Reykjavik would be better because it's isolated and we can focus. So we meet there. This little house, Hopty House, was then very isolated. The security people from each country liked it because they could guard it easily. And downstairs, there's this little room about the size of the rug, maybe a little bigger. And President Reagan is sitting on one end. And Gorbachev is sitting on the other end. I'm sitting beside the president. Shevronazi is sitting here. And they're interpreters. And so we're in this little room for two days. And we talked about everything under the sun, nuclear weapons, areas where there are lots of stresses. One thing that came out of it was in a negotiation on the night between the first and second day, a wonderful assistant secretary of State Ros Ridgway, she negotiated the first time an agreement with the Soviets that human rights would be a regular, recognized item on our agenda. That was a big thing we were working on. So it was a free-flowing conversation. And in the first morning, Gorbachev basically laid out his Soviet proposals, all of the things we had been advocating in arms control. It was stunning. At one point, Reagan started interrupt. I put my hand on his arms. I just let him talk. He's coming our way. But wound up, we didn't have a formal agreement on anything. But we have seen their bottom line, that they had agreed, basically, that intermediate-range nuclear forces would be eliminated. That strategic arms would be cut in half to equal levels. And that's big-time cuts. And as of the 25th anniversary of Reykjavik, the number of nuclear weapons in the world were a third of what they were then. So there was a lot that happened. But the atmosphere had turned around now. And I'm afraid we're in a proliferation frame of mind. And it's very dangerous, in my opinion. But the Reykjavik was exhilarating. It was an interesting thing. Gorbachev came to Stanford, where I have a home on the campus. And we were just standing around in the backyard. And I said to him, you and I were both around when the Cold War was as cold as it could get. And when we left office, it was all over, pretty much all over. What do you think was the turning point? And Gorbachev said, without a hesitation, he said, Reykjavik. I said, why? Because the two leaders got together and talked about everything for two full days. And he said, what do you think the turning point was? Said, I think the turning point was when the NATO Alliance held together. And we deployed Pershing, that is, nuclear-armed ballistic missiles in Germany that you thought could reach Moscow. That was the turning point. Because they whipped up a lot of war talk around that. And the NATO Alliance stood for that. I might say, not a shot was fired, but that was an exhibition of strength. Strength and force are not the same thing. This was strength. And it's interesting because all the war talk around when it happened and gradually things settled down. And by August, I was able to go to the President and say, Mr. President, four different cities in Europe at a cocktail party, a Soviet diplomat who has talked to one of our guys and said virtually the same thing. We should think amounts to, if Gromyko isn't right, he's the foreign minister. To Washington, when he comes to the General Assembly in September, he'll accept. In other words, the Soviets blinked. And it was kind of fun because he came. It was a huge event. And Nancy Reagan was my pal. She always fixed me up with the start of the White House Center as I got to dance with Ginger Rogers and stuff like that. So I went to her and I said, Nancy, what's going to happen is he's going to come to the West Wing. We'll have a meeting in the Oval Office. Then we'll all walk down the colonnade to the mansion, which is your home. And there'll be some stand-around time. Then there'll be a working lunch. We'll say, why don't you come to the stand-around time? You're the hostess in freedom. She said, OK, that's a good idea. So she's there. Gromyko's a smart guy. As soon as he sees her, he makes a beeline. It's like nobody else is in the room. And after a while, Nancy could bristle. He says to her, did your husband want peace? And she says, of course my husband wants peace. And Gromyko says, but then every night before he goes to his sleep, whisper in his ear, peace. So he was a little taller than she was. She put her hands on his shoulder and pulled him down so he had to bend his knee. And she said, I'll whisper it in your ear, peace. So I think Nancy won the Cold War right there. So it's about time. So if there are, and there must be plenty of you who have something you'd like to ask the secretary, let's head for the mics. I'll ask one more question as you line up. You said that a nation can't be safe without being strong, can't be strong without being economically sound. We have some issues there. How big an issue do you see our growing national debt to be? Both you're a professor of economics, first economically and then second in terms of the governance, the fiscal capacity of the country to do things that's collectively that we ought to do. I think that's a big problem, but only part of it. The debt is very high, but we don't feel the burden of it because the Federal Reserve has kept interest rates practically at zero. But interest rates get to even a semi-normal level, like 3% or 4%, and the burden of that debt will a significant portion of the federal budget. And then you've got deficits continuing as a result of the entitlement programs. So we have to get hold of the entitlement programs in order to have any money left to the federal government to do anything except pay off the debt and do an entitlement. So it's a thing that's necessary to do. Conceptually, it's not hard, but politically, it's very difficult.  I wish. So let's start over here. Hello. Awesome. Mr. Secretary, thank you so much for joining us. My question is regarding the serious of a war. So as you know, it's been ongoing for about five years now. And earlier in the war, President Obama made statements kind of saying like, well, we're going to take a very strong stance on this. We're going to have these red lines, which were repeatedly crossed. And so you mentioned a couple of times that we as a nation have to kind of stand up and mean what we say. So in your opinion, how should we as a nation have handled kind of the ongoing conflict over there? And from the beginning, and maybe now, how can we handle it better now? Well, you mentioned that incident where the president drew a red line and said, any use of chemical weapons will cause us to make action big time. And the red line was crossed and nothing was done. So credibility went out the window. Nobody paid attention. Boot camp wisdom. Remember that sergeant? He had it right. And we have to rebuild our credibility. But I think we should have recognized earlier, and I know because each have told me that Petraeus, when he was head of the CIA, joined with Leon Panetta, who was Secretary of Defense, and Hillary Clinton, who was Secretary of State. All three went to the president and said, we should intervene in Syria early on when the rebels were the objectors to Assad were clear and intervene, and he turned that down. I think that was a mistake. We could have achieved something then. Now it's very much involved in the Shiite conflict. And Iran is heavily mixed in with ISIS, and it's a total mess. So it seems to me we need to be stronger. I see Ash Carter over there, the Secretary of Defense, who I might say I admire. I think he's a very good guy. I know him pretty well. And we're trying to build up our capacities to help the Iraqi army. And maybe we'll get a little more. We have air, strength. We have to think about our rules of engagement. As I mentioned earlier, the person who puts a weapon in a civilian location is the war criminal, not the one who takes it out. And there are a lot of places that we could go after that we're not doing. A huge number I've read of our bombers come back with their payload intact because it's been determined the place that we're going to bomb has civilians there, and they don't bomb. And I think we've got to say something like civilians, you better get out of these places because they're going to be targets. And so these are things we should be doing. But I think also we have to look around and clearly in the face and realize what's happening there. And in the Iran deal, as a result of that, the Iranians have a lot of more money. And they have access to markets for arms. The Russians have sold them first class air defense capabilities. So we have Iran on our hands as well as ISIS, and it's a very tough situation. I think it's impossible for me to conceive that Assad could be a legitimate leader because he has slaughtered his own people in very large hundreds of thousands. How can anybody have legitimacy under those circumstances? So once again, we're at odds with the Russians, with the Iranians, who are propping him up in Hezbollah. So we have a big problem on our hands. And furthermore, as I've said earlier, the joining of religion and war means it's spread out around. So we have to understand that and realize these tentacles are there. And some of them can be right here in the United States, as in San Bernardino. And it's a big problem. Thank you. Thank you very much, sir. I have a question about climate change. So in a world where we have the greatest historical contribution to climate change, but currently China is the largest emitter, and India is growing rapidly in their emissions, what do you think the role is for the United States? What should we do? Well, first of all, I think it's important to realize that the climate is changing. It's getting warmer. And there are people who say it isn't, or it's something that always happens. I don't believe that. We have a guy at Hoover who's recently retired as Chief of Naval Operations, so he pays attention to oceans. And there's a new ocean being created in the Arctic. That hasn't happened in a long time. Why is that happening? All the sea ice is melting. And it's also engine. It goes along, belting out an engine, and then all of a sudden there's an inflection point. So you've got to watch out for discontinuities. The ice sheet over Greenland is melting. Big swabs of ice in the Antarctic are going into the sea. So you can observe the effects of a warming climate. It's happening. And I think the evidence is pretty clear. And the conceptual basis is clear that carbon is the main source of the problem. So we've got to do something about that. I think we are doing a lot, probably are doing a lot of Purdue. I am chairman of an advisory committee at MIT on their energy program. And I've watched the one at Samford. But the R&D is going on at a much greater rate than ever before. And it's being very productive. Solar energy is coming on strong. Batteries are improving greatly, and so on. There's a guy at MIT that I think is about to give us large-scale storage of electricity. That's a revolution. Because it takes the intermentancy problem away from solar and wind. But also from a national security standpoint, with our grid so vulnerable to cyberattack, that's good to have something in place that keeps you going. So I think that we should sit down with the Chinese and say, first of all, make a deal that handles the intellectual property problem. Let's get that taken care of. And say, let's identify everything we can find to do, not aspire to by 2025, but do today. And start putting things into effect. The Chinese are anxious to do it. They're choking themselves to death. So they're ready to work on this problem. And as others see us doing things that are working, they will want to get in on it. Fine, come on in. The water's fine. So we need to really get that going. And I think the other half of what I would do, in addition to R&D, is I would put a price on carbon. Let's call it a tax, be honest. And all this other regulatory business, put that aside and just put a price out there and let the marketplace sort things out. What I've advocated is a revenue-neutral carbon tax. So it's not a way of raising money. It's not a pot for people to do other things with. And it doesn't. It means that you're not, in any way, slowing the economy down. There is a revenue-neutral carbon tax in effect in British Columbia. And one of the reassuring realities is that income per capita in BC has risen a little faster than the rest of Canada. So it didn't shut down the economy. And it's having an impact. So I think that putting a price on carbon and promoting R&D and make it available to people is the way to go. That's a real problem. And we better get cranking on it. Over here. What do you feel is the biggest threat to the United States economically in the next 30 years? Is it the dealing with climate change? Is it the threat of violence around the world? Or is it the social welfare programs that we have here in the United States? What have we like to do next? I think, first of all, we have to think about our own society and our economy. And as I mentioned earlier, between the burden of the debt one's interest rates become more normal, plus the constant deficit arising from our entitlement programs mean that we're depriving ourselves of an ability to do anything. So we have to get a hold of that and get a hold of the entitlement programs. As I said, it's not hard to conceptually to figure out what to do. It's just hard to get ourselves up to do it. The last time anything was done about Social Security was back in the days of Tip and the Gipper. Reagan and O'Neill, they were in the opposite parties. Somebody asked Reagan if Tip O'Neill was his adversary. He said, not after six o'clock. And he could have called Tip up and say, hey, Tip, it's only three, but reset your watch. We've got to get after this problem. So you need people like that who can lead and who can bring their constituent with them, but also can do sensible things that need to be done. So we need to do that. And then we need to realize that it's a tough world out there and we're part of it whether we like it or not. We can't just stop the world. I want to get off. It's there and we're part of it. So there are all kinds of things that we can do, we can lead on. And people need US leadership. That doesn't mean we're the world's policeman or we have to go solve every problem. But when there are major problems, if we come with ideas and readiness to negotiate and work, people respond and they'll follow that leadership. I can see that in all kinds of ways when I was in the government and we were working that way. So people became accustomed to US leadership and all of a sudden it's disappeared. So we've got to bring it back. And that doesn't mean we try to tell everybody what to do or we try to solve every problem. But whether there are problems, we have some ideas and we come to the party with these ideas and we're ready to work on it, listen to other people and try to find a solution. That's the way to go. Thank you. Yes, Mr. Secretary, I'd like to thank you for your many years of service to our country. My question pertains to Cuba in the recent fall in I guess relations and engagement with that country. I know you've advocated that in the past or I believe you have and I just want to know what you thought where we're heading with that and if dialogue and engagement is definitely the thing to do there given the Cold War supposedly and it's a long time ago. I think it's about time. During the Cold War Cuba was a Soviet base. So obviously we had an antagonistic relationship but that's over. And it doesn't make any sense to have this embargo and the strained relationship. So I'm glad to see things softening up. I think we probably could have driven a little harder bargain on some of the reprehensible things that are being done in Cuba but I think it's a good thing to be opened up and have more interaction and I think the chances for a succession to the Castro's being more sensible and more open than they are is much greater if we have more openness than if everything is closed. So I say good. I remember advocating this one time at a Republican convention some years ago, maybe 10 years ago, when you get through something people come up and they want to talk to you. Nobody came up. And when I walked out there was a large swath. Nobody wanted to get that picture taken with me. That won't happen tonight. Mr. Secretary, I have a question relating to the first topics we covered at the beginning of this. You spoke about these localized internal problems in China, Russia, Europe, and the Middle East. I'm curious to know your thoughts on how you think these parts of the world should go about trying to fix these problems that they found themselves in today. I think what you have to aspire to do is figure out how you let these different pieces express themselves and at the same time keep them under an umbrella. The first time I went to Israel was in 1969. And I was lucky enough that the iconic mayor of Jerusalem, Teddy Collick, took me over for the evening. And we went to one party after another, all different. It wasn't Jews and Arabs. They were all kind of Jewish groups, all kind of Arab groups. And all of a sudden he took me to his office. And I really just thought he was teaching me something. And he said, my job as mayor of Jerusalem is to see that Jerusalem is a beautiful picture. But it's not a painting like you think of a picture where the colors emerge. My beautiful picture is a mosaic. So you've seen all these groups. It isn't Jews and Arabs. They're all kind of Jewish groups, all kind of Arab groups. And my job is to see to it that they can all express themselves as they want. As long as they do it in a way that doesn't interfere with somebody else's ability to express themselves. And they're all glad to live under what he called the golden dome of Jerusalem. So he was governing over diversity, and he understood it. It's not understood in many places, hardly any. It's interesting that if you look at the history of our own country, our people who worked on our early government understood it. There's a historian by the name of Ellis, and he wrote a book I've read recently. And I hadn't realized there were about six years when it was a question whether we were going to have our country or not. Because the states were so jealous of their individual responsibilities and capabilities. It was only when George Washington, Madison got George Washington to agree to be the head of a constitutional convention that people would come. And they worked out what was then a totally unique form of government, a central government with checks and balances so nobody could have too much power. And then practically everything that would affect your daily life was left up to the states and localities and individuals. That meant that they recognized this diversity and they governmentally set it up so that diversity could express itself. But under an umbrella of a federal government that would worry about foreign affairs and security affairs and things like that. So it was a good conception. I think what has happened more and more is that the federal government has been encroaching on this space. And whenever the federal government moves, it homogenizes across the US. And the US is very differentiated. And so I think there's starting to be some pushback on that, Governor. And maybe we'll. But that's the basic problem. It's a hard problem. But nevertheless, you've got to let it happen. But figure it out. Over here. Mr. Schatz, thank you for coming here. I have a comprehensive question which broke down into several small questions. Let's try to make sure that we'll be very brief. Let's go with the comprehensive version. OK. You mentioned that everybody can come to America and be an American. However, America is a very prosperous Christian nation, at least, according to our survey. 60% of Americans think America is a Christian nation. And about half Americans, only half of Americans have favorable views towards Muslims. Only 64% of Americans would welcome a Hindu temple or mosque to be built in their community. How do you think religion plays a role in the development of America? And do you think religion limits the freedom of Americans or welcome more freedom? Thank you. Thomas Jefferson, at the time of the Constitution, arguing for freedom of religion, said, divided we stand. And in our early days, we recognized there would be different religious groups. And it was important to let them be there, express themselves, as Teddy Collick put it, in a way each expresses itself as long as it doesn't interfere with somebody else's right. And have them all acknowledge they're glad to be living under the general umbrella of the United States. So it's hard, even here. And people are nervous about the Islamic side of things. I thought when George W. Bush was president after 9-11, the first one of the first things he did was he went and visited a mosque. I thought it was a good gesture on his part. And we have to recognize that there are Islamic terrorists. But so we have to deal with that as a problem. But that doesn't mean all Islamists are terrorists or we should want to shut out Muslims. Thank you for an excellent question. Mr. Secretary, the overwhelming historical record demonstrates that countries that have adopted socialism have eventually experienced economic and social disaster. And yet, to today, thanks to the influence of demagogues like Bernie Sanders and even many academics, socialism is portrayed as some idyllic and utopian solution. And my question is, how can we, as an educational institution of society, convince the upcoming generation that free market economics provides the best opportunity for them to reach their God-given potential and to create a better world? A little history helps and comparative studies helps. So these people have tried. I'm reading a fascinating book right now entitled, Stalin. And I hadn't realized how messy the situation the czars left behind was and how the incoming Lenin, Stalin crowd, how they had reaching around. And they were constantly worrying about enough food. And they were confiscating it from peasants. And then why didn't the peasants grow more? I mean, it's just, it's all there. So history is a place where you can learn. We can learn from ourselves because we had a period of wage and price controls that were a catastrophe for the country. And so you can look at that period and you see for yourself. I was director of OMB when I could feel the pressure for wage and price controls beginning to build. And I gave a speech called, Steady as You Go. And I argued, we have the budget under control if we have a sensible monetary policy. The rate of change in prices will gradually come down. So have patience, Steady as You Go. Then we had to close the gold window. And a very active secretary of the Treasury, John Connolly. He was a, I remember hearing him when he was coming on. He told the press secretary, asked him how he felt about some issue. And he said, Ron, I can sell it round or I can sell it flat. So we got a salesman here. So we had wage and price controls. They didn't report to me. But when I became secretary of the Treasury, they did. And guess who was running them? Don Rumsfeld and Dick Cheney. I told them I don't see that on your resume. But anyway, we were trying to get rid of them. And President Nixon, some things happened. And he decided to reimpose them. And I said, well, Mr. President, it's your call. But I think it's a bad mistake. So you've got to get yourself a new secretary of the Treasury. I left. But the wage and price controls didn't leave. They stayed. You remember Jimmy Carter's gas lines? They're still there. And finally, on the third day of Ronald Reagan's time in office, he abolished what was left of them and ended the bureaucracy that was administering them. But we had a period of about a decade during which those controls were there. And it was a catastrophe. Bad decade, member stagflation, all this stuff. It was a bad. And it was produced by these controls. I might say, in our health care system now, to a certain extent, we're trying to control costs by wage and price controls.  So you get less supply and more demand. You don't have to take, again, always 101 to know that's a problem. So we're already seeing a two-tier system emerge where a lot of doctors won't take Medicaid or Medicare patients. And it's obvious that we're going to have to make a change. So I think a little history will help a lot with that problem. Thank you. By the way, I think we've got, I'd see four. And we've got just about enough time. If everybody gets to a question quickly, I think we can dock this ship right on schedule. All right, well, first off, thank you so much for being here, Mr. Schultz. Here's my question. So during your lecture, you described how meeting of the leaders, Reagan and Gorbachev, at Reskevic, helped the Cold War reach a nonviolent resolution. Do you think the same kind of negotiations or two leaders meeting with each other could help solve the problem of nuclear weapons in Iran? Well, they did have a negotiation. And I think what you can say about the nuclear deal is it kind of postponed when Iran can get a nuclear weapon, but it also kind of affirmed that it was on a path to get one. So I think you're going to see a lot of pressure. I don't know what the president is going to talk to the Saudis about. But I don't know this. I have no intelligence. But I would be stunned if it were already a deal that they can get a nuclear, Saudis can buy a nuclear weapon from the Pakistanis. So you can have a proliferation, and that's a big problem. And I think we have sort of lost track of what a huge thing it would be if a nuclear weapon goes off or if there's any kind of an exchange. It can produce a nuclear winner. And your agriculture has a very hard time. It's a disastrous thing. So we have to figure out a way to get control. Now, President Obama has chaired four, has worked on this issue, and he's had four meetings at the head of state government level. So that's a hot level. And the object of these meetings was to figure out how to get better control of this raw material. That's the key. Once you have this raw material, you can make a weapon. Most of your Purdue engineers can figure out how to do it. That's not the problem. The FISA material is the problem. So it's very important to work on this issue. I put the possibility of a nuclear event alongside climate change as the two biggest things that can threaten our civilization. So we've got to get at it. We're not doing very well right now, I don't think. Yes, sir. Secretary Schulz, thank you for being here. It's an honor to hear you speak. I wanted to ask you to comment on a couple of statements or the same statement that you made a couple of times about the mixing of war and religion and how that is becoming more and more of a threat for civilization itself. Do you think our policy during the Afghan war was not well thought out, or maybe now that we have the luxury of hindsight to see that regularly taking Saudi Arabia and Pakistan as active partners and employing Islam as a tool of fervor for the Jihadine then and Taliban now was part of what we have brought upon ourselves in the later years? I think the policy of supporting the Majidine and helping them make life miserable for the Soviets in Afghanistan worked, and they got out. And it sent a big message to the captive nations all through Europe that change could happen. So it was a huge event. Undoubtedly we should have stuck with it more. As the Cold War ended, we left Afghanistan and just didn't pay attention to what was going on. So I'm not saying that we could have done a lot, but I think we could have done better than has happened. These last two. All right. I thought this question would have been asked before I got up to ask it. But we have a presidential election coming up this year. Could you comment? We're in the midst of what I call electile dysfunction. Could you comment on the process and perhaps the survival of the two-party system in this country? It makes you yearn for the good old days where we had the smoke-filled room. And you had people who were knowledgeable, and they got together, and they wanted a winner. And they had their different ideologies, but that's what they tried to produce. And where we're going to go with this right now, it's hard for me to see.  There'd be somebody there I could vote for with enthusiasm. So we've got to somehow sort this out. And just where, how it's going to go, I don't know, but it doesn't look very good. I told the Secretary earlier today, just as it happens, I was doing more or less this for former Secretary Panetta, who he mentioned earlier, last night out in California. And Secretary Panetta told the crowd that he'd seen his former counterpart, former Canadian defense minister recently, who said, we're worried up here. There's so many Americans talking about leaving for Canada. We're thinking about building a wall. I'd just like to say that when I graduated from high school in 60, and joined the Young Republicans Club, that President Nixon was the very first president that I ever voted for. And I watched all of the Watergate hearings, and I thought that 13 minutes lost in the tape was nothing like we've seen now, especially when Clinton was in the Oval Office, and he was on the phone, and a young woman was picking up a paperclip, I guess, under the desk. And I want the sovereignty of the Lord to come back, and he has a plan for us, and God's plan for you has been, it gives us all in a state of awe, that there are men like you that come forth and serve not only your country, but you're serving every single person in this wonderful nation that keeps us just safe and sound as possible. But with Saudi Arabia and then funding 80% of the mosque and Yasser for democracy for Muslims, what can we do about these young men and women? What could we do in this nation to help really get to that problem? Thank you. It's hard, because it's sort of like needles in a haystack, and you've got to figure out where they are and then do something about it, but we need to understand that there is a problem and that it doesn't mean that you put a blanket over it, but you've got to work at it with some care. I think it's, but it's a hard problem. You mentioned President Nixon. He was a strategist, and all anybody associates with him is Watergate. But let me mention, just to give an example of things he did. In 1970, this is 16 years after the Brown decision. He decided there was still, the schools were legally segregated in seven southern states, and he decided it was time to end it. It was a Nixon initiative. He said it's right morally and it's right constitutionally. And I was his point man to execute it, and I worked with him on it, and he was wonderful. He pitched in. He was part of our strategy. He stood up to the problem. So I say Nixon had his foibles, but he also had some good sides, so I'm glad to hear you mention them in a good way. So I'll thank you very much. So I'll bring us to a close by asking a question. I thought somebody else would ask, and really it's not facetious, because we're headed for, we're already in an age of escalating longevity, and I firmly believe that the students on this campus, barring cataclysm of some kind, are highly likely to live to three digits and beyond. It's going to change life in so many ways. So the question I know a lot of these folks are thinking, Secretary is, what's your secret? Well, Charlotte, stand up. Here I am 95 years old, and look what I have for a wife. Don't get yourself a good wife and a good family. I have 32 and roughly a half members. I have five children, 11 grandchildren, and four and a half great-grandchildren. So it's so much fun to see little kids around again, because you know they're in a hurry, they don't walk anywhere they run, and their life is exciting. And they're curious about everything, everything. What is this?  And what can I do to make it better? So that kind of motivation keeps you young and keeps you moving and gives you something to work for. In 1942, as young men did then, George Schultz graduated from an elite institution and immediately went and listed in the United States Marine Corps and served in the Pacific Theater, I guess till the end of the war. He's been serving America in one capacity here and there every day since, and we are all so fortunate and so grateful. Thanks for being with us.


All right everybody, let's get started. So before we go into the content that we'll cover today, let's first do a quick recap of what we talked about last time. So last time we introduced the VM interface. So for kernel, the VM are supposed to manage all the physical pages. The VM are supposed to give the kernel some pages and later on when the kernel returns the pages back, the virtual memory system are supposed to be able to recycle and reclaim the pages. And also, when you deal with user processes, you often need to play with the red spaces. And that part is also the responsibility of the virtual memory system. And for the user, actually, the user won't realize any of the existence of these allocator pages, recap pages, and so on. For the user, the user, excuse me. OK. The only thing the user cares about is that when you want to access some page, it will trigger some page fault. And how the virtual memory system will handle that page fault, whether to reject the request or to actually add some physical pages to fulfill the request. And finally, we have a syscall that belongs to the virtual memory system. It's called sbreak, which basically manipulates with the heap space. So this is the virtual memory interface. So this is to the outside of the world, whether it's other part of the kernel or the user space, what the virtual memory system is supposed to do. And last time, we studied DanVM. How does the DanVM fulfill all those responsibilities? So we know that the DanVM does virtually no physical page management. When the kernel wants to allocate some memory or allocate some physical pages from DanVM, it's just called ram-steal-memory, which just steals the memory without returning to the RAM. And so that's the physical page management of DanVM. And for user address space, DanVM makes some very strict assumptions of what the user address space looks like. It assumes that the user address space always have fixed number of regions, which is two. In this case, it's code region and data region.  And it doesn't support heap. So there is no heap region, first of all. And there is no sbreak syscall support. And finally, DanVM doesn't support swiping, which means that when it run out of all the physical pages, it will just panic instead of do some smart thing like swap some pages out. So this is how DanVM fulfills all those virtual memory interfaces. Obviously, you want to improve upon that. By that, I do not mean that you can adapt DanVM. So study DanVM is helpful to get some idea of what the DanVM system looks like. I would suggest you, when you design your virtual memory systems, you start from scratch instead of incrementally try to improve DanVM. Because if you do that in the later stage, when you do swiping, it's kind of very difficult to further approach the limit of DanVM. So you want to start from scratch at the very beginning and have a good start point. So this is what we talked about last time. Today, we will mostly focus on the physical patch management part. In particular, we want to see how does the virtual memory system boot boot bootstrap. By that, I mean that how does the virtual memory system figure out how many pages are there available for me to manage it and all that. So we will study the data structure here, which is very important in the physical memory management system, which is called call map, to manage all the physical pages. And then we'll look at what the possible state of a physical patch could be. And it's very important later on. But for now, it's kind of obvious whether it's available or not. But later on, it may have other state which you need to think of. And finally, we look at how the MIPS actually treat the how does the MIPS memory management unit works? How does the MIPS translate all those virtual addresses? This is not necessary for this assignment, but it's very helpful for you to work on this assignment for you to know when you deal all these virtual and physical addresses, you know what you are dealing with. So first, how VM bootstrap. So initially, if you think about it, you have this many physical pages, say four megabytes of physical pages, even before the system bootstrap. So you have this many number of pages. And when you type the command sys161 kernel, actually the simulator will try to load the kernel image to some part of the physical memory and start running from there. That's why kernel, that's how kernel gets running. So suppose this is all the physical pages you get. You have physical address zero. You have physical address, let's say it's four megabytes. In this case, that four megabytes will be assigned to a magical variable called lastp address. So if you look at some assembly files, you may get some idea of what's the actual physical layout. In this case, this detail doesn't matter much. But conceptually, at the very beginning of the physical memories, you have some exception handlers stored in there. So whenever there is some exception, the hardware will first set the EPC to some virtual address mapping to this region and start handing the exception. So this part you don't need to worry about. This is already handled. So then after that, the kernel is being loaded to the memory right after the exception handler. Say the kernel size is like 50 kilobytes, then this 50 kilobytes will be occupied by the kernel code, right? So the kernel's main function may be somewhere here and the processor just start executive instructions from there. And at this point, you already know that the first function get a code when the kernel startup is called the Kman function. That's the first C function that gets called. And it's somewhere here, it's kernel code region. And inside C main function, sorry, Kman function, it will do serialize a series of bootstrap functions to initialize different part of the system. And you will notice that the first part that the kernel tried to initialize will be the RAM system. And if you look at the code, here I have the main.C open up. So this is Kman function, it first called boot. And inside boot, the first function to code is here, RAM bootstrap, right? So the first priority of the kernel at this point now is to figure out how many resources are there for me to use, right? If you go into the RAM bootstrap function, you will find that. So it first called the function called RAM size, which is a low level function that provides how much physical memory are there available in bytes. And so we do something. So here you can see that LASAP address is actually assigned to the size. So if the size is four megabytes, then the LASAP address is four megabytes. Then it will calculate the first available physical address. It's very important to note that this first available physical address is not zero. As you already see in the slides, zero to, there are some portion of the startup of the physical address is the exception handler. Right after that you have some kernel. So the first available physical address is actually after the kernel. You can see that it's first free, which is the magic symbol set by the linker and assembly language, which indicates the first free available virtual addresses. And somehow it is mined, it's subtracted that by this macro, which is K segment zero, which OX element, we will explain this why you subtract that to get the physical address. So now for now, just ignore this part and you have LASAP physical address, which is the memory size, physical memory size. And you have the first available physical address here. So now when you do ramplestrap, you first figure out what's the region of the memory is available for you to use. So this is what the physical memory looks like and what's the value of each variables right before ramplestrap. Or actually right after ramplestrap, because ramplestrap are supposed to initialize these two variables. So this is the physical memory it looks like right after ramplestrap. And you will notice another thing is that actually the VAMplestrap function is called at the very last of the boot function here. So after ram you have thread, you have clock, VFS and all that. And finally, you have VAMplestrap. That's not the last, but it's quite at the late stage of initialization, right?  Some of them we'll call Kmalock, which is intuitive because when you want to initialize, you often try to allocate some structure and then initialize them, right? So when they call malock at this point the VAM system is not bootstrapped yet. So Kmalock will call get, allocate K pages, which is to allocate physical pages to some other part of the system. And if you look at the implementation of allocated K pages, it will call get a P pages, which we'll call ram-steal-memory, right? If you go to the definition of ram-steal-memory, you will find that they just keep forwarding the first physical address, right? So right before ramplestrap, the first physical address is here. So from here to here is available physical memory you have. And then if some other function called Kmalock, which at the end will call ram-steal-memory, then what the ram-steal-memory does is keep forwarding this first physical address, right? So this part is actually stolen by various part of the system, right? And when you reach the VAMplestrap, the first physical address will be here, right? So this part is actually stolen by, we don't know what other part of the system. And when VAMplestrap get called, this is what you have. From here to here is the available physical memory you have. And it's very important to figure out where that is. And you already know that because you can have first physical address and last physical address to identify the region of physical memory that is actually available. So inside VAMplestrap, what you're supposed to do is that you allocate one extra data structure which is called call map right after this stolen physical region. So this is, when you allocate the call map, this will be the last time you call ram-steal-memory. You steal this amount of physical memory and they store your call map there. And from here is actually the real free memory after VAMplestrap. So inside VAMplestrap, you will allocate this call map data structure. You initialize this structure and after from there on, the allocated key pages are supposed to work in the sense that the allocated key pages should stop calling ram-steal-memory. Instead, it should call your allocated key pages function which consults a call map data structure to figure out what's available physical pages are there is available for me to allocate. So if you go over this process, you will find that you need some information to know, for example, inside allocated key pages. That function can be called before VAMplestrap or after VAMplestrap, right? If that function is called before VAMplestrap, there's really not much you can do about it. You just do what VAM does, which is you call ram-steal-memory to serve the request, to kind of give some physical memory for other part of it to use. Once VAMplestrap gets called and after that when allocated key pages get called, instead of call ram-steal-memory, you should do some smart thing like consult the call map to figure out what's available, our physical memory are there for you to allocate, right? So you should have some flag to indicate that whether or not the virtual memory system has bootstrapped. If it's not a bootstrapped, then you just call ram-steal-memory. Don't feel guilty about that. And after that, after VAM gets bootstrapped, you should consult the call map to allocate the physical memory. So this is how the physical memory, the view of the physical memory changes in the bootstrapped process. Any questions about this?  After that, you have some, a bunch of available physical memories. Any questions? Now, so the thing is VAM bootstrapped, VAM system rely on other part of the system. For example, you will want to synchronize the access to your call map. To do that, you may want to allocate some lock. To allocate a lock, you should have the stress system already working. Otherwise, the lock doesn't really make sense. So there's some dependencies there to force the VAM bootstrap in that order. So you cannot just bootstrap the VAM earlier. So you don't want to change the bootstrap order of the boot function. That's very critical. So you want to try to accommodate that and do things on the existing framework. So this is the VAM bootstrap process. So now let's take a closer look at the call map. As we already said, call map are allocated right after the stolen memory, which is here. So call map should be a list or array of entries. Each entry corresponding to one physical page. That's how you manage things. You allocate one small entry or small metadata for each physical page, and they store the metadata information in there. So call map is consisting of array of metadata entries. Each entry corresponding to one page. And if you look at entries, say you have four megabytes of memory. With 4K pages, you have how many pages? Four megabyte divided by 4K, one K. You have one K physical pages. Then the length of the call map should be what? One K. You have basically one entry for each physical page. So you have this one-to-one mapping to the firm call map entry to the physical pages. And by mapping every physical page, the translation between the physical address and the index to the call map is very easy. I suppose you have physical address, say 100, sorry, 8K. Then what's the index into the call map entry corresponding to that physical page? 8K divided by 4K, which is two, right, zero, one, two. So the translation or the mapping between the call map index and the physical address is very easy or straightforward in this mapping. You have one-to-one mapping between the physical addresses, I mean the page's best physical addresses and the call map index, right? And because these pages are already used by various other part of the system, by accept handler, by the kernel, stolen by other part. So when you initialize your call map, not every page is available, right? Some of them is already occupied by others. And you should figure out how many pages are available there and how many pages are already occupied. But to do that, you can first get this first physical address which you have access to and then calculate how many pages are here. Suppose that 10 pages are already occupied. Then when you initialize a call map, the first 10 entries should be marked as used, right? And then the following entries are to be marked as available. This is how the call map looks like and how you should initialize all the call map entries. Any questions on this? This may be a little bit trickier if you really think about it. So the length of the call map is straightforward. There's no doubt on that. Given this much physical memory divided by 4K, you have the entries. But this part, I mean calculating how many physical pages that is already being occupied is a little bit trickier if you think about it. Because you have, first of all, you have some alignment issue, right? You need align this first physical address up to even when the first byte of the page is occupied, the entire page is occupied. That's the first thing. And then when you calculate the first physical address, you need to calculate the length of the call map, right? So that's some implementation details that you need to think about. But the general idea is that you should initialize the call map this way so that after VM bootstrap, the call map reflects what the status of each physical page is, whether it's occupied or it's available, right? Any questions on the call map initialization? Yeah? Yes. The last physical address is the end of the physical address. It's a value, for example, four megabytes. Last physical address there, yeah. That's how many, that's how much physical memory you have. So, we already talked about some of this. So how do you allocate the call map? First of all, there are a variety of ways of doing this. So you can first get a hand of physical address, first physical address here, and manually increment that to reserve space for call map, or you can call RAM still memory. And that totally depends on you. This is some implementation details. And inside of the call map entries, so we have already settled down the overall structure of the call map. It should be a array of entries, and each entry corresponding to one physical page is to recall the metadata of the physical page. Now the question comes to what kind of information you want to keep for each page? What metadata you want to maintain inside call map? Right? So first and foremost, what you want to keep is the status of the call map, right? Whether it's, so for now, the status are quite simple. Whether it's available or not, right? If you do not consider swapping. And then, then what? Pages, do you really need to store that? Like I said, if you do the mapping this way, giving a call map index, how do you find the physical page? Or how do you find the physical address? Yeah, just calculation. It's the same that in the file table, you don't store the FD in the file handle because the index is just the FD. It's the same thing here. You don't need to store the physical address in the call map entry because given the index, you can easily calculate the physical address, right? So that you can just save some bytes there. And what else? Like I said, chunk size, what is that? What's that? Size of what? Size of page? Isn't that fixed? Then why do we, so first off, what's the chunk here? Yes, so I look at the key pages, right? Say I look at the four pages. You should give me four continuous pages, right? Well, you don't have to store the information, but later on when I call three key pages, I just give you the starter address of the first page. So how do you know how many pages to three? You cannot just say three one pages because I allocated four pages for you, right? You need to know, starting at a physical page, how many pages is in the same chunk. So later on when you do three key pages, you can free that many physical pages, right? Then because you don't know where the first page will be because it could be any page, so you need to store this information on every page. Or you need to set up, at least reserve the space to save such information in every call map entry, right? In reality, you don't have to set the chunk size in every call map, but you need to reserve space to save the information. Go lost. Say I call allocated key pages and you decide that, okay, from now on, I want to allocate four pages. You decide that you scan the call map and find a chunk of four available pages, continuous. Then you give the best address of the first physical page. Give it to me, right? Where do you store the chunk size? In the first call map entry, right? Because that's what matters. You don't have to really set up the chunk size in the following three pages. This is not being used, right? So you don't need to store the chunk size in the first entry. But because this is the fixed size entry, you have to reserve a space for chunk size for every call map entry. That's what I'm saying, right? So later on, when you call three key pages and I give you the address of the first page, you can consult the chunk size in the first call map entry to figure out what was the chunk size when you allocate that chunk. So you can free that many physical pages. And finally, I listed some information here called owner, which is which process owns this physical page. For now, if you don't do swiping, this only information doesn't really make much sense. You probably won't imagine why you want map, reverse, map this physical page to some virtual pages. But later on, when you do swiping, you do need such information. For example, suppose you have swiping already done, right? You scan your call map, and found there is no available physical memory. What do you do? You choose a victim, you kick out that page. Or you don't really kick out that physical page, you kick out the content of the page. The content of the page corresponding to some virtual pages in some processes virtual memory, right? Can you just do that silently? What's that? Yeah, you copy the content of that page to disk. Then you can claim that this page is available again. But that content belongs to some process mapping at some virtual addresses, right? Can you just do the copying silently and reuse the physical page? Yeah, you have notified the owner, basically. You have to update that process's page table to indicate that this page is no longer in physical memory, it's in disk now. So later on, once that process access that virtual page, you need to swap that page back in to physical memory again, right? To be able to do the notification, you need this reverse mapping to find out that process, to find out where this page is being mapped to in that process's virtual memory, right? Basically, this only information is a total of address space, virtual address, right? Given this, you should be able to find out the page table entry of that process. Yeah, you don't need to? Do you need to? You have, inside, currently, you have access to everything. So there has to be a way for you to, given this owner information, locate that page table entry. That's your responsibility when you design your page tables. Yeah. No, actually, notify here is a strong word. You don't actually interrupt that process. You, what you do is that you set some flag in that process's page table entry, right? So later on, when, so hopefully, that process will never access that virtual page. That's the ideal case, which means you swap the absolute right page, right? If that process do access that page later on, it will find out, actually, because there is no TRBF mappings in the TRB, it will trigger VMFOT. Inside VMFOT, you will find that, oh, actually, this page was swapped out by me earlier, so I now need to swap back. So you don't actually notify it, but just to mark that page is in disk. Any other questions? All right. So now, let's talk a little bit more about the status or the stats of the physical page. So for now, it's quite straightforward. Just ignore the dirty and clean part. You, first of all, you have free and fixed. Free means that the page is available. Fixed, you can think of as they used. We use fixed for a reason. We'll see later on why we use the word fixed. So we have free pages, we have fixed pages. When VM bootstrap is done, all the fixed pages is the pages that in the gray area, these pages are fixed in memory, right? These are also fixed. And there, we have a bunch of free pages, right? And the transition between the page stats are simple, right? You first initialize the status of all the pages, whether it's fixed or free. Then whenever you allocate key pages, you can mark the pages you're returning to as fixed or used as you can imagine. And later on, when the process, when somebody call free key pages, then you can translate to the status from fixed to free again, right? So for now, if you only do physical page management, it's very easy. Later on, you may have more stat when you do swapping, right? Page could be dirty or clean. The definition of dirty is not what you would imagine. Actually dirty means that this page doesn't have a copy in disk. So that's why when you first allocate a page, you would imagine the page is clean because I never touch that page. But instead, the page status is actually dirty because at that time, that page doesn't have a backup copy in the disk. So it's actually dirty. Which means that later on, when you decide to swap out to kick out that page, you actually need to copy the content from physical memory to disk. That's what dirty means.  You cannot save it. But once you do the copy, now you have two identical copies of that page, both in disk and in memory. So suppose you doesn't touch that page from that point, then the status of the page is clean. Meaning that later on, when you want to kick out the page, you can save the disk right. You can just discard that page content because you already have identical copy in the disk, right? So there are some transitions here between dirty and clean. And this figure should be useful when you do swapping. But for now, let's just consider free and fixed if that's easier. And so this is the page, physical page state. Any question on this? If you only look at the free and fixed, there's not much question except that why do we call it fixed? We'll explain that later. So this is the justice site note that of course we need to synchronize the access.com app because we only have one com app, the entire system, and the multiple threads are trying to access it. So which primitive will we use? Of course, lock, right? Whenever you have such shared resources and you want to enforce exclusive access, you always want to use the lock. And another side note is that the com app shouldn't take you more than two books. This is the third week after the time in the release. Is that right? Is this third week? Last week, we have design document. The first week, we have midterm. The third week, actually, at this point, you should have your com app already done. So how many of you have you finished the com app? Nobody? Well, you should have at this point, it's quite late in the, we have a bunch of other things ahead of us. So once you think you are done with the com app, this is the test you can be sure that your com app actually works and is solid. So we have came one, which is a single thread came out of stress test. And we also have came to cool, which is not a thread came out of test. You don't want to move on or work on anything else. If you fail any of these two tests, you want your com app to be solid, to be bug free and to provide a solid background for your other part of the assignment. So this is how you can test your com app. Any question so far? You should really get a com app done no later than this week. I will put it this way. Because as you could imagine, the swapping is a big headache and that could cost you easily three weeks to finish. All right, so finally, let's look at the mysterious MIPS memory managed unit. We have been talking about physical address and virtual address all the semester. Now, what is actually a virtual address? What is a physical address? Okay, so first of all, the virtual address space is solely decided by what's the length of the instruction word or what's the length of the registers. In a 32-bit processor, the virtual address space will always from zero to four megabytes. You have that number of virtual addresses at your disposal. And the way MIPS manages this virtual address space is that MIPS divide or split the virtual address space into several segments. And from zero to two megabytes, half of the virtual address is actually called user segment, which is as the name indicate, is the user can use any virtual addresses inside this region. Above that, we have two kernel segments. Actually, this would be case segment one. So we have 512 megabytes of case segment zero and 512 megabytes of case segment one. And finally, we have another gigabyte of kernel segment two. These are just the numbers, right? We have from zero to four gigabyte, these many numbers that's corresponding to the virtual address space. And now, when you come to the physical memory, this is really decided by how much physical memory you have, right? So in the OS 161 simulator, you may have four megabytes of memory. Then your physical memory or physical address space will be from zero to four megabytes. Each of them corresponding to one physical byte in there, so this is the virtual address versus physical address. Now, so first thing I want to point out is that every address you manipulate in the or the CPU try to access is virtual address. So for example, let me quickly jump to this.  You always access virtual addresses there, right? Now keep this in mind. And then, depending on what that physical, sorry, virtual address falls into which region, the processor will use different ways try to interpret that virtual address. For example, here, whenever you have, whenever the processor, so think of yourself as a processor, right? You have a bunch of instructions and then you load each instruction to figure out what's the instruction want to do. Suppose you encounter instructions say, I want to load the memory at, this is this virtual address. And that virtual address is below OX at a median, which is from zero to any number between here, right? So the way MIPS will interpret this number is that, okay, I have this virtual address. I will consult the TLB to figure out what's the actual physical address to use. Do the translation by using TLB. Once I consult the TLB, suppose there is an entry there, there is a mapping there, I got the actual physical address. I use that to actually access the hardware, the physical memory, right? So whenever the processor encounters a virtual address that below this OX at a median address range, we always consult the TLB to figure out the correct physical address. This is what the processor will do when it get a virtual address that smaller than OX median. What if, so say I read the instructions, I say some instructions want to load memory from OX, I don't know, at a median 10, maybe larger than that, but below the OX A, seven zeros, I will not use the TLB. I will just chop the most significant bit of that virtual address. I use that as physical address. To give you example, say I have an instruction call, say the CPU read an instruction like this, right? The instruction wants to load the content of the virtual memory at this virtual memory address. How would the CPU figure out what's the actual physical address to use? No, that's the virtual address you're talking about. When the CPU deal with up-layer programs, we're always speaking using virtual address. So here the programs tell the CPU, I want to load the memory at this virtual address, right? Now as a CPU, how would you actually get that memory content? You need a physical address, right? This is how you interact with the physical memory. And how would you get that physical address? What's that? Yeah, so like I said, the way the CPU do the translation is that instead of consulting the TLB, which is different with user memory, it would just chop the last most significant bit. In this case, if you see the binary is one zero zero, it's a first eight, you have a bunch of zeros, right? The way, so here it would be zero zero zero one, corresponding to here, and a bunch of zero zeros. The way CPU do the translation is that it just chop this last bit. I set it to zero. I use this as the physical address to actually access the physical memory. The effective is like this, is o x at median one zero zero minus k segment one. That's the constant, which is o x at median. You set this bit to zero is equivalent to subtract this number by o x at a median. That's how the CPU gets the physical memory. And so in the previous slide, actually in the code, we see something like this. The first physical address equals to the first three minus kernel segment zero. If you go to the definition, kernel segment zero is just o x at a median, right? What does it mean? So here, the first three is the virtual address, right? It's in kernel segment zero. We subtract o x at a median, we get the actual physical address. Here, we are trying to mimic the behavior of the CPU when CPU encounters such virtual address. This is how we calculate the actual physical address of the first available physical address, right? So this region, any virtual address in this region is directly mapped to physical. So say you only have four megabytes of memory, which means that only the first four megabytes of the virtual address is usable. If you issue a virtual memory larger than that, you will have some, I don't know what the fault is, but you'll have some hardware for it because you're trying to access some physical memory that doesn't exist. So this is kernel segment zero. And kernel segment one is similar where you just do the subtracting or you manipulate it with a most significant base. The only difference between the virtual addresses of kernel segment zero and kernel segment one is that when you access the physical memory, use some virtual address in kernel segment zero, the CPU will try to first consult the catch first. So this data can be catched in the hardware catch while if you access the same physical memory in kernel segment one, and the CPU will not use the catch, the catch is disabled. And you will notice that the same physical page is actually being mapped to two different locations in the kernel virtual address space. So which means that there are two virtual addresses that are being mapped to the same physical address in this mapping. So both kernel segment zero and kernel segment one are mapped, directly mapped to the physical memory. And finally, we have kernel segment two which is not used in this OS. It's kernel virtual address, but it's using TRB which you can leave it alone. Just we don't use it in OS 161. So now if you think about it, you have every process have this four gigabytes of virtual address space, right? They have two gigabytes of usable user memory, user virtual address space, and every process is kernel virtual address is identical. That's why when you get into kernel, you can, no matter which process is trigger, Cisco when in trouble in the kernel, you are using the same virtual to physical mapping. This may be a little bit trickier to digest at first, but keep this picture in mind is very useful when you deal with all those virtual physical memories. Otherwise you will get, you will soon get confused of when you are using virtual memory or when you are using physical memory, right? And like I said, the CPU always, or the program always uses the virtual memory when the program want to load some content from the memory. For example, if you have this instruction, as if you are CPU, then when you saw this address, you immediately know that, okay, this belong to a kernel user segment. I should consult TRB to get the actual physical address. What if there is no entry in TRB? As a CPU, what would you do? What's that? TRB fault, right? You don't know how to translate that. There is no TRB entries for you. We raise a TRB fault. And so now if you have this virtual address, the hardware will know that this address virtual address belong to kernel segment zero, and we just subtract that by all and the media gets the physical address. And similarly, we have addresses in 7.0.1 and 2. And you also will find two hyper macros that do the translation to mimic the behavior of the hardware translation, which called physical address to kernel virtual address, which is nothing but just add kernel segment zero to that physical address. You get a virtual address. And at this point, you should already you should have some idea of, first of all, why kernel pages cannot be swapped out. When you choose a swapping victim, you have to leave kernel pages alone. Why is that? Not exactly, yeah. There will be no TRB fault. That's exactly the reason. So the virtual address to physical address is that doesn't go through TRB. So if you swap that page out, how would you reflect the fact that that page is no longer in memory?  So next time, when the process wants to access that page, you have a TRB fault. That's how you handle the swapping. Now with kernel memory, there is no TRB involved. So you cannot really know that when the kernel access that page because that translation is not done by TRB. You will not get TRB fault and you don't get a chance to actually swapping that page. And secondly, why the SDK pages have to return continuous or consecutive pages. We know that for the user address space, if we want to allocate four pages, the four pages can be scattered around all the physical address. That's the advantage of using the mapping or the page table. But for kernel memory, we have to allocate continuous pages. Why is that case? Again, we don't have page table. We don't have TRB. That's why the virtually continuous kernel virtual addresses has to be also continuous in physical address because we don't have those TRB stuff and page table going on here, right? So this is how the MIPS virtual memory to physical memory mapping works. To summarize, we talk about this today. We talk about how the virtual memory system bootstrap, how to figure out how much physical pages are there available, how to initialize the call map, what's the status of the physical pages, and also how MIPS are due with all those virtual memories. Next time we'll talk about user address spaces.