Blog Archive for / news /

ACCU 2013 and the C++ Standards Meeting

Monday, 06 May 2013

This year's ACCU conference was at a new venue: the Marriott hotel in Bristol. This is a bit closer to home for me than the previous venue in Oxford, which made the trip there and back more comfortable. As ever, the conference itself was enjoyable, educational and exhausting in equal measure.

This year was also BSI's turn to host the Spring ISO C++ committee meeting, which was conveniently arranged to be the week following ACCU, in the same hotel. Having not attended a meeting since the last time the committee met in the UK, I was glad to be able to attend this too.

ACCU 2013

As usual, with 5 tracks running simultaneously, it was hard to choose which sessions to attend. I stuck mostly to C++-centric, or general software development sessions, but there were also sessions on a wide range of other topics, including Ruby, Java, Scala, Git, C#, testing, management and culture, amongst others.

I was invited to contribute to Pete Goodliffe's Becoming a Better Programmer panel session, which was well attended and entertaining, as usual for Pete's sessions. My contribution on "doing things mindfully" seemed well-received, but wasn't the most popular — that honour went to Seb Rose, though Brian Marick called out Anna-Jayne Metcalfe's contribution on "If it ain't broke, do fix it" in the keynote the next morning.

My presentation on "C++11 in the Real World" was also well attended, with some good questions from the audience. A couple of people have asked me for my slides: they are available from the ACCU website.

ISO C++ committee meeting

This was a landmark meeting, for several reasons. Firstly, there were over 100 attendees, making it one of the most well-attended ISO C++ meetings ever. Secondly, this bumper attendee count was complemented by a bumper batch of proposals and position papers to process, which meant that all the working groups were pressed for time, and people met for extra sessions in the evenings to try and get through them all. Finally, the committee voted to publish a new "CD", starting the formal process leading to a C++14 standard.

The meeting was 6 days long, but I was only able to attend for the first 2 days. Unsurprisingly, I spent my time in the Concurrency group (SG1). We had a lot of papers to discuss, and some of the discussions were quite involved. Ultimately, not many papers were forwarded to the full committee, and only one paper other than the basic defect-report fixes was approved.

Lawrence Crowl's paper on Stream Mutexes (N3535) was first up. The problem this paper is trying to address is ensuring that data written to a stream from multiple threads appears in a coherent order — though concurrent writes to e.g. std::cout are guaranteed not to yield undefined behaviour, the output may be interleaved in an arbitrary fashion. This got quite a bit of discussion over the course of the week, and was eventually submitted as a much-modified paper for writing chunks to a stream in an atomic fashion, which was voted down in full committee.

Herb Sutter's late paper on the behaviour of the destructor of std::future (N3630) was up next. This is a highly conterversial topic, and yielded much discussion. The crux of the matter is that as currently specified the destructor of std::future blocks if it came from an invocation of std::async, the asynchronous function was run on a separate thread (with the std::launch::async policy), and that thread has not yet finished. This is highly desirable in many circumstances, but Herb argued that there are other circumstances where it is less desirable, and this makes it hard to use std::future in some types of program.

Much of the discussion focused on the potential for breaking existing code, and ways of preventing this. The proposal eventually morphed into a new paper (N3637) which created 2 new types of future: waiting_future and shared_waiting_future. std::async would then be changed to return a waiting_future instead of a future. Existing code that compiled unchanged would then keep the existing behaviour; code that changed behaviour would fail to compile. Though the change required to get the desired behaviour would not be extensive, the feeling in the full committee was that this breakage would be too extensive, and the paper was also voted down in full committee.

Herb's original paper also included a change to the destructor of std::thread, so that the destructor of a joinable thread would call join() rather than std::terminate(). This was put up for vote as N3636, but again was voted down in full committee.

Like I said, there were lots of other papers up for discussion. Some were concrete proposals, whilst others were less complete, asking for feedback on the approach. Only one paper was approved for the C++14 time frame — whilst there was considerable interest in the idea behind some of the others, there was disagreement about the details, and nothing else was deemed ready. I look forward to seeing the revised versions of some of these proposals when they are ready, especially the executors, continuations and parallel algorithms papers.

