|
|
Log in / Subscribe / Register

The 5.7 kernel is out

The 5.7 kernel is out

Posted Jun 2, 2020 8:21 UTC (Tue) by Wol (subscriber, #4433)
In reply to: The 5.7 kernel is out by quotemstr
Parent article: The 5.7 kernel is out

And how much - even kernel code - is code-reviewed? And of those reviewers, how many have the *experience* to know what is good or bad?

You only need some badly written and poorly written driver to start evicting L1 cache and the whole system suffers.

I think it's a case of "C: if it looks efficient it probably is. C++: If it looks efficient, who knows what the hell is going on behind the scenes ..."

Now if you apply C++ discipline to C code that's a whole 'nother ball game!

My expertise is databases. And I like Pick because there is a consistent model right through from hardware to application (at least, there is if the programmer knows what they're doing! :-) Just like C, there's plenty of rope to hang yourself.

Relational - C&D to be precise - is a whole pile of poo. Firstly, there's the logical inconsistency within the rules themselves. Then there's the model second-guessing you to try and protect you from yourself. Then there's the implementation - severely hamstrung by the model itself if it tries to implement it faithfully. Pascal, SQL, C++, ... great for novices, and quite good languages, but expensive in wasted computer power as it tries to protect you from yourself.

Cheers,
Wol


to post comments

The 5.7 kernel is out

Posted Jun 2, 2020 12:21 UTC (Tue) by adobriyan (guest, #30858) [Link]

Inefficiency of the language can be trivially demonstrated by absence of multiple return values.

Given

int f(const char *str, int *val);

int val;
int rv = f(str, &val);
if (rv < 0)
return rv;
[use "val"]

C ABI and single return value forces to allocate data on a stack and a write.
Now top of stack is optimized so it doesn't matter for performance, but the act of writing to [rsp+] has second order effects.
Stack protector sees that function modifies memory and starts placing canaries, bloating code and issuing reads and adding
mandatory branch for stack smashing.

Could this be solved in C? Yes, by using 2-value structure which fully fits into 2x8-byte registers.
C ABI even has provision for this by referring to RDX as a second return value.
Which of course nobody uses because there is no syntax for destructuring.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds