July 2014

CppCon Program Highlights, 4 of N: C++ and Modern Concurrency

The CppCon 2014 conference program has been posted for the upcoming September conference. We've received requests that the program continue to be posted in "bite-sized" posts, a few sessions at a time, to make the 100+ sessions easier to absorb, so here is another set of talks. This series of posts will conclude once the entire conference program has been posted in this way.

 

CppCon would be incomplete without strong coverage of concurrency-related techniques. But this year's material isn't about just any old concurrency techniques -- it's about stitching high-update-rate data structures and highly responsive algorithms into high performance scalable code. As always, these talks are by the right people -- Those Who Know and Those Who Do in some of the leading efforts in our industry, from *nix to Windows and from IBM to Microsoft to BlackBerry.

In this post:

  • C++ Memory Model Meets High-Update-Rate Data Structures
  • Lock-Free Programming (or, Juggling Razor Blades)
  • Lock-Free by Example
  • Async Sequences and Algorithms to Compose Them

 

C++ Memory Model Meets High-Update-Rate Data Structures

Highly performant and scalable techniques such as RCU and hazard pointers have been quite successful in read-mostly situations. However, there do come times when updates are necessary. It would be convenient if there was some general update-side counterpart to these techniques, but sadly there is not yet any such thing. Nevertheless, there are a number of specialized update-side techniques whose performance and scalability rival those of RCU and hazard pointers. This talk will discuss several of them, one of which is a solution to a challenge to the speaker at the 2014 Issaquah C++ standards committee meeting. This talk will also provide an outlook into the future of low-overhead scalable updates.

Speaker: Paul E. McKenney, Distinguished Engineer, IBM Linux Technology Center. Paul E. McKenney has been coding for almost four decades, more than half of that on parallel hardware, where his work has earned him a reputation among some as a flaming heretic. Over the past decade, Paul has been an IBM Distinguished Engineer at the IBM Linux Technology Center. Paul maintains the RCU implementation within the Linux kernel, where the variety of workloads present highly entertaining performance, scalability, real-time response, and energy-efficiency challenges. He is also the editor of "Is Parallel Programming Hard, And, If So, What Can You Do About It?" Prior to that, he worked on the DYNIX/ptx kernel at Sequent, and prior to that on packet-radio and Internet protocols (but long before it was polite to mention Internet at cocktail parties), system administration, business applications, and real-time systems. His hobbies include what passes for running at his age along with the usual house-wife-and-kids habit. Website: http://www.rdrop.com/users/paulmck

 

Lock-Free Programming (or, Juggling Razor Blades)

Example-driven talk on how to design and write lock-free algorithms and data structures using C++ atomic -- something that can look deceptively simple, but contains very deep topics. (Important note: This is not the same as my "atomic Weapons" talk; that talk was about the "what they are and why" of the C++ memory model and atomics, and did not cover how to actually use atomics to implement highly concurrent algorithms and data structures.)

Speaker: Herb Sutter, Microsoft. Author, chair of the ISO C++ committee, software architect at Microsoft.

 

Lock-Free by Example

Dive into and follow along making a lock-free queue. In particular, a multi-producer, multi-consumer, growing, shrinking, mostly contiguous, lock-free circular queue. With this single (complicated!) example, we will come across, and attempt to solve, many of the typical problems found in lockfree programming, and delve into the pros and cons of various solutions to those problems.

Speaker: Tony Van Eerd, C++ Guy, BlackBerry. Tony Van Eerd has been coding for well over 25 years, and hopefully coding well for at least some of that. Most of that time has been in the graphics/video/film/broadcast industry (at Inscriber/Adobe), writing low level pixel++, high level UI, as well as threading and everything else in between. He now works at BlackBerry, watching over the BlackBerry APIs. He is also the company-wide "C++ guy" writing half of his code in emails and wiki pages.

 

Async Sequences and Algorithms to Compose Them

All have heard and some have wept over all the many ways to express sequences (eg. iterator, range, container) and the algorithms to compose them (eg. filter, transform, merge, zip) in C++. I will describe one more sequence that must have a representation and an algorithm library - A sequence of values that will arrive over time.