The paper that did get approved was Howard Hinnant's paper on shared locking (N3568), but even that didn't go through unchanged. I have serious concerns about the upgrade_mutex proposed in the original paper, and while I didn't manage to get my concerns across via email (this was discussed after I left), there was not enough interest in including it in C++14. The approved paper (N3659) therefore included only shared_mutex and shared_lock, not upgrade_mutex, which is good. N3659 was also approved by the vote in full committee, so will be part of C++14.

Wrap up

Having the conference and ISO meeting back-to-back was intense, but I thoroughly enjoyed attending both. C++14 looks set to be a significant improvement over C++11 — though the individual changes are minor, they offer quite a bit in terms of improved usability of the language and library. See the trip reports by Herb Sutter and Michael Wong (part 2, part 3) for more details on the accepted papers.

Posted by Anthony Williams
[/ news /] permanent link
Tags: , , ,

| Stumble It! stumbleupon logo | Submit to Reddit reddit logo | Submit to DZone dzone logo

Comment on this post

If you liked this post, why not subscribe to the RSS feed RSS feed or Follow me on Twitter? You can also subscribe to this blog by email using the form on the right.

just::thread Pro: Actors Edition released

Tuesday, 23 April 2013

I am pleased to announce that the first release of Just::Thread Pro is here. The Actors Edition provides a framework for creating actors that run on separate threads, and communicate via message passing, as well as jss::synchronized_value for synchronizing access to a single object and jss::concurrent_map, a hash map that is safe for concurrent access from multiple threads.

See the overview for more information, or read the full documentation.

Get your copy of Just::Thread Pro: Actors Edition

Purchase your copy and get started now.

Posted by Anthony Williams
[/ news /] permanent link
Tags: , , ,

| Stumble It! stumbleupon logo | Submit to Reddit reddit logo | Submit to DZone dzone logo

Comment on this post

If you liked this post, why not subscribe to the RSS feed RSS feed or Follow me on Twitter? You can also subscribe to this blog by email using the form on the right.

ACCU 2013

Saturday, 06 April 2013

I'm presenting on "C++11 features and real-world code" at ACCU 2013 in Bristol on this coming Thursday, 11th April. Here's the abstract:

C++11 has many nifty features, but how do they actually impact developers at the code face? Which C++11 features offer the best bang for the buck?

In this session I'll look at a selection of C++11 language and library features that I've found of real practical benefit in application and library code, with examples of equivalent C++03 code.

The features covered will include the concurrency support (of course), lambdas, and "auto", amongst a variety of others.

Hope to see you there!

Posted by Anthony Williams
[/ news /] permanent link
Tags:

| Stumble It! stumbleupon logo | Submit to Reddit reddit logo | Submit to DZone dzone logo

Comment on this post

If you liked this post, why not subscribe to the RSS feed RSS feed or Follow me on Twitter? You can also subscribe to this blog by email using the form on the right.

just::thread C++11 Thread Library V1.8.2 released

Tuesday, 06 November 2012

I am pleased to announce that version 1.8.2 of just::thread, our C++11 Thread Library has just been released.

This release adds support for gcc 4.7.2, and consequently official support for Ubuntu Quantal and Fedora 17.

just::thread is now available for the following compilers:

  • Microsoft Visual Studio 2005, 2008, 2010 and 2012 for both 32-bit and 64-bit Windows,
  • TDM gcc 4.5.2 and 4.6.1 for both 32-bit and 64-bit Windows,
  • g++ 4.3, 4.4, 4.5, 4.6 and 4.7 (4.7.2 or later) for both 32-bit and 64-bit Linux (x86/x86_64), and
  • MacPorts g++ 4.3, 4.4, 4.5, 4.6 and 4.7 (4.7.2 or later) for 32-bit and 64-bit MacOSX.

Get your copy of Just::Thread

Purchase your copy and get started with the C++11 thread library now.

As usual, existing customers are entitled to a free upgrade to V1.8.2 from all earlier versions.

