[ETA: Updated OneDrive slides link]
Most of the talks I gave at C++ and Beyond 2012 last summer are already online at Channel 9. Here are two more.
This is a two-part talk that covers the C++ memory model, how locks and atomics and fences interact and map to hardware, and more. Even though we’re talking about C++, much of this is also applicable to Java and .NET which have similar memory models, but not all the features of C++ (such as relaxed atomics).
Note: This is about the basic structure and tools, not how to write lock-free algorithms using atomics. That next-level topic may be on deck for this year’s C++ and Beyond in December, we’ll see…
atomic<> Weapons: The C++ Memory Model and Modern Hardware
This session in one word: Deep.
It’s a session that includes topics I’ve publicly said for years is Stuff You Shouldn’t Need To Know and I Just Won’t Teach, but it’s becoming achingly clear that people do need to know about it. Achingly, heartbreakingly clear, because some hardware incents you to pull out the big guns to achieve top performance, and C++ programmers just are so addicted to full performance that they’ll reach for the big red levers with the flashing warning lights. Since we can’t keep people from pulling the big red levers, we’d better document the A to Z of what the levers actually do, so that people don’t SCRAM unless they really, really, really meant to.
- The facts: The C++11 memory model and what it requires you to do to make sure your code is correct and stays correct. We’ll include clear answers to several FAQs: “how do the compiler and hardware cooperate to remember how to respect these rules?”, “what is a race condition?”, and the ageless one-hand-clapping question “how is a race condition like a debugger?”
- The tools: The deep interrelationships and fundamental tradeoffs among mutexes, atomics, and fences/barriers. I’ll try to convince you why standalone memory barriers are bad, and why barriers should always be associated with a specific load or store.
- The unspeakables: I’ll grudgingly and reluctantly talk about the Thing I Said I’d Never Teach That Programmers Should Never Need To Now: relaxed atomics. Don’t use them! If you can avoid it. But here’s what you need to know, even though it would be nice if you didn’t need to know it.
- The rapidly-changing hardware reality: How locks and atomics map to hardware instructions on ARM and x86/x64, and throw in POWER and Itanium for good measure – and I’ll cover how and why the answers are actually different last year and this year, and how they will likely be different again a few years from now. We’ll cover how the latest CPU and GPU hardware memory models are rapidly evolving, and how this directly affects C++ programmers.
I’m about two weeks late posting this, but two more C++ and Beyond 2012 videos are now available online.
The first is my concurrency talk:
I’ve spoken and written on these topics before. Here’s what’s different about this talk:
- Brand new: This material goes beyond what I’ve written and taught about before in my Effective Concurrency articles and courses.
- Cutting-edge current: It covers the best-practices state of the art techniques and shipping tools, and what parts of that are standardized in C++11 already (the answer to that one may surprise you!) and what’s en route to near-term standardization and why, with coverage of the latest discussions.
- Blocking vs. non-blocking: What’s the difference between blocking and non-blocking styles, why on earth would you care, which kinds does C++11 support, and how are we looking at rounding it out in C++1y?
The answers all matter to you – even the ones not yet in the C++ standard – because they are real, available in shipping products, and affect how you design your software today.
The second is one of the panels:
From C++ and Beyond 2012, Andrei, Herb and Scott present Convincing Your Colleagues – an interactive panel.
You can’t do a better job if you don’t change what you’re doing, but change is hard. It’s especially hard when what needs to change is your colleagues’ approach to software development. Moving your team forward often requires persuading your peers to change their behavior, sometimes to do something they’re not doing, other times to stop doing something they’ve become accustomed to. Whether the issue is to embrace or avoid C++ language features, to adopt new development tools or abandon old ones, to increase use of or scale back on overuse of design patterns, to adhere to coding standards, or any of the plethora of other matters that affect software creation, moving things forward typically requires getting your colleagues to buy into the change you’re proposing. But how can you do that?
In this panel session, Andrei, Herb, and Scott share how they go about convincing their colleagues to change and take questions from the audience.
Truth be told, the panel ranged widely and probably most of the time was on other topics!
I hope you find them useful.
Yesterday, many thousands of you were in the room or live online for my talk on The Future of C++. The talk is now available online.
This has been a phenomenal year for C++, since C++11’s publication just 12 months ago. And yesterday was a great day for C++.
Yesterday I had the privilege of announcing much of what Microsoft and the industry have been working on over the past year.
(minor) C++ at Microsoft
On September 12, we shipped VC++ 2012 with the complete C++11 standard library, and adding support for C++11 range-for, enum class, override and final. Less than two months later, yesterday we announced and shipped the November 2012 CTP, a compiler add-in to VC++ 2012 adding C++11 variadic templates, uniform initialization and initializer_lists, delegating constructors, function template default arguments, explicit conversion operators, and raw string literals. Details here, and download here.
Note that this is just the first batch of additional C++11 features. Expect further announcements and deliveries in the first half of 2013.
(major) C++ across the industry
Interest and investment in C++ continues to accelerate across the software world.
- ISO C++ standardization is accelerating. Major companies are dedicating more people and resources to C++ standardization than they have in years. Over the next 24 months, we plan to ship three Technical Specifications and a new C++ International Standard.
- C++ now has a home on the web at isocpp.org. Launched yesterday, it both aggregates the best C++ content and hosts new content itself, including Bjarne Stroustrup’s new Tour of C++ and Scott Meyers’ new Universal References article.
- We now have a Standard C++ Foundation. Announced yesterday, it is already funded by the largest companies in the industry down to startups, financial institutions to universities, book publishers to other consortia, with more members joining weekly. For the first time in C++’s history since AT&T relinquished control of the language, we have an entity – a trade organization – that exists exclusively to promote Standard C++ on all compilers and platforms, and companies are funding it because the world runs on C++, and investing in Standard C++ is good business.
This is an exciting time to be part of our industry, on any OS and using any language. It’s especially an exciting time to be involved with C++ on all compilers and platforms.
Thank you all, whatever platform and language you use, for being part of it.
A few hours ago I sat down to give a short teaser for my webcast talk this Friday.
Here it is. Feel free to forward.
(I don’t think they believed me when I said I could keep it to under two minutes.)
In my talk on Friday, there will be announcements of broad interest to C++ developers on all compilers and platforms. Please help spread the word.
Friday, November 2, 2012
12:45pm (U.S. Pacific Time)
This talk will give an update on recent progress and near-future directions for C++, both at Microsoft and across the industry, with some announcements of interest in both areas. The speaker is the lead language architect of Visual C++ and chair of the ISO C++ committee.
The talk will be webcast live on Channel 9, and available soon afterwards on demand.
If you know people who are interested in C++, on any platform, you’ll want to let them know to tune in.
I’ve blogged about Casablanca before. Here’s a related talk from TechEd Australia:
Casablanca is a Microsoft incubation effort to support cloud-based client-server communication in native code using a modern asynchronous C++ API design. Think of it as Node.js, but using C++ – from simple services, to JSON and REST, to Azure storage and deployment, and more.
Casablanca gives you the power to use existing native C++ libraries and code to do awesome things on the cloud server. In this talk from TechEd Australia, John Azariah and Mahesh Krishnan show how it’s done.
The second panel from C++ and Beyond 2012 is now available on Channel 9:
Here is the “Ask Us Anything” panel from C++ and Beyond 2012.
Andrei Alexandrescu, Scott Meyers and Herb Sutter take questions from attendees. As expected, great questions and answers…
Table of contents (click the time codes ([xx:xx]) to hear the answers…):
- message passing primitives in future versions of the standard… [00:00]
- standardized unit testing framework… [02:55]
- std::async… [04:30]
- standard modules proposal… [08:14]
- keyword additions and the standard library… [09:35]
- problems (and solutions) with exceptions… [12:50]
- future of concepts… [22:34]
- std::thread and thread interruption… [23:03]
- when to use the auto keyword (and when not to…)… [25:03]
- more on auto (benefits of reduncancy, type conversion issues with bool to int?)… [29:31]
- const and multithreaded programming, in C++11 const means thread safe, too… [35:00]
- yet more on auto (impact on rampant use and code readability/comprehension)… [42:42]
- compiler type deduction information (compiler switch that prints out auto deduced type information)… [50:18]
- printing out code for review that replaces auto with the actual type… [53:30]
- auto and dynamic memory allocation… [54:59]
- useful, broadly-used concurrency libraries… [57:00]