All right, the Paris Masters, the final event of the season for a lot of players is on, it's an ATB 1000 event, huge event! And it's got all the big names, the first time since the French Open we've really seen a lot of these names all at the same time, in the same event, but we have some withdrawals. Big names not playing in this one, so let's go to the withdrawal list. So, the withdrawal list is as followed. We have Jensen Brooksby, he's pulled out. Montfies, Opelka, and Alexander Zverev have all pulled out of this one. Of course, Zverev still battling with that foot injury. We don't know when we're going to see him again, but he made the semi-finals last year here, so he loses a lot of points for that. But let's go to the top of the draw, because it is stacked. Okay, you can see we've got Alkares at the top of the draw. The top eight seeds get to buy in the first round. 16 seeds in this one, so it's a big, big event. You've got Alkares, he gets to buy in the first round. Winner of that, well, he will play the winner of Karate versus Nishioca in the second round, so a good start there for Alkares. And then you've got Vanna Zanshup taking on Dmitrov. Winner will take on either a qualifier or the number 13 seed Berettini in the second round. So, Berettini versus Alkares could be a third round. Then you've got Hercatch, number 10 seed taken on Manorino. Winner of that match takes on either Runa or Vavrenka, which could be a match we see in Basel this week, so that's interesting there, and Hercatch having to play the winner. Then you've got Isner taking on a qualifier. Winner of that place, number 17, Rublev, who gets to buy in the first round. So, that quarter of the draw, you could get Hercatch versus Rublev in the third round, and then Rublev versus Alkares in the quarter finals. And remember, Alkares is qualified for the ATP finals. Berettini's got to do a lot. He's got to win Paris to get there. Hercatch and Rublev are in the hunt though, so that could be a very interesting match in the third round. If they play, the loser ends their season. That could be a very big match. Now, let's go to the next part of the draw, which is the Mebedev section. So, there we go. Okay, so you've got Mebedev, the number 4 seed, buying the first round. He'll take on the winner of quarter, taken on Diminor, which is a really fun first round. It's when a couple of young players, winner gets to play Medi. Then you've got Rinanish, taken on Draper. Winner of that match takes on either a qualifier, and number 16 seed Tiafo in the second round. Then you've got Fritz, number 9 seed, taken on Fakina. Winner of that match takes on either Murray or Julsamon, who's playing his last ever event. He got a wild card, so it was good to see him playing. He gets to play Murray, a guy that I'm sure he's played a few times over his career. Then you've got Bublik, taken on a qualifier. Winner of that takes on the number 8 seed, and one of the best-formed players right now. Felix O'Jalliaseem, so FAA versus Fritz. Now, both of them are in contention for the 8 to be finals too, so that could be another elimination match, like I mentioned before. Mebedev, Tiafo, third round. That could be fun. And also FAA versus Mebedev quarter-final, if we want to go out that way. And the winner of this section will obviously play the Alcares section, so Mebedev Alcares could be a semi-final, or any of the other names I've mentioned over the last little bit. Okay, let's go to the next section of the draw, which is the Djokovic section, or the rude section, if you're based on ranking. Novak Djokovic, he gets to buy in the first round the number 6 seed. He will take on either Schwarzman or Kressi in the second round. Then you've got Bayez, taken on Hashinov. Winner of that takes on either a qualifier or Yannick Sinner, the number 11 seed. So Sinner versus Djokovic, third round. That'll be on Thursday. Or maybe it might even be on Wednesday, depending on how the schedule plays. Then you've got Chilich, taking on Museti, number 15 seed Chilich. Museti's been okay the last couple of weeks. Won a title, I think, last week or the week before. The winner of that will take on either Basilej Vili or a qualifier in the second round. Then you've got Molchan, taken on Gaskay. Winner of that takes on Kasparov, the third seed. So Djokovic versus Rude, if you're going by the seeds, will be a quarter-final. But I've got to be honest, Rude would be very good at Rude to get to the third round. Sorry, quarter-finals. But you know, Museti, Chilich, Gaskay, they could all be tough, especially Gaskay in France. Never fun. So that's going to be interesting. But I'm most excited for Sinner, Djokovic's third round. I think we all are, right? They played five sets at Wimbledon. And the bottom quarter of the draw we've got. Stevonov, City pass, number five seed, by in the first round, who will take on either Evans or Nakashima in the second round. Then you've got a qualifier taken on Chorich. Winner of that match takes on either Ketchmenovich or Nori, the twelfth seed, in the second round. So straight away, Nori versus City pass stands out, but Chorich City passes the match that I think we'll get. And I hope we get. They play epics every time. Then you've got Karina Buster, taken on Ramos Van Oles. Karina Buster just lost to Elkres today, number 14 seed. Winner of that match takes on either Shapavalov or Serendolo. Shapo's in good form this week too. So interested to see how that plays out. Then you've got Patistar Agu taking on Paul. Winner of that match takes on the number two seed. Rafa Nadal, we haven't seen since the US Open in singles. So he hasn't played for a while, Rafa. Trying to get some form. It's the first time we're getting to see Dadal. Is that what we're calling him? Dadal, Papa Rafa. So that's going to be fun. Interested to see how he plays. And also you can see there, possibly playing Sizi Pass in the quarter finals if the seeds play out. And of course this section of the draw will play against the Rude slash Djokovic section. So we could get a goat battle in the semis. Djokovic Nadal semifinal, Sizi Pass Rude semifinal or any of those combinations or any of the other names I mentioned. Let me know down in the comments below if you're watching this later or in the chat if you're watching this live. Who's going to win this tournament? I'm going Djokovic because he's the defending champion. He's won this six times. And I can't not pick him. He's the freshest player right now. He's the only guy who hasn't played that much. Maybe besides Medvedev, but I'm going to go with Djokovic to win just because he's Djokovic. But you tell me, who do you think is going to win this tournament?