Posted by Anthony Williams
[/ news /] permanent link
Tags: , , ,

| Stumble It! stumbleupon logo | Submit to Reddit reddit logo | Submit to DZone dzone logo

Comment on this post

If you liked this post, why not subscribe to the RSS feed RSS feed or Follow me on Twitter? You can also subscribe to this blog by email using the form on the right.

just::thread C++11 Thread Library V1.8.0 vs Microsoft Visual Studio 2012

Thursday, 06 September 2012

I am pleased to announce that version 1.8.0 of just::thread, our C++11 Thread Library has just been released.

This release adds official support for Microsoft Visual Studio 2012, as well as providing some minor bug fixes and improvements across the board.

Some people have asked how Just::Thread compares to the thread-library support in Microsoft Visual Studio 2012, given that VS2012 now provides the new C++11 concurrency headers, so I ran some of the Just::Thread tests against the VS2012 library. It turns out that there are quite a few places where Just::Thread has better conformance than VS2012, so if you're making heavy use of the C++11 thread library then upgrading to Just::Thread is an essential investment.

VS2012 thread library conformance issues

Here is a list of some of the areas where Just::Thread provides better conformance than VS2012. Some of these can be worked around; others are important for correctly-functioning code. This is just a sample, not a comprehensive list.

  • With the VS2012 library, you cannot use move-only types with std::promise, and std::async doesn't work with functions that return move-only types.
  • With the VS2012 library, std::thread doesn't work with move-only argument types.
  • With the VS2012 library, the wait_for and wait_until functions return incorrect values when used with a std::future that comes from a std::promise.
  • With the VS2012 library, when std::async is used with a launch policy of std::launch::async, the destructor of the returned std::future instance does not wait for the thread to complete.
  • With the VS2012 library, std::unique_lock does not check whether or not it owns the lock before calling operations on the underlying mutex, triggering undefined behaviour rather than throwing an exception in many cases.
  • With the VS2012 library, the std::atomic<> class template cannot be used on types without a default constructor.
  • With the VS2012 library, std::launch and other strongly-typed enums such as std::future_status are emulated with a namespace-scoped enum rather than a strongly-typed enum.

In all these cases (and more), Just::Thread conforms with the standard.

Just::Thread optimizations

Just::Thread also offers various optimizations over the VS2012 thread library such as the following.

  • The return value from a task run with std::async is copied/moved fewer times, and moved where possible.
  • A function object passed to std::thread is copied or moved fewer times.
  • The task passed to std::async is destroyed as soon as the task is completed, even if there are outstanding futures that reference the result.

Again, this is not a comprehensive list. Just::Thread has been carefully optimized to ensure common use cases have the best performance possible whilst remaining conformant to the C++11 standard.

Get your copy of Just::Thread

Purchase your copy and get started with the C++11 thread library now.

As usual, existing customers are entitled to a free upgrade to V1.8.0 from all earlier versions.

Posted by Anthony Williams
[/ news /] permanent link
Tags: , , ,

| Stumble It! stumbleupon logo | Submit to Reddit reddit logo | Submit to DZone dzone logo

Comment on this post

If you liked this post, why not subscribe to the RSS feed RSS feed or Follow me on Twitter? You can also subscribe to this blog by email using the form on the right.

ACCU 2012 Report

Thursday, 03 May 2012

I'm now back home again from ACCU 2012. As ever, it was an exhausting, but thoroughly enjoyable conference. With 5 tracks it was sometimes very hard to choose which session to attend.

There were a surprising number of talks on C, though mostly just to confirm that C is a dying language, a "zombie language" as Uncle Bob put it, even if there is still a niche or two where it is the best fit.

There was also a fair number of sessions on testing, especially TDD (even TDD in C), and a few sessions on other agile practices.

However, the big topic of the conference was C++11. Nicolai Josuttis ran a full day pre-conference tutorial on the C++11 library, and then there were sessions on the best and worst features of the C++11 library, C++11 for everybody, C++11 for the rest of us, C++11 allocators, writing generic code with C++11, the C++11 concurrency facilities, an interactive C++11 programming session, and even a C++11 pub quiz (with free beer!)

