Comment by MeetingsBrowser
9 hours ago
An ML is great for the theory or abstraction side of programming, but C is also hands down the best language to get a sense of how the computer is running your program.
It’s still an abstraction, but at least being aware of memory management, copying vs referencing, etc are hugely important concepts that ML languages can hide.
> but C is also hands down the best language to get a sense of how the computer is running your program.
C is in an odd position right now to argue it is how the machine is really working. Computers are more complicated since bigger caches entered the picture. Hell I do not think even ASM is a good approximation on how machine really work given the data dependencies will make stuff being processed in parallel instead of sequentially.
What you could argue is that C is the archetype for an imperative language procedural language with a clean mapping to ASM. That is different than how the machine works. Simpler architecture have less distance between their ASM and what is really hapenning.
> It’s still an abstraction
C is still heavily abstracted. Modern OS evolved in conjunction with C s.t. it behaves like a C runtime simulating a PDP11 (I remember reading a nice article on that). To learn system, what you need is an OS course, not C. I'd say the current C-based stack is in a quite embarrassing state.
For someone just starting to learn CS, it should not matter whether they're on PDP-11 or x64 or ARM. You can't start teaching with pipelining and speculative branch execution. So C is good choice because there is a simple CPU architecture that it maps to well.
I think this PDP-11 meme is quite misleading. There is nothing really in the C programming model specific to the PDP-11 and C was used on systems much weirder than a PDP-11. C is also very successfully the basis of many parallel programs running on multi-processor systems with a memory model in the standard that was created much later than the PDP-11.
Also somehow the implied argument that computing hardware and operating systems simulate a PDP-11 for the sake of C is completely backwards. Historically, there were other approaches, e.g. processors designed for object-oriented programming or actors etc.. All those were not very successful.
It's clear that the authors were either inspired by the PDP-11 ISA and/or designed the language to make porting UNIX from PDP-11 Assm to it easier.
UNIX for PDP-7 in Assm -> UNIX for PDP-11 in Assm -> UNIX for PDP-11 in C
https://news.ycombinator.com/item?id=43245166
Sure, you need an OS course, but that's when students should learn C as well.
Probably thinking of this article: "C Is Not a Low-level Language: Your computer is not a fast PDP-11."
https://queue.acm.org/doi/10.1145/3212477.3212479