everyone. Hello and good morning. Wow, we were just saying backstage how this has very much the feelings of a kind of rock concert. So good morning. Thank you so much for joining us. We know how packed the schedule is, so we're very grateful that you chose to spend your time with us. I'm Zoe Tabri. I'm the tech editor at the Thomson Reuters Foundation, which is the charitable arm of Thomson Reuters, where we cover technologies impact on society and on human rights. And I'm delighted to be your host today. Regulating the internet and by extension content is a hotly debated topic. There's been must distinction recently of the possible harms of the internet and or rather of content from kind of children's safety online, to kind of cyber attacks, to copyright infringement, but what have those internet regulation efforts looked like and crucially have they come at a cost, both kind of current and existential, potentially risking the integrity of the internet as we know it. Today we're going to explore how best to approach regulation and where we might have gotten it wrong in the past. I'm joined by two fantastic panelists to discuss those issues today. For this, to my right, we have Sally Costerton, who's an experienced global leader and is currently serving as the interim president and CEO of ICANN, the Internet Corporation for Assigned Names and Numbers. And she's also the senior vice president for global stakeholder engagement. And just to my right, we have Andrew Sullivan, who's CEO and president of the Internet Society, a global nonprofit dedicated to building, promoting and defending the internet. He's going to tell us a little bit about the work they do to keep the internet an open resource for all and warn how misguided kind of regulation and polities could threaten to fragment it. We don't have much time today. We've got about 25 minutes, so we'll dive straight in. There will be no direct question to the speakers, but do please feel free to come grab us at the end to carry on the discussion. And of course, keep us trending on X with a hashtag Web Summit. So Sally, if I could come to you first, is there such a thing as kind of good regulation of the internet and indeed, can and should it be regulated at all? Thank you, Zoe. Well, to anybody in the Internet world, if you mention regulation, they go, oof, like this. And I think it's important to recognize that, of course, governments need to regulate. It is a natural and important role of a government. So, what is critical is for us, as I can particularly and for our technical community that Andrew and I work closely as part of, is to help regulators understand how the internet actually works. Because the risk is unintended regulation will harm the infrastructure, the technical foundation of what the internet stands on. The content is, if you like the house, the technical underpinnings, the foundations. And if you don't understand how the foundations work, you can damage the foundation with unintended regulation. And eventually the foundation collapses and it brings the house down with it. So our goal is to make sure that those and it's a very engagement driven goal. It's events like this. It's the IGFs working inside the United Nations, working with individual governments and government organizations. It's striving to do everything we can to help them to understand how it works so that the regulation that they want to put in, is maintains that global, interoperable internet and they don't accidentally break it. That's a really good point because I think we very often and we'll come back to this one, kind of take the Internet for granted without perhaps realizing how it technically works. If we can take a step back and come to you, Andrew, about how and when the Internet was designed by Tim Berners-Leave and surf and kind of others with the good chaps principle in mind. So the idea of we're all good chaps here. We don't need to have anything kind of written down, not necessarily with kind of bad actors in mind. Andrew, have those kind of conditions for an open and kind of interconnected internet, do they still exist? How has it changed since when the founders designed it decades ago? Well, I mean, Zoe, it's clear that the early Internet was designed by people who knew each other, right? It was a tiny research operation that escaped the lab and now we have this global thing. So, yeah, the conditions were a little different, but it's still the case that the Internet is made up of these little pieces that all fit together. They're made out of little building blocks and those building blocks can be stuck together in different ways and that's one of the ways, one of the places that we put the various security operations and so on. The tricky part is that if you try to regulate that too carefully, what you do, as Sally was saying, is you might cause damage and you might do this to the infrastructure, you might do this to the fundamentals of the Internet, you might do this at any layer whatsoever and those things prevent the innovations that many in this community here are eager to implement. So I think what we need to do is analyze, does this thing that we're about to do, does it cause problems for the Internet and you can analyze that just like you do an environmental assessment when you build a dam, you can do an Internet impact assessment in order to test whether the regulation that you're proposing is going to affect the Internet in a better or worse way. That's a very good point and we'll come back to kind of how to evaluate those risks and often kind of unintended consequences of regulation. Sally, I'm gonna come back to you and taking a more recent look at the kind of Internet. How a kind of politically fragile do you think it is, but also has it become more politicized? I'm thinking especially in the context of global conflicts, kind of Israel, Hamas, Ukraine and kind of Russia, how does that kind of threaten the Internet as we know it? Well, yes, the world has become much more politicized in the last few years, much more polarized. This is very known. In fact, geopolitics are hugely important in their own right because, you know, we are dealing with a very difficult time in world politics. The Internet has become essential for the world. And if the world didn't realize this before the pandemic, they certainly do now. So I think what we have to do in the technical community particularly is remind the world that the Internet, the underpinning of the Internet, the system that supports it, the IP infrastructure is secure and safe, providing you keep it global and interoperable. And it's never gone down in 30 years. It's year can run. And that's what it meant during pandemic. We talk about an ICANN, the single sustainable interoperable Internet. Well, now no, everyone knows what sustainable means because when everything else is gone, literally nothing else, we could rely on the Internet. And if we hadn't had it, would we have found a vaccine for COVID? I don't know. Would we have found it in time, for example? So, but we have to be careful to be practical in the Internet space, not to be too inside our own little worlds of people who know each other. Kind of we have to reach out to new people like everyone here. You're trying to run businesses online. We I'm afraid I need to tell you, don't assume it's always going to be there for you. You can change that. You can take action. But the reality is, because largely of the politicization of the world, it is under threat. And the example you used in during when Russia invaded Ukraine, the Ukrainian top level country domain name, we call them CCTLD, organization that runs the Ukrainian top level domain, came to ICANN very publicly and said, take the Russians off the net. Are you?  We have been invaded. This is a hostile act. And we said, no, we can't do that. We literally can't do it. And ICANN has to be, it is, it's in its mission, it is politically in uninvolved, we are neutral. We can never take sides because the Internet cannot be politicized. And the people like Andrew and us and our colleagues who run the technical infrastructure, we have to stick to that. Because if you could do it, you, you start to break it. Literally, you take it off a centralized system, you break the trust, and you break the channel by which the, the protocols actually move the data around that makes it sustainable. So that's a real to recent example of where that threat is real. And this is how organizations that ICANN provide guardrails by being politically neutral. Yeah. But, but you know what? We need everybody to understand that we all own this risk. We can't just say, hey, ICANN, it's your job to keep us safe. Can you do that, please? And we'll just get on with running a business here. We need to also be aware, as Internet users, particularly business people, that we have to protect it. Quite. And so the kind of whole system is based on trust. Andrew, do you also feel, is that kind of trust weakening? Where do you see that threat coming from? Well, I mean, it's weakening in some sense. So, so the Internet is technically astonishingly robust. We built a reliable system out of unreliable parts. This is like engineering magic. And yet, politically, it is fragile because it depends on the idea that more connection is better, that the ability to use this system from end to end is a good thing, and that the, the power in your hands is a good idea. And, and we see actually people moving away from that. We see regulatory moves that are really cementing the advantages of very, very large organizations that are, are essentially controlled. And that is bad for the rest of us. It's bad for, it's bad for startups that want to, you know, compete in this environment. It's bad for users who don't want to do whatever the cable television, you know, model of the Internet is. And so I think that that's a risk. But it's also the case that because of the way the Internet is made out of these little pieces that can be put together, we have the technical capacity to build trust mechanisms through the Internet. We actually have that ability so long as we preserve the interoperable Internet that allows this kind of innovation to happen. If we regulated in such a way, or if we cement the advantages of very large incumbents in such a way that they have all the control, then we don't have the freedom to build those trust mechanisms anymore. And that would be a shame. Yeah. And how, I mean, you know, talking about this kind of the global nature of this debate, a lot of those regulatory efforts, including those with unintended consequences as you flagged, are happening at a country level. We ourselves kind of reflect that global nature.  How receptive an audience are you finding? Can there be a sort of global dialogue or oversight or rather in this kind of debate? And how, where do you see kind of governments and policymakers going? Are you seeing efforts kind of tend to restrict it, fragmented, kind of regulated more? Or are you starting to hear a more receptive audience to what you're both saying? Either. I mean, for me, the concern is that we're in a period of nationalism, right? We seem to have entered a period where international cooperation is much less interesting to people politically than sort of nationalist tendencies. And we hear a lot about national data sovereignty and so on in a way that we didn't used to. This is quite risky to the internet. It's risky to have an idea that, oh, this stuff is all going to live within my country, because the internet is totally not designed around country borders. And that's part of its resilience, right? If this country has a problem, you can go around it. That's what makes it robust.  And we see countries pursuing that. This is why, for instance, at the Internet Society, we have a platform called Pulse that tracks internet shutdowns. And they're on the rise.  So I'm hopeful that we will be able to change that direction. But I'm really nervous. I think you've both touched on a really interesting point there, which is the kind of very real and perhaps most obvious. We as the kind of global public or even the media kind of threats see to the internet, right? Shutdowns. You no longer see it on your phone. You don't see the direct impact to you. But I feel that what you both are touching on is a more existential kind of threat to the internet. And Sally, I want to come back to a concept you had mentioned, which I think sounds fascinating, the risk of fragmentation to the internet and the risk of it becoming isolated digital islands. Can you touch on that? Yes, I think, thank you, to your first point as well, which is linked. Andrew, I'm afraid is totally right about the rise of nationalism.    They had 6,000 people in Kyoto from every conceivable kind of internet user group. So governments in an ICANN meeting, a government minister will stand in a line at a microphone with a civil society activist, with an IP lawyer, with a businessman, with an academic, and they will all stand together and they will work together on the policies that, through using a bottom up process consensus based on the policies that make this sustainable. Those are the rules. So the way that this is not regulation in a top down sense, but these are the rules in which the domain name system, the infrastructure I talked about, the foundation and because so many people have their hands on that, because it is truly, we use this term multi-stakeholder, as in all stakeholders that are internet users. It's an ICANN's mission that we bring the internet users of the world to the policymaking process. That is part of my job, literally written in the ICANN mission. And my board and my stakeholders hold me accountable for that. And that means that we do everything we can to balance the risk of nationalism, really, by the presence of this enormous global community, online, offline, we had to go online during Covid, so now we're really good at it. And that's brought users in from countries who couldn't go to meetings. Absolutely. And so the presence of that, now how does that help fragmentation? Simply put, the more awareness and participation that is in the world of how to do this using that multi-stakeholder process, the more you push back. Yeah. Because the risk of fragmentation comes from individual governments accidentally or intentionally damaging that infrastructure. Now, the more knowledge there is of how risky that is, and the consequences, and you know what, you fragment it, you break it, you probably can't fix it. This is not a bicycle tire. Irreparable damage. Oops, we broke it. I tell you what, here's the fixed kit. Let's stick it back together. We probably can't do that. Which is where we're talking about this more existential. And that is the digital island risk. And it is understandable where a government looks at its citizens, and what they are saying is this. Yeah. This is the content. That's what governments want to regulate. That's what people can relate to. Because they say, I don't want, I want to know who people are. I don't want abuse. I don't want child abuse. I don't want spam. Nobody wants those things. But the risk is that if you just say, I'll just do it in my country, because I'm the good guys. We're a democratic government. We get elected. It's okay for us to do it. But the problem is, it isn't because it's not designed to work like that, which is what Andrew is saying. And this is the education process that we have to keep going through. So that the regulators and the governments understand this properly. And the more pressure we see coming from internet users who after all, vote in these governments ultimately for better and the less risk it is. And so on that point where you do have those efforts and you know either top down at a country level or hopefully kind of bottom up, want to mention a term I think you Andrew had said, which not particularly sexy of impact assessment, but that I think is important here. How can you evaluate or kind of predict or assess what those consequences unintended or not may be when trying to regulate it? Well, I mean, the internet society has created a toolkit that is literally designed to evaluate these things to look at, okay, well, here's the policy that we want to adopt. We call it the Internet Impact Assessment Toolkit. But whatever the name is, the trick is you analyze what are the consequences for the rest of the network? And it's not just, you know, what are the immediate term things, but also what are the long term consequences? How does this encourage flows versus discourage them and so forth?  But there isn't a regulatory socket. There isn't a place to do this. People talk about the layers on the internet. Only the problem is it's not a very good model. It's all mingled together. One thing is inside another one. And what we see is that people think, oh, there's this very simplistic model they want to, they want to use in order to evaluate this. So that's the reason that that toolkit exists so that you can understand, oh, how do I unpack what it is that I want to do? And, you know, can I actually make progress in the plans that I have? There are some things that are just a bad idea to do. Internet shutdowns are just a bad idea. They're always a bad idea. They actually harm your own goals. But there are other things that, you know, maybe there are different alternatives for what you might want to achieve. Right. Now we're about 20 minutes into the discussion and we haven't yet addressed AI, which we take collectively as an accomplishment in and of itself. But we'd be remiss not to address it. And of course, the internet is often kind of conflated with content. But I want to take a moment to ask you both how you see the AI kind of revolution in the past, well, really, past kind of couple of years, affecting the internet. And do you see a risk of it being weaponized by bad actors to kind of threaten the internet in any way, either of you? Yes. It's absolutely something that we have to talk about collectively because, you know, if I look at the agenda for this web summit, it's everywhere. It's the topic du jour. Should we put it that way? And it's not immediately in the sphere of our technical ecosystem today. But I think that there are a couple of areas where it's going to affect us. And the first one is trust. If we feel we don't trust the people that we are dealing with because we don't know who they are anymore, trust is the foundation of what has made the internet successful. It is the biggest factor in its success in the last 30 years, bar nothing. And we need to re-energize that with a new generation of internet users. Now, these are the same generation that are going to be dealing with more fake news, more uncertainty about who people really are. So I think at a trust level, the internet community has to really engage with this. That's the first area. So it's here with us now. There are enormous opportunities that come from some of the tools that we have available to us that we have often, in fact, have existed for a long time, but are now being made much more easily available and more usable. So it is not all bad. And we also have to be careful not to demonize technology. We mustn't be a luddite. We're in the technology world. And many of the people in this room will see this as an enormous business opportunity. So it's about being kind of careful and safe, but still taking advantage of the benefits that it brings. I think it's where we are today from an ICAM perspective. Right. And I think we also, by the way, the media have a huge role in responsibly to play in that and kind of presenting the debate in a kind of fact evidence kind of based way as opposed to polarized. Andrew, would you kind of agree with that on it? I certainly would agree with that. I also think that there is a problem in the discussion around AI which parallels the discussion around regulation of the internet. And it's the shiny, right? What happened is we've had years and years and years of development of various AI techniques, large language models, statistics and a hat. I mean, there's a whole lot of different things that go by the name of AI. But what we got was, oh, chat GPT's here. And suddenly everybody was like, oh, this is really scary because you could see it.  Now suddenly I can see it and so I'm going to panic. And the same thing has happened with the internet.  Humans are trying to be scammers. Humans are trying to do these things. You know, people have been lying to one another or creating misinformation or whatever since language was invented. And the basic idea that you have to blame the internet for misinformation is a strange one. Similarly, you have to blame AI for misinformation. It's a very strange one. That's not really the source of this. What it is is somebody attempting to manipulate this system in order to fool one another. Legislating against bad human activity is really hard. We've been trying to do it for as long as human history. It's very, very difficult. These tools make certain activities a little bit easier. But that means they make activities that are drudgery easier. They make certain kinds of things better.  And similarly, we should, you know, we should take advantage of those opportunities. And that means we need a very, very deft touch if we're going to try to regulate this stuff. That's the real risk that we're just going to respond with a knee jerk reaction and we're going to break things. We're going to break opportunity that is there for everybody. So that's the concern that I have about the AI regulation or anything else. I think that's an interesting point kind of on regulation specifically that, you know, you can, from what if I'm hearing correctly, you're both saying you can, well, regulate the tech but which is almost nonsensical because the tech is in and of itself neither good nor bad. You can attempt to regulate the use of it but then that's to be done with very, very careful consideration for what you might break kind of into the process and done with the kind of right actors at the table. We have just a few seconds left. I want to have a very, very quick fire. Final question to you both in just one sentence.  Totally. Sally? Yes. Do you people here in the audience raise your hand if, based on what you've heard here, think you either may have taken the internet for granted or the world has? Raise your hand if you do. That's interesting. I'm seeing about kind of 50% of the audience. I'm not quite sure we'd have had that much at the start. So I'm hoping this has given you some food for thought. Thank you so much for being here. Both Sally and Andrew are still speaking, I think, tomorrow at the summit. Research their name on the website. You can find the right stage for it. And for now, let's please give them a round of applause. Thank you. Thank you.