Speaker: Kirk Shoop, Developer, Microsoft Open Technologies, Inc. Hi! I have a family. I like food. I need sun (My need for sun must be why I live in Seattle). I like C++. I don't like threads (My aversion to using threads must be why I spend all my free time working on a library that composes sequences on many threads). I work at Microsoft Open Technologies, Inc.Website: http://kirkshoop.blogspot.com/Twitter handle: @kirkshoop

 

Solaris Studio 12.4 Beta update 7/2014

The Oracle Solaris Studio 12.4 Beta, Update 7/14 release is now available for download.

This update includes new features and enhancements based on current user feedback during the Beta program. We look forward to getting additional feedback!

Feature highlights in this update include:

  • Additional support for C++11, including full support for Lambda expressions and initializer lists
  • Updated Performance Analyzer with a completely redesigned UI that automatically saves your configuration settings and allows you to save custom configurations, new Heap data view, new metrics to track IPC/CPI, and call-tree enhancements
  • Updated Code Analyzer with performance and memory usage improvements
  • OpenMP 4.0 implementation tuned for the latest Oracle systems
  • And many more features, enhancements and fixes in response to user feedback

Learn More and explore resources including the What's New guide and the latest videos and articles.

CppCon Bonus Talks: C++ at Facebook -- Boris Kolpackov

cppcon-053.PNGIn the CppCon spirit of talks "by the C++ community for the C++ community" given by Those Who Know and Those Who Do in some of the leading code bases in our industry, we're very pleased to relay this just announced on CppCon.org:

Bonus Talks: C++ at Facebook

by Boris Kolpackov

From the announcement:

We left a few slots in the CppCon 2014 program for what we call “invited talks.” They are used to fill in important but otherwise under-represented topics (such as game development, mobile and embedded systems, etc) or generally interesting and unusual uses of C++. Today we are ready to announce the first two invited talks which are on Facebook’s heavy use of C++ in their server infrastructure:

Marcelo Juchem: "Meta Techniques: Heterogeneous Polymorphism and Fast Prototyping at Facebook"

As data driven systems evolve there’s an ever growing demand for bringing new functionality into existing systems in an efficient, maintainable and least intrusive manner. When implementing features with different semantics or interfaces, virtual inheritance requires a compromise between design simplicity and performance. This implies a need for new techniques to achieve heterogeneous polymorphism efficiently. With C++11 and 14, type lists, type maps and variants can now be trivially implemented by the initiated. Facebook moves fast so we quickly adopted the new standards to further explore the capabilities of the type system. This talk demonstrates some meta-programming techniques like reflection and compile-time built structures to achieve heterogeneous polymorphism and fast prototyping.

Speaker’s bio: Marcelo Juchem is a Software Engineer at Facebook, working in stream processing and spam fighting systems. Fascinated by template meta-programming, he sees the C++ compiler as a powerful type juggler and programmable code generator. Such capabilities allow the combinatoric composition of types into efficient abstractions, reducing code duplication and enabling non-library writers to design logical components interaction and semantics rather than deal with low level details.

Drew Paroski: "C++@Facebook: How HHVM Uses Modern C++ for Fun and Profit (Both Literally)"

After an overview of HHVM’s architecture and history, this talk delves into what made C++ the language of choice when writing VMs and execution engines, including performance, benefits over assembly, and enabling C++ to call into JIT’d code. We cover the importance of control over ‘unsafe’ details: for memory layout, unions, casting, and bit-stealing. HHVM found important wins from being able to ensure that certain structures (Classes) are allocated in low-memory (i.e. addresses that fit within 32-bits) which allowed use of 32-bit immediates in machine code and 32-bit fields in objects. Also, being able to have fine control over memory allocation enabled having “huge pages”, a feature exposed in Linux (and other OSes) that allowed using fewer iTLB entries which gave a significant boost for Facebook’s PHP codebase. The talk will also mention some things that got in the way and how they were dealt with. Some were language features, such as virtual functions, member pointers. Before move constructors and rvalues were introduced in C++11, there were performance issues with returning smart pointers. While these were things that got in the way, it’s a testament to C++’s flexibility that there were always ways to work around these things in a stable fashion.

