3 ms·
> Ok, but even with C we can't actually low level manage memory how the processor does it. You can't tell the processor what to keep or not on what level of cac
by ilyt 3y ago
> Ok, but even with C we can't actually low level manage memory how the processor does it. You can't tell the processor what to keep or not on what level of cache, what to send to virtual memory, etc.
neither can assembler so it is useless distinction
- CJefferson 3y agoThere are CPU instructions to pull memory into cache, send cache back to main memory, and Mark things in cache as not worth writing out to memory. All hard to use from C, the last type basically impossible.
- monocasa 3y ago> pull memory into cache, send cache back to main memory I haven't had much of an issue with intrinsics. > Mark things in cache as not worth writing out to memory Can you give an example of this in a surviving architecture?
- oasisaimlessly 3y agoDoes ARM64 count? DC CIVAC: https://developer.arm.com/documentation/ddi0595/2021-12/AArch64-Instructions/DC-CIVAC--Data-or-unified-Cache-line-Clean-and-Invalidate-by-VA-to-PoC https://developer.arm.com/documentation/ddi0595/2021-12/AArc...
- monocasa 3y agoThat isn't really marking cache items as not being worth writing out to memory. It's a feature for communicating with non coherent devices to tell the cache that any lines it might have speculatively loaded might have changed out from under it. "Not being worth" reads like cache perf management, as opposed to uses of DC CIVAC, which are strict correctness issues.
- bjourne 3y agoIntrinsics are not part of C though. C is the abstract machine defined in various specs and its syntax and semantics.
- xscott 3y agoAny of those instructions could be wrapped in a C function or intrinsic if they were valuable enough
- nuancebydefault 3y agoWrapping other languages does not count when describing the hight-of-level of a language. In almost any language you can embed machine code, even in spoken languages. It would be like 'English is not easier than Chinese, since I can quote a Chinese sentence in English.'
- jowea 3y agoThere's a bit of a difference in that C has ways to closely integrate assembly as needed. Most languages don't.
- pjmlp 3y agoThey aren't part of C, they are compiler specific extensions. Any language can have compiler specific extensions. Playing fair game, all non toy languages can load modules written in Assembly. In fact that was the only way in K&R C, compiler extensions came later.
- quatrevingts 3y agoAs the article notes, that's because CPUs are designed to run existing C code fast. You could create an instruction set that provided this control, but it might be a tough sell in a world full of C code.