All righty, welcome back to Operating Systems. So we are climbing up the difficulty hump again. So last few lectures were chill, now we're back on the upswing. So after this, this will be the hardest content of the course and like not this lecture but in the next week or so, then we're pretty much smooth sailing since then. So strap in and get ready, so threads. So before we first talk about threads, I think in the first lecture I mentioned the difference between concurrency and parallelism and that we think of them as different things. So in computing, they are not the same. So in concurrency, the goal of concurrency is making progress on multiple things, which means you can switch between things. So you can switch between two more things or in other words, you can get interrupted. So I can make progress on one thing, put it down, make progress on another thing. On the other hand, parallelism is about doing two things in the same time instant, two different things in the same time instant. So the goal for that is I want to do, run as fast as possible, do everything I can at the same time, go as quick and for things to run in parallel they have to be independent. So depending on the two tasks, two tasks can be maybe done concurrently, maybe done in parallelism. Let's see a silly real-life example. So here is a real-life situation to demonstrate the difference between them and the only assumption we have to make here is that we are not savages and we have like okay manners. Not terribly great, but like not terrible either. So you're sitting at a table for dinner, you have four options, you can either eat, you can drink, you can talk and you can gesture with your hands maybe you only need one hand. But there's this one weird caveat that you're so hungry that if you start eating you won't finish until you're done because you were in lectures all day or you had midterms or something like that, I don't know. So you should be able to pick two tasks here and see if they can be done in parallel or concurrently with each other. So for instance, can I, let's see, can I drink and talk in parallel if I am a normal polite functioning human adult? No. Can I do them concurrently? Yes, I can stop talking and then drink and then finish drinking, start talking and I can switch back and forth between them. So I can't do them in parallel but I can do them concurrently. What about gesturing and talking? Can I do them in parallel? Yes, can I do them concurrently? Yeah, okay. So what about, I don't know, eating and gesturing. Can I do them in parallel? Yes, can I do them concurrently? No, because I have that weird caveat. All right, what about, I don't know, that's pretty much all of them. All right, so does that make sense to everyone? Seems to make sense. Which can be done in parallel, which can be done concurrently. So here's the full list of them if you wanna know. So for eating, I can't do eating concurrently with anything else because of that condition but for talking and drinking too, I also can't do those concurrently because they're using, I guess, my mouth resource but I could do it in parallel with gesturing because that's a different resource I can use my hands and I think we got the rest of them. So any question of the difference between them? So in computing, the weird situation where you have this case where you can do things parallel and not concurrently generally doesn't exist in computing. Generally in computing, if you can do something in parallel you can do it concurrently as well. This is like only in weird situations. So, but it's important to know the difference between concurrency and parallelism. So any questions about that? Because it will be important. All right, good. So now into threads. So they're fun, they're like processes except everything is shared by default. So it has the exact same principles except they just share memory. So each thread has its own registers, program counter stack but all your threads are in the same address space as the process. So if you make a change in one thread it appears in the other thread. Unlike what happens when you have two independent processes if you make changes in one you don't see it in the other. In this case that's not true. The only thing that is independent to threads is their stack and anything you explicitly state using something called TLS or thread local storage. So that is just information that is unique to a thread. By default the only information that is unique to a thread is its stack, which will be important. Otherwise they wouldn't be able to really work. All right. So a single process can have multiple threads. So the threads live within a process and by default a process just executes code in its own address space while if you have multiple processes while if you have multiple threads well you can have multiple executions going on at once in the same address space and because of that well threads are going to be much much much faster to create and have less overhead in terms of memory and CPU time because whenever we create a new process we have to create new page tables. We have to create a new set of file descriptors. We have to do a whole bunch of stuff like that even just creating the new page tables as you have hopefully figured out in lab three is a lot of work. So if you are creating a new thread you don't have to do all that because everything is in the same address space. So they're much lighter weight. They by default share code, data, file descriptors, everything you just create a new set of virtual registers and a stack and boom you have a new thread. So assuming you even have one CPU threads are still nice because they will also express concurrency just like having multiple processes could also be executed concurrently switching really fast between them looks like they're running in parallel even though we're just switching really fast. So in the case of even a single threaded application it might be easier to program concurrently. So for instance if we were writing a web server and want to handle multiple connections at once well we could get a request essentially accept that connection and then create a thread to handle that connection and then that would be a new execution point we could switch between multiple threads that are handling different connections at once even on a single CPU we could switch really fast and then handle lots of web clients we can make the next Google or something like that handle thousands just each request gets its own thread and that's a real web server. So lighter weight than processes here's a handy dandy table to figure out what the difference between them are. So processes have independent code data in heap while with shred threads they are all shared because they are all in the same address space. Processes execute independently and a thread lives within a process so it does not have independent execution because well it can change some of the like if you use the heap or something like that those changes will be seen in multiple threads. It's not by default independent because they all have the same address space. The only thing that is independent in threads which is the same as in processes is each process has its own stack and registers and each thread has its own stack and registers which are independent towards each thread. Processes are expensive to create and context switch because remember we would have to set up the page tables and whenever we context switch between processes we have to do things like flush the TLB and flush the caches and switch the page tables and all that which is slow while with threads they are cheap to create all I have to do is create a new stack and a set of virtual registers and context switching is also quicker because I wouldn't have to flush the TLB between them so most of the things stay the same. The context switch just has to swap the registers and that's it. When a process exits it's completely removed from the operating system as soon as something actually waits on it while with threads whenever they get cleaned up their stack is removed from the process and that's all and the caveat here is that when a process dies all threads within it die as well so unlike if a process just ends if a child process ends it doesn't affect the parent process of all their independent threads not so much because they live within a process. So for this course we'll be using POSIX threads for Windows there's Win32 threads but we're gonna use Unix threads so these are available well these are also available on Windows but they're like the default in macOS and Linux so we will use that to use them you just include pthread.h.header file and whatever you compile and link there is a flag for pthreads don't worry in your labs all the flags are set up for you so you don't have to do this but if you do want to use pthreads in your own project this is what you have to do and all of them are documented in the man pages like the system call wrappers. So this is how we create a thread we call pthread create we give it a pointer to a thread structure and it will go ahead and initialize that for us then here we have a pointer to some attributes so we could populate that with all their functions and set some default attributes for a thread but if we give it null we get the defaults and we'll figure out what some of the defaults are a bit later today.  Who can read C types? Yeah, a function pointer to what type of function? A function that doesn't take any arguments and doesn't return, takes an avoid pointer, yes and also what's it return? A void pointer, yeah so this funny thing declares a type that is a function that takes a void star or a void pointer which is just C's way if you haven't seen that before it's just C's way of saying this is a pointer to what I don't care. So whenever you see void star it's just a pointer to something and C doesn't care. So this declares a function that takes a single pointer argument and then returns a pointer argument and then the fourth argument is the value of that pointer to pass to the start routine whenever it starts executing. So for this it's unlike the wrapper functions that return negative one on failure and set error no. In this case all the pthread functions return zero if they are successful and otherwise they just directly return the error number and then the contents of that thread are undefined. So here is how you create a bit thread and again it's a bit different than processes, right because we would have a fork and then after the fork we would have an if to figure out if we're the parent and the child. If I were to do this using processes in the parent I would print in main and then in the child I would print in run while if I have threads I just create a new thread until I want to execute this run function and then at this point I won't know whether or not I'll continue executing main or the thread that will execute run is going to run. So I'm not sure what order they're going to go in just like when we had multiple processes. So in this case it would print off in run this one would return in main. What are some differences and are we missing anything compared to processes? So if I set this up using processes and just printed in the child and printed in the parent would I be a responsible adult or responsible parent? No, I didn't wait on it so I'm missing something here. So is there equivalent and yeah in threads there is a weight equivalent. Annoyingly it's called join. So there is a function called pthread join you give it a thread and then a void star star. So a pointer to a pointer for the return value and you can think of this as exactly the same as the weight call but instead of an int and then passing an int star for it to populate we create a void star and create a void star star for it to populate. So it's the same thing. Processes by default just return an int threads by default just return a void pointer other than that you can make the exact same substitution. So in this you say which thread to wait on and in this case there is no pthread equivalent of just wait on the first thread that executes you have to specifically say which thread you want to wait and wait for it to terminate and then return values the same as the weight status same thing return zero on success error number anyways and you are only allowed to call this on one time per thread multiple calls on the same thread leads to undefined behavior if you waited on the same process twice well the offering system is going to know that hey it's already terminated you waited on it twice but because everything's in the same address space the offering system knows a lot less information. Yep. Oh so pthread canceled is another thing we probably won't even get into in this course. I just put it there for information. Yeah so you can yeah canceling a thread is the I kind of like terminating it with a signal it's kind of equivalent to that but we will probably never see that. All right so let's go ahead and see our example because it's a bit strange so here was our example. So we declare in main we created a thread created a new thread told it to execute run at this point we don't know what's going to execute and in terms of terminology the easiest way of thinking about threads is whenever a process starts and executing main instead of just saying the process starts executing main usually what we say is the main thread starts so you can think of this you put everything in context of threads so by default whenever a process starts it starts with a main thread with only one thread that starts executing main so we would have a main thread that starts executing the main thread would create this thread variable then create a new thread so I would have the main thread and then a new thread that wants to execute run I don't know which one is going to execute next because it's up to the kernel to decide and in this case I might see in main and I might see in run so if I go ahead and execute that I should see something interesting. I see in main, oops, why is that? Yeah so it has to do with I'm missing the join so what's happening here is after I create the thread the main thread prints in main and then return zero which is equivalent of doing exit zero and that ends the process so because the process ends and all threads live within a process process is gone the thread that wanted to execute run doesn't exist anymore because the process is now terminated. Yeah, so in this case it is possible if I just like hammer it and get super lucky that's cheating. Yeah but yeah if I did a sleep 100 at the end it would also work, you're gonna sleep one. So if I did this it would also work but that's also not good because you cannot depend on that so this is like if you did that and you're like it works for me that is how you have bugs that last for seven years because you give that to someone that executes this on a toaster and then suddenly that sleep one isn't good enough and then they only see one thing and then they call you they'd be like you have to fix my code and then you have to fix your code and then you're like oh god what the hell and yeah debugging this stuff is awful so whenever you write this you wanna make sure you are guaranteed the outcome you want so in this case I could sleep but that's not guaranteed my guarantee is if I call pthread join on thread and I don't care about the argument so in this case I will always see both so if the main thread runs first it prints in main and then joins the other thread which means it will wait for the other thread to terminate at some point the other thread will execute print in run and then finish and then the main thread would go on call exit from the process so now in this case I should always see both messages and I'm not getting unlucky this time so we're also not guaranteed the order of them so at least in the last lecture I saw in run once first and then in one but we're not that lucky then question which process do all threads live in so threads just live within a process so by default when a process starts it has one thread and then if you create other threads in that process they live within that process so as you can see this will get fun if I have a process with multiple threads and then I fork and then that process makes multiple threads and da da da da da that's when this course gets real fun so once we combine everything together yeah is it blocking? yeah p thread join blocks yeah just like wait blocks p thread join will block but it will block the main thread all right any other questions about this lots of fun it's most of them most thread things aside from threads living in a process most of the things have like a one to one equivalent so let's get back so yeah here is our previous example that waited properly we just put a p thread join on it now also because we joined all those thread resources were cleaned up so here's a question is there an equivalent equivalent to orphan processes and zombie processes for threads so are there orphan threads or are there zombie threads hmm yeah okay yeah so there is an equivalent of zombie threads because well in this case if we didn't join technically we could be in the situation where this thread runs prints and then returns which is the same thing as terminating a thread and then because we don't wait on it its resources would still be it would still be using some type of resource maybe it's stacked maybe at least its return value or something that would be hanging around and we can only get rid of its resources whenever we call join and clean it up so yeah that would be the equivalent of a zombie thread but there is no orphan threads because to have an orphan you need a parent-child relationship right whenever we had an orphan that means that the parent process died before the terminated before the child in this case if a thread terminates before the other it doesn't matter because all the threads just live within a process there's no parent-child relationship there's nothing like that yeah alright so any questions about that so there's zombie equivalent of a zombie thread but not an orphan thread because well they all live within a process yep yeah so the question is well if there's no parent-child relationship could I join the other one and the answer to that is yeah any thread can join any other thread so if I wanted to I could have this thread join the main thread if I wanted to there's yeah there's no relationship any thread can join any other thread you're just constrained by that you can only call it on each thread once so that makes your life fun so here is the next equivalent so whatever we had to process and we wanted to terminate a process well we could call exit or return from main for pthreads there is an aptly name pthread exit so it's the same idea but instead of an int again it is a pointer and that will be the return value of your thread so whenever your start routine returns that's the equivalent of calling pthread exit just like when your main returned that's the equivalent of calling exit so there is a one to one mapping between the two things and just like yeah and just like whenever you no I already said that okay yeah exact equivalent so instead of exit it's pthread exit for thread so any questions about that? alright so let's see another fun example so you might get into the situation where you don't really care about the return value of a thread in which case you don't really want to join it and you would rather its resources just get cleaned up immediately whenever it term terminates so the default is to have joinable threads which means someone has to call join on them in order to clean up their resources but detached threads will clean up their resources whenever they terminate the only drawback is you cannot get a return value out of them because you can't join them because whenever they're terminated they just clean up automatically so these this is actually nice if you again like I said if you don't care about the return value if it's a detached thread it cannot be a zombie because it gets cleaned up automatically and to make a thread detached you just call pthread detach on it and then suddenly after that it's a detached thread so if you call pthread detach twice in a row or on an already detached thread that's undefined behavior because the see uh and they don't like you all right so let's see that so detached threads aren't joined so let's go back to that same example so here is that same example so the only difference is I after I create the thread I detached it immediately and then otherwise I have my main thread that wants to print in main and then the new thread that wants to print in run so if I go ahead and execute this I see in main so why did I see in main again yes same issue my main thread finished first it reached this return zero which is the same as exit which gets rid of the process so gets rid of the threads so before my solution was to join right here right and I made sure it finished so what the hell am I going to do now I can't join it it's detached what option do I have so this is where it is good to think of the main thread as just another thread so there is a nice property about the pthread threading library in which it keeps track of all the threads and if you just exit a thread it won't exit the process until there are no more threads remaining so in fact in main I should have just called pthread exit here then in this situation if the main thread runs first it would print in main and then call pthread exit so now the main thread is just finished but there's another thread that can run the one that was going to call run and the library is smart enough to know that hey well I shouldn't terminate the process yet and then this thread will eventually run at some time then it will return from null which is again like a pthread exit and then this library is going to know that oh there's no other threads I can just terminate the process now so if I go ahead and compile that I will get both messages every single time and you'll also implement this in lab four so in lab four you're making your own threads threading library so that will be fun it's actually much it's not that bad it's fun don't worry about all right any questions about this all right we're good good good good good good yeah oh so in this case yeah I could call detach here but in this case that would be calling detach twice on the same thread yeah yeah yeah thread can detach itself if you want because if you want to get a reference to yourself there's this pthread self so that will return you yourself so yeah you could detach yourself if you really wanted to all right any other questions about that concerns looks fun yeah threads make your life uh fun all right so let's go into some other examples then so let's first illustrate that they are slower and hopefully my laptop doesn't act weird so here in this if I want to see that hey creating threads is way faster than creating processes well in this case I will fork 50 000 times so in my code all I do is I would create have a for loop that goes 50 000 times I call fork check for errors if I'm the child process I immediately exit so I'm just creating a the child process doesn't do anything and then in the parent I just wait on the child so if I run that I can see how long it takes to create 50 000 processes this should take like six ish seconds seven 6.6 seconds so pretty pretty slow so the thread version of it does the same thing creates 50 000 threads in here I do pthread create and I set attributes here but we can ignore them for now and we will probably never use them then here I tell it to execute a start routine give it no argument and the run function just returns zero or I should have just wrote return null same thing because null is zero and then after I create the thread I check for errors and then I just join it and then I just do that 50 000 times so how much faster is our threads so it turns out there's a lot of waiting and my computer's out there we go so here the total time is four seconds but you can see like the user time is much quicker it's only 0.9 seconds as opposed to like 3.8 so they also use like only 32 percent of my CPU instead of 90 percent for processes so they are overall much much much much much faster so any questions about that that's fun stuff okay all right so whoops didn't see that all right so so you can use attributes that are used there to get and set thread variables so how you do that is you just create this attributes structure then you can initialize it using their function and then you can ask what the default parameters are so for instance you can ask what the default stack size is you could there's also setters if you want to set the stack size to something different for for example in this case all it does is print whatever the stack size is and if I run this on linux I can see that by default my stack size is 8 megabytes so if you want to fix your stack overflow error hey just give yourself more stack space and you can buy yourself a bit more time if you really want but with this you can also use the attributes to set the state to joinable or detach so you don't have to call the detach function so in here there's like one of the fields is called detach state you can make it pthread create joinable so that will create make sure that the thread is joinable you could pthread create detached and so you don't have to do the separate detach step it's kind of up to you but but generally you write a lot of code with that and it looks kind of ugly that's why they just created pthread detach so you don't have to deal with the attributes all right so we can compare them too so previously we had an example where we created multiple forks so do do do do so when we created multiple forks let's see we could have a for loop that creates the new process that gives us an id so each time through this loop i is one two three four and then in the new process it forks so because it forks there are exact copies at the time of the fork so the first time through id is going to be one then id is going to be two then it is going to be three so if we are the parent we just immediately return from this we're done creating the new process otherwise we check for errors and then in the child process we'll simulate doing some work so this just has a for loop that executes 10 times and it says what the process is doing what step of the iteration it's on and then sleeps for a bit so if we go ahead and run that we should see you know all of our four processes are kind of running maybe in parallel maybe concurrently but they're each doing step zero then each doing step one then two slightly different orders but all of the uh all the one two three the last part is going to be sequential within the same process but between processes we don't really know what the order is going to be so here we go all the things happen and that's lots of fun so we know how to do that the fun one is if we do the exact same thing using threads so if we do the same thing using threads the rest of the function can look the exact same so we create four threads pass in the id but because threads are not independent we have to be able to pass a variable to a thread and the only way we can do that is through a pointer so to pass some information to a thread I can't just depend on them being independent and copies at the time of the fork because they're not they're all in the same address space so here I malloc an integer so I get an int pointer then I write the value of the id to it and then I create a thread so I create a new thread give it no attributes give it a run and give it an argument which is the pointer I got from malloc so any questions about that looks a bit uglier than the process one because they're all in the same address space but this is how you pass things to the threads so is that okay just passing an int pointer we got from malloc all right so in the run well because voidstar is just C's way of polymorphism I guess and like an I don't care pointer well we know it is an actually an int pointer so we can cast the argument to an int pointer and then dereference it and read the value from it so we read it into id which is just a local variable so it's on this thread stack so it's independent to this thread so we get id in this variable id and then after that we don't need the memory anymore so we should free it so this where memory management gets funner because the main thread did malloc but and then passed the data to the child or not the child so the thread it created and then the thread it created has to call free so that is memory management gets funner with this but the rest of it just has a for loop that does the same thing except instead of printing process number and then what iteration it's on prints thread number and then what iteration it's on so if I run this I get the same thing it's consistent between a thread they seem to switch off a bit more but I don't know anything about the order between threads at all but it's the same equivalent so any questions about the difference between those two nice they seem to always work on this thing all right no questions we're all good cool all right so I think that's no questions all because we literally have nothing else all right yeah multiple fork yeah yeah it is so it's in that materials directory lectures 04 yeah the multiple fork one is before so I think yeah we might have executed it quickly and didn't really look at it but it's actually in the 04 yeah so yeah don't worry you have all the code from the lectures if you don't yell at me because you should all right so we're good it's Friday we can go home sweet all right I will summarize and so threads enable concurrency we explored threads related them to something we already know processes a lot of the things map one to one the only thing that doesn't map is that threads live within a process but other than that threads can be joinable which is the same thing as having to call weight on a process there's an equivalent exit equivalent to creating them but instead of fork it's p thread create the main thing to know threads are really lighter weight they're cheap to create and they share memory by default so if you want to instead of doing inter-process communication which can be slow you can just create a new thread and they all share all the information by default but it's a lot easier to make mistakes and that will be like the bane of this course don't worry we won't get into mistakes until next next lecture so then also one thing to know is that each process can have multiple threads whenever a process starts it has a single thread we like to call it the main thread just that's how we like to communicate so with that just remember pulling for you we're on this