Speaker’s bio: Drew Paroski is a Software Engineer at Facebook and a co-creator of the HipHop Virtual Machine (HHVM) and the Hack programming language. Among other things, Drew is the primary designer and implementor of HHVM’s virtual instruction set architecture and Hack’s Collections framework, and he was a core contributor to HHVM’s JIT compiler in the early days of the project. Before Facebook, Drew worked at Microsoft helping improve the performance of Microsoft’s virtual machine for .NET languages (C#, VB.NET, F#, and more) known as the Common Language Runtime. Drew has been coding in C++ for over 10 years, and he enjoys designing and optimizing complex low-level systems.

Exception-Safe Coding in C++ -- Jon Kalb

If you haven't sent a colleague to this site lately, why not send someone there this week?

Exception-Safe Coding in C++

by Jon Kalb

Safe usage of exceptions is a non-trivial problem that the industry has struggled with for the better part of two decades. If you have fear, uncertainty, or doubt about exception safety or just want to see the best practices for using exceptions in C++, this session is for you. We’ll start with “What is the problem we are trying to solve?” and discuss alternatives, acknowledge the challenges associated with exception usage, and cover some well-meaning but misguided attempts at safety. I will then present a set of guidelines that are the basis for safe exception usage and solid implementation techniques, including how to transition from an exception-unsafe legacy code base.

When we are finished you will know how to produce code that is easier to write, easier to understand, faster, and 100% robust in the face of exceptions.

... "To say that I learned a lot from that video would be an understatement! I LOVED the talk and I really think you need to either write a book about this or at least have an article/blog." -- Abi Ullattil

You and your colleagues can also enjoy a live and interactive updated version of this talk at CppCon this September. CppCon 2014 will feature an updated and interactive version of this talk, along with some 100 other high-quality sessions about C++ across many domains, from mobile devices and web development, to games and embedded systems (including the Mars Rover), to Parallel STL and TMP.

Inline Functions -- Andrzej KrzemieĊ„ski

Today from Andrzej:

Inline Functions

by Andrzej Krzemieński

From the article:

Inlining functions can improve or worsen your program’s performance (however you define ‘performance’). It has been described in detail in Herb Sutter’s GotW #33. Compiler can decide to inline your function, even if it was not declared inline and conversely: it can decide not to inline it even if it is declared inline. So, you might be tempted to think that declaring functions as inline has no useful portable meaning in C++. This is not so. I have found inline functions useful, and its usefulness has nothing to do with inlining...

A Cheat Sheet for HTTP Libraries in C++ -- Vladimir

cheat-sheet.PNGRecently on Kukuruku:

A Cheat Sheet for HTTP Libraries in C++

By Vladimir

From the article:

... I decided to make a cheat sheet with examples of HTTP requests in C++ using different libraries. I guess Kukuruku is the best place for keeping such cheat sheets.

We’re going to take a look at the following libraries:

  • WinInet
  • WinHttp
  • Casablanca
  • Qt
  • POCO
  • wxWidgets
  • Boost.Asio
  • libcurl
  • neon
  • .NET (С++/CLI)
  • IXMLHTTPRequest
  • HappyHttp
  • cpp-netlib

Making the Most of C++11/14 -- Sasha Goldshtein

New on Lanyrd:

Making the Most of C++11/14 (slides)

by Sasha Goldshtein

The C++11 standard is already behind us, and C++14 is just around the corner. With a huge variety of language features such as lambdas, rvalue references, auto and decltype, and variadic templates, it's easy to get lost in C++. In fact, it often seems like a completely new and foreign language. In this workshop we will look at the most important language features that improve system performance and developer productivity, with a glimpse towards what C++14 will bring. We will make the most of Visual C++ 2013 and see how to convert and refactor code to use modern C++ idioms.

Post-Rapperswil mailing available

The post-Rapperswil mailing of new standards papers is now available.

Many of the papers in the mailing have already been published individually on this blog.

NOTE: The following are only those papers in the mailing that have not already been publicized on this blog.

WG21 Number Title Author Document Date Mailing Date Previous Version Subgroup Disposition
N4054 PL22.16 2014-06 Rapperswil Minutes Ville Voutilainen 2014-07-03 2014-07      
N4057 A Proposal to Add a Const-Propagating Wrapper to the Standard Library J. Coe, R. Mill 2014-07-02 2014-07 N3973 Library  
N4060 Changes to vector_execution_policy Pablo Halpern 2014-06-11 2014-07   Concurrency  
N4061 Greatest Common Divisor and Least Common Multiple, v3 Walter E. Brown 2014-06-30 2014-07 N3913 Library  
N4064 Improving pair and tuple, revision 2 Daniel Krügler 2014-07-02 2014-07 N3739 Library  
N4065 make_array, revision 2 Zhihao Yuan 2014-06-26 2014-07 N4031 Library  
N4066 Delimited iterators (Rev. 3) M. Spertus, N. Wilson 2014-06-18 2014-07 N4007 Library  
N4068 Toward More Expressive Iterator Tags Bill Seymour 2014-06-28 2014-07   Library  
N4069 C++ Ostream Buffers L. Crowl, P. Sommerlad 2014-06-18 2014-07 N3978 Concurrency  
N4072 Fixed Size Parameter Packs Maurice Bos 2014-05-26 2014-07   Evolution  
N4075 Centralized Defensive-Programming Support for Narrow Contracts (Revision 5) J. Lakos, A. Zakharov, A. Beels 2014-06-20 2014-07 N3997 Library  
N4081 Working Draft, C++ Extensions for Library Fundamentals Jeffrey Yasskin 2014-07-07 2014-07 N4023    
N4082 Programming Languages — C++ Extensions for Library Fundamentals Jeffrey Yasskin 2014-07-07 2014-07      
N4083 Editor's Report for Version 1 of the Library Fundamentals TS Jeffrey Yasskin 2014-07-07 2014-07      
N4084 Working Draft, C++ Extensions for Library Fundamentals, Version 2 Jeffrey Yasskin 2014-07-06 2014-07      
N4085 Editor's Report for Version 2 of the Library Fundamentals TS Jeffrey Yasskin 2014-07-06 2014-07      
N4086 Removing trigraphs??! Richard Smith 2014-06-18 2014-07 N3981 Evolution  
N4088 Task Region R3 P. Halpern, A. Robison, A. Laksberg, H. Sutter, et al. 2014-06-21 2014-07 N3991 Library  
N4089 Safe conversions in unique_ptr<T[]>, revision 2 Geoffrey Romer 20140625 2014-07 N4042 Library  
N4090 The Maladies of All Member Templates: An Incomplete Biography of Specialization (DR727 + DR1755) Faisal Vali 2014-06-21 2014-07 N4042 Library  
N4091 C++ Standard Core Language Active Issues, Revision 90 William M. Miller 2014-07-07 2014-07 N4018 Core  
N4092 C++ Standard Core Language Defect Reports and Accepted Issues, Revision 90 William M. Miller 2014-07-07 2014-07 N4019 Core  
N4093 C++ Standard Core Language Closed Issues, Revision 90 William M. Miller 2014-07-07 2014-07 N4020 Core  
N4094 Response To: Let return {expr} Be Explicit H. Hinnant, V. Voutilainen 2014-07-06 2014-07   Evolution  
N4104 Working Draft, Technical Specification for C++ Extensions for Parallelism Jared Hoberock 2014-07-04 2014-07 N3960    
N4105 Information technology – Programming languages, their environments and system software interfaces – Technical Specification for C++ Extensions for Parallelism Jared Hoberock 2014-07-04 2014-07      
N4106 Parallelism TS Editor's Report, post-Rapperswil Jared Hoberock 2014-07-04 2014-07      
N4107 Working Draft, Technical Specification for C++ Extensions for Concurrency Artur Laksberg 2014-07-07 2014-07 N3970    
N4108 Concurrency TS Editor's Report, July 2014 Artur Laksberg 2014-07-02 2014-07      
N4111 Static reflection (rev. 2) Matúš Chochlík 2014-07-02 2014-07   Reflection  
N4115 Searching for Types in Parameter Packs B. Seymour, S. Lavavej 2014-07-04 2014-07   Library  
N4117 C++ Standard Library Active Issues List (Revision R89) Alisdair Meredith 2014-07-08 2014-07 N3967 Library  
N4118 C++ Standard Library Defect Report List (Revision R89) Alisdair Meredith 2014-07-08 2014-07 N3968 Library  
N4119 C++ Standard Library Closed Issues List (Revision R89) Alisdair Meredith 2014-07-08 2014-07 N3969 Library  
N4120 Null Coalescing Conditional Operator Alexander Bock 2014-07-02 2014-07   Evolution