3 ms·
My observation is that quite a lot of folks know all about computer science, they might well know how operating systems work, but are clueless as to what happen
by MichaelCrawford 12y ago
My observation is that quite a lot of folks know all about computer science, they might well know how operating systems work, but are clueless as to what happens when they combine the two.
Consider that with certain exceptions, QuickSort is widely regarded as the very best way to sort.
What happens when you sort a memory buffer on a Mac OS X box? Well that depends on a whole lot of things. How big is the buffer? If it's really large, you will cause paging no matter what you do to avoid it.
However there are all kinds of things you can do to keep that paging to a minimum. Not only does that make your code faster, it saves on electrical power and reduces the heat produced by the box.
That kind of thing is the main focus of my work these days - how to make existing code work better on modern computers.
Have a look through the source of, say, glibc, while keeping in mind what code and data memory caches do, paging, context switching with other programs and so on.
I expect that glibc would work really well on a box with no cache at all, and enough memory that it never has to page, and with only one executable running at any one time.
But that no longer applies.
Unfortunately I've never even heard of a school where they teach that kind of stuff.
Many of my colleagues regard me as delusional for asserting that one can save energy by refactoring one's source code, yet they don't seem to clue in to the fact that a computer needs to have a battery or a power cord.