Hi, I am Dr. Gautam Kumar. I am the Consentant Liver Transplant and Hepatobiliary Surgeon here at Manipal Group of Hospitals, Bangalore. There has been a lot of queries about using stem cell therapy for damaged liver and regenerative medicine. But I think at present stage, we don't have enough knowledge one and technologies to use those stem cell therapy to regrow the liver or cure the already damaged liver. So stem cell therapy I feel right now is not at the stage. But maybe in future, maybe 10 years, 5 years down the line, maybe we'll have technologies to make this therapy as a viable option.


we have already completed aggregate demand aggregate supply model with different assumptions and we did policy analysis in aggregate demand and aggregate supply model or framework and with different assumptions we saw in detail in this model that policy can be effective or ineffective stabilisation policy is effective or not whereas on the other hand we saw anti-inflationary policy that is effective or not now we are going towards a very important topic which discusses the effectiveness of aggregate demand aggregate supply in more detail in the policy and its channels the point is that when you are studying aggregate demand aggregate supply framework in that we take some idea that why this effect is happening as we say aggregate demand curve has shifted to the right side or aggregate supply curve has shifted to the left side or any curve has shifted to any side so we are seeing its reason but in that when we talk about aggregate demand aggregate supply type model we are seeing on an aggregate level that because of any channel policy is effective or policy does not work so it is ineffective now the topic we are going towards is a further topic from that because we are talking about transmission mechanism so what is transmission mechanism and what is this topic now we will discuss it and then we will continue on this topic first of all the policy makers they want to know which type of policies they adopt so the output fluctuation can be less or the inflation rate fluctuation can be less we have seen in the previous models that you want to control the inflation with anti-inflationary policy you want to reduce the fluctuation of the output with the policy of output stabilization this means that the policy makers need to know that if they want to stabilize the output or reduce the inflation and keep it at a specific level or range then what type of policies they should adopt what policies should be implemented to reduce fluctuation in the output and inflation rate this means that the policy makers should know exactly how much effect the policy decision will have in which direction and in how much time the effect will be for example inflation should be controlled and monetary policy increases the interest rate and the interest rate increases from 100 basis point i.e. 1% to 1% point so they should know how much effect the policy decision will have on the inflation how much the output will be reduced how much the inflation rate will increase and how much the effect will be in time now all these questions are our topic questions which we call as transmission mechanism of monetary policy now monetary policy transmission mechanism now we define it policy transmission mechanism means that the monetary policy affects the output this was a question now the next question is which channel it affects did you understand i.e. if monetary policy affects aggregate demand and the output or inflation affects the aggregate demand from which channel it affects is there any other bridging between these i.e. there is no such that the interest rate increases and the aggregate demand decreases there must be some other variables that change and the aggregate demand changes so in the transmission mechanism we want to focus on those channels for example if there is change in interest rate and the monetary policy instrument and definitely it will affect aggregate demand but there are some bridging variables i.e. those variables that change because of the interest rate and the aggregate demand changes so we discuss between those variables in the topic of transmission mechanism aggregate demand, aggregate supply model there is no such topic now if you remember when we were talking about aggregate demand, aggregate supply model in that we always bring the interest rate in the middle i.e. the channels we are talking about in the middle there is a thing called traditional interest rate channel we will read this in detail later but till now it is just that the previous model we always talk about the interest rate channel which we will read in detail in the next lecture but apart from the interest rate you know that the interest rate you can call it price number one you know that the interest rate and the bond prices are inversely related we read this earlier and in some lectures we will read in more detail that the interest rate is an inverse relationship i.e. if you look at the interest rate then effectively or indirectly you are looking at the bond prices i.e. if the bond prices are in the middle then the interest rate is also a price or similarly you can also say that money is also an asset then the interest rate cannot be earned because there is no interest on money this means that money is an opportunity cost and the price is determined by the cost so you can say that on the other hand if you borrow money then what will you pay for the price of the bank's interest rate this means the interest rate is the price of the money so this means that the interest rate is the price of an asset so similarly the price of an asset because in the traditional model or in the demand aggregate supply model we always talk about the interest rate or we do not bring the interest rate explicitly in the demand supply model in your mind that there was an inflation rate on the axis and on the other side if there was an inflation rate then where is the interest rate the interest rate is the bridging variable i have already said that the transmission mechanism means that identify bridging variables i.e. if there is a change then what is the reason what is the variable then the interest rate is somewhere in between which we will clear in more detail in the next lecture we identify the channels and one of them is the traditional interest rate channel which is an asset price but in the world or in the financial markets or in the real economy there is no asset price so we will also see the other asset price channel similarly the third transmission channel has a major field i.e. transmission channels there are 3 types let us clear this first because in the next lecture we will discuss transmission channels so transmission channels there will be 3 types an interest rate channel another asset price channel and the third credit channel or credit view because there are 3 types of channels the first interest rate channel we have already had but we will discuss in detail in the next lecture but I will further tell the other price channel that there will be 3 types of channels which we will discuss in the future an exchange rate channel a Tobin's Q theory and a wealth effect or wealth channel this means we will read all these channels in which other asset price channel and then the credit view this is the credit channel in that we will read all types of channels in which there is a bank lending channel in which there is a balance sheet channel in which there is a cash flow channel unanticipated price level channel and after that household liquidity effect these are all the channels in the credit channel so in this lecture I gave you just an overview but what happens in that bridging variables bridging variables I will clear again where the policy changed where the final aggregate demand changed how it changed there must have been some variables in the middle because of which the aggregate demand changed I am calling the bridging variables for those variables if we look at the effect of the policy then this transmission channel will be affected CD will be affected CD ultimate variable if for example this is the transmission channel I have cleared this how many types of transmission channels are there I have told that and then in the sub channels I have shown you their list that all these sub channels our transmission channel will become about 10 types almost so we will read all these in the next lecture in detail thank you


