Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.arch.embedded > #27158
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Newsgroups | comp.arch.embedded |
| Subject | Re: Engineering degree for embedded systems |
| Date | 2017-08-08 12:56 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <omc55c$fi2$1@dont-email.me> (permalink) |
| References | (9 earlier) <5C1iB.390268$gM6.248510@fx03.am4> <ombs5g$iva$1@dont-email.me> <PTeiB.707621$HS1.256337@fx12.am4> <ombvsd$ui3$1@dont-email.me> <b5giB.179066$W97.95506@fx36.am4> |
On 08/08/17 12:09, Tom Gardner wrote: > On 08/08/17 10:26, David Brown wrote: >> On 08/08/17 10:46, Tom Gardner wrote: >>> On 08/08/17 09:23, David Brown wrote: >>>> On 07/08/17 19:40, Tom Gardner wrote: >>>>> On 07/08/17 17:36, Phil Hobbs wrote: >>>> >>>>>> My stuff is all pthreads, because std::thread didn't exist at the >>>>>> time, >>>>>> but it does now, so presumably Boehm's input has been taken into >>>>>> account. >>>>> >>>>> I'm told C/C++12 /finally/ has a memory model, so perhaps >>>>> that will (a few decades too late) ameliorate the problem. >>>>> We'll see, but I'm not holding my breath. >>>> >>>> You mean C11/C++11 ? >>> >>> Oh.... picky picky picky :) >> >> Well, if you decide to look this up on google, it should save you a bit >> of false starts. > > Unfortunately google doesn't prevent idiots from making > tyupos :) (Or is that fortunately?) > >>>> Whether people will use them >>>> appropriately or not, is another matter. >>> >>> My experience is that they won't. That's for two reasons: >>> 1) not really understanding threading/synchronisation >>> issues, because they are only touched upon in schools. >>> Obviously that problem is language agnostic. >> >> Agreed. This stuff is hard to understand if you want to get correct >> /and/ optimally efficient. >> >>> 2) any subtleties in the C/C++ specification and >>> implementation "suboptimalities"; I expect those will >>> exist :( >> >> I have read through the specs and implementation information - quite a >> bit of work has gone into making it possible to write safe code that is >> more efficient than was previously possible (or at least practical). It >> is not so relevant for small embedded systems, where you generally have >> a single core and little in the way of write buffers - there is not >> much, if anything, to be gained by replacing blunt full memory barriers >> with tuned load-acquire and store-release operations. But for bigger >> systems with multiple cpus, a full barrier can cost hundreds of cycles. > > Agreed, with the caveat that "small" ain't what it used to be. > Consider Zynqs: dual-core ARMs with caches and, obviously, FPGA > fabric. True. I'd be happy to see people continue to use full memory barriers - they may not be speed optimal, but they will lead to correct code. Let those who understand the more advanced synchronisation stuff use acquire-release. And of course a key point is for people to use RTOS features when they can - again, using a mutex or semaphore might not be as efficient as a fancy lock-free algorithm, but it is better to be safe than fast. > Consider single 32 core MCUs for £25 one-off. (xCORE) The xCORE is a bit different, as is the language you use and the style of the code. Message passing is a very neat way to swap data between threads or cores, and is inherently safer than shared memory. > There are many other examples, and that trend will continue. > Yes. > >> There is one "suboptimality" - the "consume" memory order. It's a bit >> weird, in that it is mainly relevant to the Alpha architecture, whose >> memory model is so weak that in "x = *p;" it can fetch the contents of >> *p before seeing the latest update of p. Because the C11 and C++11 >> specs are not clear enough on "consume", all implementations (AFAIK) >> bump this up to the stronger "acquire", which may be slightly slower on >> some architectures. > > One of C/C++'s problems is deciding to cater for, um, > weird and obsolete architectures. I see /why/ they do > that, but on Mondays Wednesdays and Fridays I'd prefer > a concentration on doing common architectures simply > and well. > In general, I agree. In this particular case, the Alpha is basically obsolete - but it is certainly possible that future cpu designs would have equally weak memory models. Such a weak model is easier to make faster in hardware - you need less synchronisation, cache snooping, and other such details. > > >>> ISTR that in the early-mid naughties there was a triumphant >>> announcement of the first /complete/ C or C++ compiler - 5 >>> or 6 years after the standard was published! Of course many >>> compilers had implemented a usable subset before that. >>> >> >> Things have changed a good deal since then. The major C++ compilers >> (gcc, clang, MSVC) have complete C++11 and C++14 support, with gcc and >> clang basically complete on the C++17 final drafts. gcc has "concepts", >> slated for C++20 pretty much "as is", and MSVC and clang have prototype >> "modules" which are also expected for C++20 (probably based on MSVC's >> slightly better version). >> >> <http://en.cppreference.com/w/cpp/compiler_support> >> >> These days a feature does not make it into the C or C++ standards unless >> there is a working implementation in at least one major toolchain to >> test it out in practice. > > Yes, but I presume that was also the case in the naughties. No, not to the same extent. Things move faster now, especially in the C++ world. C++ is on a three year update cycle now. The first ISO standard was C++98, with C++03 being a minor update 5 years later. It took until C++11 to get a real new version (with massive changes) - and now we are getting real, significant improvements every 3 years. > (I gave up following the detailed C/C++ shenanigans during the > interminable "cast away constness" philosophical discussions) > > The point was about the first compiler that (belatedly) > correctly implemented /all/ the features. > > >>>> And people got some things right, and some things wrong, at that time. >>>> I think the same thing will apply now that they /have/ memory models. >>> >>> Agreed. >>> >>> I'm gobsmacked that it took C/C++ so long to get around to >>> that /fundamental/ requirement. The absence and the delay >>> reflects very badly on the C/C++ community. >> >> As I said, people managed fine without it. Putting together a memory >> model that the C folks and C++ folks could agree on for all the >> platforms they support is not a trivial effort - and I am very glad they >> agreed here. Of course I agree that it would have been nice to have had >> it earlier. The thread support (as distinct from the atomic support, >> including memory models) is far too little, far too late and I doubt if >> it will have much use. > > While there is no doubt people /thought/ they managed, > it is less clear cut that it was "fine". > > I'm disappointed that thread support might not be as > useful as desired, but memory model and atomic is more > important. The trouble with thread support in C11/C++11 is that it is limited to very simple features - mutexes, condition variables and simple threads. But real-world use needs priorities, semaphores, queues, timers, and many other features. Once you are using RTOS-specific API's for all these, you would use the RTOS API's for thread and mutexes as well rather than <thread.h> calls.
Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Engineering degree for embedded systems "hogwarts" <122707@EmbeddedRelated> - 2017-07-27 07:35 -0500
Re: Engineering degree for embedded systems Stef <stef33d@yahooI-N-V-A-L-I-D.com.invalid> - 2017-07-27 15:25 +0200
Re: Engineering degree for embedded systems Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-07-30 12:05 -0400
Re: Engineering degree for embedded systems Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-07-30 19:05 +0100
Re: Engineering degree for embedded systems Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-08-01 08:55 -0400
Re: Engineering degree for embedded systems Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-08-01 14:23 +0100
Re: Engineering degree for embedded systems Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-08-03 11:03 -0400
Re: Engineering degree for embedded systems Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-08-06 10:35 +0100
Re: Engineering degree for embedded systems John Devereux <john@devereux.me.uk> - 2017-08-06 14:40 +0100
Re: Engineering degree for embedded systems rickman <gnuarm@gmail.com> - 2017-08-06 12:51 -0400
Re: Engineering degree for embedded systems Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-08-06 20:13 +0100
Re: Engineering degree for embedded systems rickman <gnuarm@gmail.com> - 2017-08-06 19:21 -0400
Re: Engineering degree for embedded systems Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-08-07 12:40 -0400
Re: Engineering degree for embedded systems rickman <gnuarm@gmail.com> - 2017-08-07 15:18 -0400
Re: Engineering degree for embedded systems Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-08-07 15:27 -0400
Re: Engineering degree for embedded systems rickman <gnuarm@gmail.com> - 2017-08-07 16:47 -0400
Re: Engineering degree for embedded systems Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-08-07 17:30 -0400
Re: Engineering degree for embedded systems rickman <gnuarm@gmail.com> - 2017-08-07 18:35 -0400
Re: Engineering degree for embedded systems Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-08-07 18:56 -0400
Re: Engineering degree for embedded systems rickman <gnuarm@gmail.com> - 2017-08-07 19:02 -0400
Re: Engineering degree for embedded systems Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-08-07 19:08 -0400
Re: Engineering degree for embedded systems Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2017-08-08 01:30 +0200
Re: Engineering degree for embedded systems Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-08-07 19:32 -0400
Re: Engineering degree for embedded systems rickman <gnuarm@gmail.com> - 2017-08-07 19:53 -0400
Re: Engineering degree for embedded systems Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-08-07 20:02 -0400
Re: Engineering degree for embedded systems stephen@mpeforth.com (Stephen Pelc) - 2017-08-07 23:49 +0000
Re: Engineering degree for embedded systems Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-08-07 20:07 -0400
Re: Engineering degree for embedded systems Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-08-08 08:00 +0100
Re: Engineering degree for embedded systems George Neuner <gneuner2@comcast.net> - 2017-08-07 01:21 -0400
Re: Engineering degree for embedded systems upsidedown@downunder.com - 2017-08-06 17:15 +0300
Re: Engineering degree for embedded systems Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-08-06 20:21 +0100
Re: Engineering degree for embedded systems upsidedown@downunder.com - 2017-08-07 10:35 +0300
Re: Engineering degree for embedded systems David Brown <david.brown@hesbynett.no> - 2017-08-07 12:54 +0200
Re: Engineering degree for embedded systems David Brown <david.brown@hesbynett.no> - 2017-08-07 12:34 +0200
Re: Engineering degree for embedded systems Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-08-07 12:43 -0400
Re: Engineering degree for embedded systems rickman <gnuarm@gmail.com> - 2017-08-06 12:50 -0400
Re: Engineering degree for embedded systems Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-08-07 12:36 -0400
Re: Engineering degree for embedded systems Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-08-07 18:40 +0100
Re: Engineering degree for embedded systems David Brown <david.brown@hesbynett.no> - 2017-08-08 10:23 +0200
Re: Engineering degree for embedded systems Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-08-08 09:46 +0100
Re: Engineering degree for embedded systems David Brown <david.brown@hesbynett.no> - 2017-08-08 11:26 +0200
Re: Engineering degree for embedded systems Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-08-08 11:09 +0100
Re: Engineering degree for embedded systems David Brown <david.brown@hesbynett.no> - 2017-08-08 12:56 +0200
Re: Engineering degree for embedded systems Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-08-08 15:56 +0100
Re: Engineering degree for embedded systems David Brown <david.brown@hesbynett.no> - 2017-08-08 17:11 +0200
Re: Engineering degree for embedded systems Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-08-08 16:33 +0100
Re: Engineering degree for embedded systems upsidedown@downunder.com - 2017-08-08 21:07 +0300
Re: Engineering degree for embedded systems David Brown <david.brown@hesbynett.no> - 2017-08-09 10:03 +0200
Re: Engineering degree for embedded systems upsidedown@downunder.com - 2017-08-10 14:30 +0300
Re: Engineering degree for embedded systems David Brown <david.brown@hesbynett.no> - 2017-08-10 15:11 +0200
Re: Engineering degree for embedded systems Walter Banks <walter@bytecraft.com> - 2017-08-16 18:39 -0400
Re: Engineering degree for embedded systems David Brown <david.brown@hesbynett.no> - 2017-08-17 09:37 +0200
Re: Engineering degree for embedded systems Walter Banks <walter@bytecraft.com> - 2017-08-17 08:24 -0400
Re: Engineering degree for embedded systems David Brown <david.brown@hesbynett.no> - 2017-08-17 16:06 +0200
Re: Engineering degree for embedded systems Walter Banks <walter@bytecraft.com> - 2017-08-17 12:15 -0400
Re: Engineering degree for embedded systems David Brown <david.brown@hesbynett.no> - 2017-08-18 14:45 +0200
Re: Engineering degree for embedded systems Walter Banks <walter@bytecraft.com> - 2017-08-25 09:51 -0400
Re: Engineering degree for embedded systems Les Cargill <lcargill99@comcast.com> - 2017-08-01 20:46 -0500
Re: Engineering degree for embedded systems David Brown <david.brown@hesbynett.no> - 2017-08-02 09:30 +0200
Re: Engineering degree for embedded systems Les Cargill <lcargill99@comcast.com> - 2017-08-05 15:11 -0500
Re: Engineering degree for embedded systems Paul Rubin <no.email@nospam.invalid> - 2017-08-08 00:22 -0700
Re: Engineering degree for embedded systems Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-08-08 08:36 +0100
Re: Engineering degree for embedded systems David Brown <david.brown@hesbynett.no> - 2017-08-08 12:37 +0200
Re: Engineering degree for embedded systems "tim..." <tims_new_home@yahoo.com> - 2017-07-27 17:46 +0100
Re: Engineering degree for embedded systems Grant Edwards <invalid@invalid.invalid> - 2017-07-27 16:54 +0000
Re: Engineering degree for embedded systems "tim..." <tims_new_home@yahoo.com> - 2017-07-27 19:57 +0100
Re: Engineering degree for embedded systems Frank Miles <fpm@u.washington.edu> - 2017-07-27 16:58 +0000
Re: Engineering degree for embedded systems Theo Markettos <theom+news@chiark.greenend.org.uk> - 2017-07-28 00:43 +0100
Re: Engineering degree for embedded systems jim.brakefield@ieee.org - 2017-07-30 15:26 -0700
Re: Engineering degree for embedded systems Chris <xxx.syseng.yyy@gfsys.co.uk> - 2017-07-27 23:45 +0000
Re: Engineering degree for embedded systems Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2017-08-03 19:50 +0200
Re: Engineering degree for embedded systems Les Cargill <lcargill99@comcast.com> - 2017-08-05 15:20 -0500
Re: Engineering degree for embedded systems upsidedown@downunder.com - 2017-08-06 09:17 +0300
Re: Engineering degree for embedded systems "tim..." <tims_new_home@yahoo.com> - 2017-08-06 10:12 +0100
Re: Engineering degree for embedded systems upsidedown@downunder.com - 2017-08-06 13:19 +0300
Re: Engineering degree for embedded systems Les Cargill <lcargill99@comcast.com> - 2017-08-06 09:59 -0500
Re: Engineering degree for embedded systems "tim..." <tims_new_home@yahoo.com> - 2017-08-06 18:06 +0100
Re: Engineering degree for embedded systems rickman <gnuarm@gmail.com> - 2017-08-06 21:31 -0400
Re: Engineering degree for embedded systems "tim..." <tims_new_home@yahoo.com> - 2017-08-07 09:32 +0100
Re: Engineering degree for embedded systems Les Cargill <lcargill99@comcast.com> - 2017-08-06 09:53 -0500
Re: Engineering degree for embedded systems upsidedown@downunder.com - 2017-08-07 10:59 +0300
Re: Engineering degree for embedded systems Les Cargill <lcargill99@comcast.com> - 2017-08-07 20:09 -0500
Re: Engineering degree for embedded systems upsidedown@downunder.com - 2017-08-08 21:31 +0300
Re: Engineering degree for embedded systems Stef <stef33d@yahooI-N-V-A-L-I-D.com.invalid> - 2017-08-21 11:28 +0200
csiph-web