The other big topic was concurrency and parallelism, with 6 presentations, including two by me. Actors and Dataflow seemed to be a common theme — it looks like these ideas are finally filtering into the mainstream now that everyone and his dog has a multicore computer in their pocket. Not only did Russel, Jason and I reference them in our presentations, but several of the developers I spoke to had implemented their own actor or dataflow libraries, or were interested in using one.

My presentations

My own presentations went well. My first one (on Dataflow, Actors and High Level Structures in Concurrent Applications, on Thursday afternoon) was packed out. There were quite a few interesting questions from the audience, and someone told me it was the best presentation at the conference, which was really nice to hear. Several people asked about slides and the code samples, and I promised to make them available. The slides are here and the code samples here

My second presentation was the C++11 concurrency tutorial on Saturday morning. I was presenting in the first slot after the keynotes, and the speakers dinner was the night before, so a lot of people had been looking rather the worse for wear in the beginning. However, the room was almost full again, and the audience seemed to be awake — yet again there were many interesting questions that showed people were paying attention. The slides for are here and the code samples here

My book

My book was only published a couple of months before the conference, so it was exciting to see so many people clutching copies. Apparently the Blackwell's stall sold out, which was nice for me, but unfortunate for those that didn't manage to get a copy. If you wanted a copy then you can buy it direct from Manning, or from amazon.com, or amazon.co.uk.

Posted by Anthony Williams
[/ news /] permanent link
Tags: , , ,

| Stumble It! stumbleupon logo | Submit to Reddit reddit logo | Submit to DZone dzone logo

Comment on this post

If you liked this post, why not subscribe to the RSS feed RSS feed or Follow me on Twitter? You can also subscribe to this blog by email using the form on the right.

ACCU 2012

Wednesday, 25 April 2012

The main sessions of the ACCU 2012 conference start today.

This year I'm presenting two sessions. The first is tomorrow, at 4pm: Dataflow, actors, and high level structures in concurrent applications. In this session, I'll be talking about high level approaches for writing concurrent architectures including actors and dataflow architectures, and giving example code in multiple languages, including C++ and Groovy.

My second session is on Saturday at 11am, C++11 concurrency tutorial. This session will cover how to use the new C++11 thread library, as well as various guidelines for avoiding race conditions and deadlocks.

Hope to see you there!

Posted by Anthony Williams
[/ news /] permanent link
Tags:

| Stumble It! stumbleupon logo | Submit to Reddit reddit logo | Submit to DZone dzone logo

Comment on this post

If you liked this post, why not subscribe to the RSS feed RSS feed or Follow me on Twitter? You can also subscribe to this blog by email using the form on the right.

Happy New Year 2012

Tuesday, 10 January 2012

Now the post-holidays rush is over, I'd like to wish you all a Happy New Year!

2011 was another good year for me. Sales of Just::Thread, my implementation of the C++11 thread library continue to grow, and my book is finally in typesetting, and nearly ready for printing. We had hoped to get it done by the end of 2011, but last-minute corrections scuppered that. It should now be done relatively quickly.

It's also been a big year for the C++ community: C++11 is now an official ISO standard. This is the culmination of many years of hard work from a huge number of people, so it's good to see it finally done.

Popular articles