All right. Thank you. My name is Josh Tingela. I'm on the Apache Flex PMC, although I do work on a number of other projects that are related to FlexJS. And one of those projects is actually what I'm going to talk about today. I recently started building an extension for Visual Studio Code to add support for ActionScript and MXML, which are the main languages used to develop FlexJS applications. So let me start out with a little bit of history to help you understand why I built the extension, and then we'll jump in and actually start creating a project and going through the steps of development there. So before Flex came to Apache, it started out as an Adobe product. It had a pretty active ecosystem. A lot of developers, different development environments, such as Adobe's Flash Builder, which you saw in the last talk, IntelliJ, IDEA, FDT, Flash developed. There were many of them. FlexJS is the next generation of the flex SDK that runs applications directly in the web browser with JavaScript instead of relying on a browser plugin like FlashPlayer. The FlexJS SDK can be used with the existing IDEs. However, they require some extra configuration to get them to work in the best state. And there are still some quirks, especially related to debugging, that make it not exactly the ideal situation. And so I felt that in order to help FlexJS grow and become more interesting to developers, I wanted to make sure that there was a better environment where FlexJS would be a first class citizen. And that is where Visual Studio Code comes in. Visual Studio Code is an open source project from Microsoft. It's free to download. It has a very vibrant ecosystem with a lot of developers checking it out and finding that it works really well for their workflows. There are frequent updates every month. New features are coming out. And it's really picking up a lot of steam. One of the best things about Visual Studio Code is that it supports extensions. Not just extensions for the languages that are built in when you first downloaded it, but you can actually add support for new languages. And so I decided to start working on a language extension to add support for ActionScript and MXML. And I released this extension under the name Next Gen ActionScript. Visual Studio Code sits somewhere between a basic text editor and a full-fledged ID. It's in this, like, happy middle ground that, at least for me, makes for a better workflow. You can open up any random text file and start editing. You'll get text highlighting and things like that. Or you can actually create a workspace and start building a more full-fledged project that's able to run the compiler and do debugging and things like that. And so when you're working in a language like ActionScript or MXML, you'll be able to take advantage of these code intelligence features, like being able to complete member variables and functions on an instance of a class. Or if you're calling a function, it'll give you the list of parameters that are available on that function. As you type, errors and warnings will update in real time as you add or delete a new character. It has knowledge of what the different symbols in your files are, so it'll know that a variable is of a certain type or what class a method is defined on and things like that. You'll actually be able to go to where anything is defined by, you know, using the mouse and clicking while holding the controller command key. It knows all the symbols in your document, in your workspace, so you're able to search those and navigate around your project pretty easily. And you can even rename things and things like that. Visual Studio Code also provides a debugging UI that you can use in any language where there is a debugger extension available, so you'll be able to do things like print to a debug console, add breakpoints so that it will pause when you get to a certain line of code or it'll stop at an exception. You can step through your code line by line. You can see the function call stack and actually see what variables are in scope at the various points of execution. You can dig down into the properties of any object that's in scope as deeply as you need. And so most of this talk today I'm going to actually show you live how to do each step of the development process. Let's start with installation. I have a few more slides before I get into that. So what you'll need for FlexJS development obviously includes Visual Studio Code. You can get that from code.visualstudio.com. This is a cross-platform editor, so it's available for Windows, Mac OS, and Linux. And FlexJS, the SDK, works on all three of those platforms as well. Once you have Visual Studio Code, when you run it you'll be able to go to the extensions view and install extensions from the Visual Studio Marketplace. So if you go there and you search for action script you'll be able to find the next-gen action script extension. You'll see this green install button there right next to the extension. You just click that and after a moment it'll ask you to restart and it will be good to go. And then finally you will also need Apache FlexJS. There are two different ways to install it. You can use the Flex SDK installer which will have a more guided process where you go through a wizard and choose where you want to save it on your hard drive and what dependencies you need and things like that. And then you can also, if you have NodeJS install, you can install FlexJS using the Node package manager. He's in the command there on the left. And then the final setup part is telling the next-gen action script extension in Visual Studio Code where you find FlexJS. And there's three different ways to do that. There are a couple of different environment variables where the extension will look to see if FlexJS is defined there and it will use it automatically if it's found. Otherwise there is a setting in Visual Studio Code that you can pass the path to your SDK and I'll show you how to do that. So let's go into creating a new project and we're actually going to do that right now in Visual Studio Code. First, here's the extensions view where you're able to search in the marketplace. You'll see next-gen action script extension pops up. I already have it installed here, so we don't need to install that right now. All right. Now to create a new project for FlexJS, first we need to create the workspace in a folder. So we open the folder. I'm just going to create a new empty folder on my desktop. I'll call it my first FlexJS project and open that up. And this will be our workspace where we add files and source code and things like that. Next I want to tell Visual Studio Code where to find the FlexJS SDK. So if we go into the preferences, we'll choose the setting option here. And there are two places where you can add settings for your development environment. There are the user settings which will apply to any workspace that you open. So if you just wanted to set up FlexJS once and have it worked in every workspace you could set them here. And then there's also the workspace settings which will apply only to the new folder that we created just a moment ago. I'm going to set this up in the workspace settings. And so you'll see as I type the available settings will actually show up in the completion list. You might remember from the slide earlier that we're looking for nextgenas.sdk.editor. And then we'll set that to a path to the SDK. I have that downloaded on my desktop so I'll just set that up here and save that. And now our workspace is ready to use FlexJS. If I go back here to the file explorer you'll see that the .vscode directory was created and there's a file in there called settings.json. And that's where our workspace settings are saved. Now to tell the workspace, yes, question. Correct. Workspace settings override the user settings. Okay. Now I'm going to create a file named asconfig.json. And this is sort of the main project configuration file for your workspace. It includes all of the compiler settings and some additional options as well. This is a .json file. I'm going to set up one compiler option to start and then I'm going to specify the entry point for our application. So I'm going to set the targets compiler option. By default FlexJS will produce a JavaScript setting JavaScript files for our application and it will create a Swift file that will run in Adobe Air or Flash Player. For our purposes we only need the JavaScript so I'm going to set that to .js flex. Similar to the settings file you'll see that completion is available within this file. Visual Studio Code is aware of what the format is and so if you're trying to remember the name of anything you just can hit control space and that will bring up a list of all the different options. And then I'm going to add a files field and I'm going to specify which class is going to be the entry point of our application. I haven't created this file yet but I will in just a moment. So I'm going to create a source directory and then I'm going to create a file named myfirstflexjsproject.mxml. And that will be the first class that runs when we launch our application.  I made a quick little snippet here. So this is probably one of the simpler FlexJS applications that you'll see. We use the express component set. It contains one view which contains a button with some text. Now I want to start adding a little bit of code to this to show you some of the code intelligence features that you can use while you're writing your code. So the first thing I'm going to do is create an event listener for this button when it's clicked. You'll see as I type, the completion will pop up offering types for this event parameter on the function. And when we actually complete one of those, the import for this class is automatically added because it's a different package. I'm just going to write some basic code here. I'm not trying to develop a full fledged application. It's mostly just to show you some of the features you can use in Visual Studio Code. So I'm going to do a little bit of math, and then I'm going to show the result in an alert dialog that pops up above the application. You'll see as I make the call to this function, the signature help pops up to tell us about the parameters. Then let me go up in the MXML and add this listener to the button. So I want to listen to the click event, and then inside of here I can actually use completion to call the listener and pass in the event. Between these two quotes is actually secretly a function body, and so Visual Studio Code is aware of that and can treat this small section of MXML as action script. You'll notice when I hover my mouse over the call to the event listener, we can actually see the class where it's defined. We can see it's a method. We can see the parameters there. If we do the same over one of these imports, you can see what package this class is in, what it extends, any interfaces it implements, and things like that. If we hold down the control key on Windows or Linux or the command key on Mac, and then we put our mouse over a symbol and then click on it, it will actually take us to the definition of whatever that symbol is. So when I do that here, you can see that the cursor moves here to where the listener is defined. Then one last thing I want to show you here is that we're able to rename symbols as well, so let's say I don't like the name sum, and I want to change that to result. That's not good. Well, if that did work, it would change both of these lines where the variable is named summed to result. Okay, so now we have a basic application here, and now we want to compile it, and then eventually we will run it. Okay, so visual studio code has sort of a universal file that it understands, regardless of which language you're using, and this file is called tasks.json. It's able to run any executable that you want, for example, a compiler, or maybe you want to run some kind of test runner or something like that, whether you're using action script and nmxml for FlexJS, or if you're writing a JavaScript or C or whatever language you want to use, you can create this file in visual studio code, and it will integrate with some of the features for building a project that are available. Now, you might remember from earlier, we created a file named asconfig.json, and this file included some of the compiler options that we're going to use to build our FlexJS application. Inside tasks.json, we could call the compiler directly and pass in all of the same compiler options, but then we'd have them duplicated in a couple of places, and we'd have to try to keep them in sync, and that's not really an ideal situation. And so I created this other utility called asconfig.c, which reads the asconfig.json file and actually parses all of the compiler arguments and calls the compiler using all of those values. So you can keep all of your options in one place and not have to worry about any kind of duplication. And so you can install that from node package manager, and that's what we're going to be using to build this project. So let me go back into visual studio code. All right, to create our tasks.json file, we're going to open up the command palette, which you can find in the view menu right here, command palette. You can also bring that up with a keyboard shortcut. It's control shift P on windows and linux or command shift P on macOS. P is in palest. So we'll bring that up and then type tasks. And you'll see the second option here, configure task runner for action script and asconfig.json. And that will automatically create this file for us and populate it with some useful arguments to pass to asconfig.json. So the two most important fields right here is the command field. This tells visual studio code which executable you want it to run. In this case, we're going to run asconfig.json. But you could run anything else you wanted. You can actually point to where the compiler executable is or if you wanted to run some other kind of task runner like maven or something like that, you could put that in here. And then we also have arguments to pass to that executable. For asconfig c, we're going to tell it to create a debug build. And then we also tell it where to find the flex.js SDK. You'll notice that this is already populated for us. The next-gen action script extension will look in visual studio code settings and find that path for us and just put it in there as a convenience. But we can change that to any SDK we want and edit this file however we please going forward. So if you press ctrl-shift-b or command-shift-b, that will run the main build task in task.json. So I'll use that shortcut now. And that's why I named that file wrong. So it's not my first flex.js project. It's my first flex.js application. Okay. So now the compiler runs and builds the project correctly. You can see that a bin directory was created here. That's where flex.js normally creates its output for JavaScript applications. Here's some of the generated JavaScript. You can see here our on-button-click listener for our event. Another file worth pointing out here is the index.html file. This is also generated by the compiler and it just bootstraps our application and starts calling our JavaScript code. And that's what we'll actually launch in the debugger in a moment. Okay. Another standard file in Visual Studio Code is a file named launch.json. This is very similar to task.json. It's a file that Visual Studio Code understands no matter what language you're using or some kind of runtime or whatever it is that you've built if you want to run it and debug it, you'll use launch.json. So the next-gen action script extension doesn't have a debugger for running JavaScript code in a browser, but there are separate extensions available for the major web browsers like Google Chrome, Firefox, Edge, Safari, even Safari running on an iOS device that you have plugged into your computer with USB. FlexJS can also produce JavaScript code from ActionScript for Node.js and of course you can still continue to build for the Adobe Flash Runtimes if you want and there's a debugger for that built into the next-gen ActionScript extension. So for this presentation we're going to use the debugger for Chrome, but there are debuggers for other browsers and the configuration is pretty similar. There's just a few minor tweaks here and there. So what we learned from one browser we can, that knowledge can go on to other browsers as well. So we'll install this extension from the extensions view just like we did with the next-gen ActionScript extension. Just search for Chrome debug and it should pop up and you can install it. So as you recall, for FlexJS applications we use ActionScript in MXML, but we produce JavaScript that can be run in the browser. Ideally we would want to be able to debug in our original language where we developed them in. And so web browsers have something called source maps that tell you that if you're running the JavaScript code on line 16 character 4, that actually goes back to line 6 character 2 in this ActionScript file. And it's very similar to how if you were building an application and see your Java it would produce machine code or byte code and the debugger needs some way to know that this byte code here maps back to your original code there. So it makes it so JavaScript is kind of like the byte code for other languages like ActionScript. So FlexJS is able to produce source maps and there is a source map compiler option that you can use. And we will add that to our asconfig.json to tell the compiler to produce those for us. So let's jump in there and do that. We open up the debug view and you'll see here it says no configurations. We want to add one. And then I already have the debugger for Chrome extension installed so that will show up in the list now and I'll choose that. Other browsers will show up there as well. You can see I have the Firefox extension installed too. And then it will generate a launch.json file for us. It has a couple of default configurations here. We don't need this attached one at all for our project and we're actually going to tweak things a little bit on this other one. So the default configuration that it creates tells Chrome to open up a URL. And it assumes that we have some kind of local web server running on our machine and so it tells us to open up local host. As your application gets bigger you're probably going to want to do something like that. There's various security restrictions and stuff that you need to care about. So that's probably what you'll be using a lot of the time. For this quick demo here as part of the presentation I'm just going to open up a file from the local file system. So you can see I replaced the URL field with a file field and then I'm pointing that to the index.html file that the compiler produced. This workspace root token here is standard virtual studio code before it launches the project or will replace this with the actual path to our workspace. There are a couple of other fields I wanted to point out. The source maps field tells Chrome to look for the source maps that the compiler will generate for us. Not all browsers require you to do that. Each extension has its own different configuration options. So for example I know that Firefox will automatically find the source maps and simply use them. So it depends on which browser you're using. And then this last field prelaunch task is a standard field that is available in any launch configuration. This tells Visual Studio Code to run a task before it starts debugging. So in this case we wanted to run AS config C to tell it to build our project before we run it in the browser. So let's go to AS config.json and add our source map compiler option because we'll want that for debugging. Then if I build again we can see here in the bin directory that there's a new file here that ends with the extension.js.map. And this is the source map that the browser uses. You can see it basically says when you're running this JavaScript file the actual source is here in this Mxml file. And then this line here with the mappings is kind of an obscure format that somehow tells it this line in this character map back to this line in that character. And then I just want to launch that now and we'll see this application running in the web browser. So we have our new configuration here in the debug view. If I hit the start debugging button you'll see down there that we have the prelaunch task so it's going to run the compiler first and then here is our application running in Chrome. If I click that button you'll see the alert pop up with the text that we told it to. So now that we have that running in the browser let's go back to our Mxml file and try out some debugging tasks. So I'm going to add a break point in our event listener and so now when I click on that button it's going to stop at this break point and we'll be able to inspect the current state of our application. So I'll go back to the browser. The break points are updated in real time so I didn't need to relaunch or anything. I click the button and it will jump back to Visual Studio Code. You'll see in the browser though that it's paused so it hasn't shown the alert yet because it stopped at the break point. And now we're on this line of code. If I go into the debug view you can see on the left here that all of the variables that are in the local scope are displayed. So for instance this event listener has a parameter for the event. We can see that here and we can drill down and see the various properties of the event as they are in the current application state. You can see our local variables A, B and some are still undefined because we haven't run those lines of code yet. So let me step through those and we can see that update. A is now two, B is five and the sum is seven. And then also on the left here you can see the call stack and we're in our listener here, the on button click method here on our application. If we go up a level this is actually the function scope I was talking about before for listening to the click event in our MXML. When I clicked on that that line is highlighted so we can see that is where the execution is happening. If we wanted to go further up the call stack you can see there are classes in the FlexJS framework that are in there so we would be able to go to those classes and see which line is actually executing then if I can just resume go back to our browser and everything continues as normal. There was one thing I forgot to show a bit earlier so we were able to control click or command click on any symbol in this file if we wanted to do it right here on this alert class this is a class that is part of the FlexJS framework and we can actually go there and see the original ActionScript source code for this component and so you can see all of the original code is there we can see the comments we can see the documentation and so that's a really good way to gain an understanding of the framework and be able to have direct access to all of the documentation and things. Let me try the rename again now that I realized that I was referencing the wrong file name so there we go okay so the rename is now working okay so I have links here to all the various things that are downloaded for this workflow links to documentation and things that is all I have today so are there any questions? Okay, thank you.


