[TUHS] PDP-11 legacy, C, and modern architectTures

Theodore Y. Ts'o tytso at mit.edu
Wed Jun 27 12:18:43 AEST 2018

One of the things which is probably causing a lot of hang ups is the
phrase "low-level language".  What is exactly meant by that?  The
article actually uses multiple definitions of "low-level language",
and switches between them when it is convenient, or as a rhetorical

There is at least one of his points that I very much agree with, which
is the abstract model which is exported by the C programming paradigm
is very different from what totality of what the CPU can do.  Consider
the oft-made admonition that most humans can't program in assembler
more efficiently than the compiler.  Think about that for a moment.
That saying is essentially telling us that the compiler is capable of
doing a lot of things behinds our back (which goes against the common
understanding of what low-level language does), and second, that
modern CPU's has gotten too complicated for most humans to be able to
program directly, either comfortably or practically.

Also, all of these compiler optimizations are not _mandatory_.  They
are there because people really want performance.  You are free to
disable them if you care about predictability and avoiding the "any
sufficiently advanced compiler is indistinguishable from a malicious
adversary" dynamic.  In fact, if are writing a program where you are,
more often than not, I/O bound and/or fundamentally bound by memory
bandwidth, turning off a lot of these compiler optimizations might be
the right thing to do, as they may not buy you much, and given you
much in the way of headaches.  There is a reason why the Linux kernel
compiles with the GCC flags:

	-fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks \
	-fstack-protector-strong -fno-var-tracking-assignments \
	-femit-struct-debug-baseonly -fno-var-tracking \
	-fno-inline-functions-called-once -fno-strict-overflow \
	-fno-merge-all-constants -fmerge-constants -fno-stack-check

By the way, I disagree with Chisnall's assertion that low-level
languages are fast.  If you believe that compilers can often do a
better job than humansh writing assembly, does that mean that since
assembly code isn't fast that it's not a low-level language?)  And the
performance wars is an important part of dynamic --- at the end of the
day, the vast majority of people choose performance as the most
important driver of their purchasing decision.  They may pay lip
service to other things, including security, robustness, etc., but if
you take a look at what they actually _do_, far more often than not,
they choose fast over slow.

I see this an awful lot in file system design.  People *talk* a great
game about how they care about atomicity, and durability, etc., but
when you look at their actual behavior as opposed to expressed
desires, more often than not what they choose is again, fast over 
slow.  And so I have an extension to the fictional dialog to Pillai's
presentation for his 2014 OSDI paper:

Experienced Academic: Real file systems don't do that.

   But <...> does just that.

Academic: My students would flunk class if they built a file system that way.

Cynical Industry Developer's rejoinder: A file system designed the way
   you propose would likely be a commercial failure, and if it was the
   only/default FS for an OS, would probably drag the OS down to
   failure with it.

And this goes to Spectre, Meltdown, TLBleed, and so on.  Intel built
processors this way because the market _demanded_ it.  It's for the
same reason that Ford Motor Company built gas-guzzling pickup trucks.
Whether or not Maimi Beach will end up drowning under rising sea
levels never entered into the the consumer or the manufacturer's
consideration, at least not in any real way.

It's very easy to criticize Intel for engineering their CPU's the way
they did, but if you want to know who to blame for massively high
ILP's and caching, and compilers that do all sorts of re-ordering and
loop rewriting behind the developer's back, just look in the mirror.
It's the same as why we have climate change and sea level rise.

"We have met the enemy and he is us". -- Pogo (Walt Kelly)

						- Ted

More information about the TUHS mailing list