As is my custom, here's a list of the 10 most popular articles and blog entries from the Just Software Solutions website in 2011.

  1. Implementing a Thread-Safe Queue using Condition Variables
    A description of the issues around writing a thread-safe queue, with code.
  2. Implementing drop-down menus in pure CSS (no JavaScript)
    How to implement drop-down menus in CSS in a cross-browser fashion (with a teensy bit of JavaScript for IE).
  3. Importing an Existing Windows XP Installation into VirtualBox
    This article describes how I recovered the hard disk of a dead laptop to run as a VM under VirtualBox.
  4. Multithreading in C++0x part 1: Starting Threads
    This is the first part of my series on the new C++11 thread library. Links to the remaining parts are at the end of the article.
  5. Thread-Safe Copy and Move Constructors
    This is a guest post by Michael Spertus on writing copy and move constructors for objects with internal locks.
  6. Multithreading in C++0x part 2: Starting Threads with Function Objects and Arguments
    This is the second part of my series on the new C++11 thread library, which covers using callable objects when starting threads, and passing arguments to the thread function.
  7. Introduction to C++ Templates
    My basic introduction to C++ templates.
  8. Multithreading in C++0x part 8: Futures, Promises and Asynchronous Function Calls
    This is the eighth part of my series on the new C++11 thread library, which covers the "futures" mechanism for passing data between threads.
  9. Thread Interruption in the Boost Thread Library
    A description of the thread interruption feature of the Boost Thread library.
  10. Deadlock Detection with just::thread
    This article describes how to use the special deadlock-detection mode of our just::thread C++11 thread library to locate the cause of deadlocks.

What's coming in 2012?

Will 2012 be even better than 2011? I hope so. As I already mentioned, my book will finally be printed, which will be a big relief for me.

What are you looking forward to in 2011?

Posted by Anthony Williams
[/ news /] permanent link
Tags: ,

| Stumble It! stumbleupon logo | Submit to Reddit reddit logo | Submit to DZone dzone logo

Comment on this post

If you liked this post, why not subscribe to the RSS feed RSS feed or Follow me on Twitter? You can also subscribe to this blog by email using the form on the right.

just::thread C++0x Thread Library V1.7.0 Released

Wednesday, 05 October 2011

I am pleased to announce that version 1.7.0 of just::thread, our C++0x Thread Library has just been released.

This release adds official support for gcc v4.4 on Centos 6, so Just::Thread is now supported on Centos, Fedora, Ubuntu and Debian Linux distributions, as well as Microsoft Windows and Apple MacOSX.

The main change with this release is an enhancement to the std::async implementation. With this enhanced scheduler, the default launch policy (std::launch::async | std::launch::deferred) will defer forcing a decision until either enough resources become available to schedule the task as std::launch::async, or the task is forced to be scheduled as std::launch:deferred by a call to a waiting function (get(), wait(), wait_for() or wait_until()). This will allow more tasks to be scheduled as std::launch::async overall, and allow your application to make better use of the available hardware concurrency.

The implementation of recursive mutexes has been overhauled, leading to much faster lock and unlock times than in previous releases.

This release also provides debugger visualizers for Microsoft Visual Studio, to better show the state of Just::Thread objects such as futures. This will provide greater insight into the state of your program, and allow easier debugging.

Purchase your copy and get started with the C++0x thread library now.

As usual, existing customers are entitled to a free upgrade to V1.7.0 from all earlier versions.

Posted by Anthony Williams
[/ news /] permanent link
Tags: , ,

| Stumble It! stumbleupon logo | Submit to Reddit reddit logo | Submit to DZone dzone logo

Comment on this post

If you liked this post, why not subscribe to the RSS feed RSS feed or Follow me on Twitter? You can also subscribe to this blog by email using the form on the right.

Just::Thread now supports GCC on Windows and MacOSX

Tuesday, 14 June 2011

I am pleased to announce that support for the TDM port of gcc 4.5.2 for Windows and the MacPorts builds of gcc 4.3, 4.4 and 4.5 have now been added to just::thread.

This release thus greatly improves the portability of the library. You can now write code using just::thread that will work across Windows, Linux and MacOSX. With gcc 4.5 support across all 3 platforms, you can take advantage of the extensive C++0x language support from that compiler too, including lambda functions, rvalue references and variadic templates.

Get your copy now and add portability to your multithreaded programs.

Posted by Anthony Williams
[/ news /] permanent link
Tags: , , , , ,

| Stumble It! stumbleupon logo | Submit to Reddit reddit logo | Submit to DZone dzone logo

Comment on this post

If you liked this post, why not subscribe to the RSS feed RSS feed or Follow me on Twitter? You can also subscribe to this blog by email using the form on the right.

Older entries