Hi, I'm Chris Beistroff, last author on green lighting, green fluorescent protein, faster and more efficient folding by eliminating a cis-trans peptide isomerization event published in Protein Science. In brief, my lab computationally designed and characterized a variant of GFP that has some new and useful properties. Peptide isomerization is the rotation of a peptide bond from cis to trans, a slow process with a halftime in the range of hundreds of seconds. Cis-trans isomerizations occur mainly at pre-proline positions. GFP is an 11-stranded beta-barrel with a distorted alpha helix going through the center. The barrel structure positions internal side chains to catalyze the cyclization and oxidation of the backbone of three central residues in that helix to create the fluorescent chromophore. The folding of GFP is multi-phasic, having fast, medium, and slow phases implying parallel folding pathways. The slow phase was shown by Kuajima to be a peptide bond isomerization event in the unfolded state associated with a proline. Basework by Jennings in 2009 found that the refolding of GFP by guanidine dilution left 61% of the protein in a trapped, non-fluorescent state. In the trapped state, the chromophore appeared to be mobile as judged by the lack of splitting of NMR resonances on the chromophore. Based on the effects of point mutations, they suggested that three highly conserved prolings at positions 58, 75, and 89 were required for the efficient maturation of the GFP chromophore. We reasoned that one of these three prolings must be responsible for the non-fluorescent trapped state, and we set out to test that hypothesis. Only Pro 89 is in the cis confirmation in GFP, therefore we hypothesized that Pro 89's cis-peptide bond isomerization was responsible for the trapped state and also for the slowest step in GFP's folding kinetics. Since others had already attempted point mutations at Pro 89 and found them to be unstable, we decided to eliminate the cis-peptide by rebuilding the loop. We added two residues, then we searched the database for likely confirmations for the new loop. We then used in-house software to design the side chains of the new loop, having no cis-peptides in it. The protein was synthesized in the lab and, unlike most experiments in my lab, it worked like a charm, producing a brightly glowing green protein. Its only drawback was a 40% decrease in brightness due to both lower chromophore maturation efficiency and lower quantum yield. We then solved the crystal structure. The crystals had five molecules in the asymmetric unit, and in each copy we could see clearly that the newly designed GFP variant had no cis-peptide bonds in the region around Pro 89, and since it has no cis-peptide bonds elsewhere either, we called it all-trans GFP or AT GFP. The structure is available from the PDB as 4LW5. Then we refolded the protein by quantity dilution and compared it to the GFP variant from which it was derived, a super-efficient folder generated by the Waldo lab called OPT GFP. AT GFP recovered much more of its original fluorescence than OPT GFP. And when the data was fit to multiple kinetic phases, it was found to have the same three fast phases of folding, but the slow phase was faster and decreased in its relative amplitude. If we refolded the protein by pH jump instead of quantity dilution, we saw that the slow phase was completely eliminated. Read the paper if you want to know how we explain this discrepancy. Then we tested to see if the protein still fell into the long-lived trapped state. We selected the midpoints of unfolding using both pH and quantity in separate experiments. GFPs were titrated to the midpoint from either the folded state or from the unfolded state and left to equilibrate for at least 96 hours. Then we measured the fluorescence. The difference between the protein that was titrated from the unfolded state versus the one that was titrated from the folded state is a measure of hysteresis which quantifies how much of the protein is misfolding into a trapped non-fluorescent state. Different with the previously published results, OptGFP showed a significant loss of fluorescence due to hysteresis, but to our amazement we saw that all the hysteresis was eliminated in ATGFP. This was true whether we used guanidine or pH. We conclude that the trapped state must be a near-native conformation with a transpeptide bond at Pro 89. It cannot isomerize to the native cis conformation due to its kinetic stability in the folded state. An image of the folding landscape of GFP is emerging from these studies in which the trapped trans Pro 89 state cannot reach the native state without passing through the unfolded state and the native state folding pathway consists of two channels corresponding to two folding intermediates. The removal of the cis trans isomerization at Pro 89 leaves a simpler energy landscape. ATGFP may prove useful wherever the robust folding of GFP is important for its application. Thanks for watching.