Patchouli's Computatrunomicon

Search IconIcon to open search

abstraction

Last updated May 31, 2022.

# Metadata

2022-05-27 03:12

overview of the layers of abstraction

# Content

“thousands of layers” might be a bit of an exaggeration. But that does raise an interesting question. How many layers are there? Here’s a (very) rough draft. I skip over a lot of complexity and options for simplicity - to make the point and to keep this reasonably readable. I may also have missed a layer or two (edit or more - see the replies for lots of great details!) - this is off the top of my head and it’s been a long day. Still, enjoy, and maybe some other people can add on and round this out.

Now things get interesting - we switch to software layers.

Setting aside how those instructions get written for the moment -

Backing up - how does that software get written?

So, adding it all up, a program you write will pull in libraries, usually a layer or two of them. Those libraries and some of your code will call through to OS instructions. Those OS instructions are mapped to lower-level instructions (libraries within the OS - it’s not a single layer… probably has more than a few layers of its own). Eventually it all gets boiled down into assembly/machine code. That code then runs in the hardware - within a module, on an integrated circuit. And “runs” means putting the specified 1’s and 0’s where they should be when they should be there. Those 1’s and 0’s are electrical switches - 1 for on, 0 for off. They’re fed into the integrated circuits which are themselves composed of lots of lower-level boolean logic gates. Those logic gates are composed of simple transistors.

All together, call it … maybe 4 layers before you hit the OS, then another… say 3? 4? 5? before you hit machine code. Then it’s modules, integrated chips, logic gates and transistors. Another 4 layers of abstraction. Toss in a couple more for good measure (I’m sure there are some additional physical abstraction layers in there - EEPROMS, and the like), my back-of-the-envelope math puts us in the ballpark of 15… maybe 20 layers from your compiled software to the transistors. Depending on what you’re doing, of course.

# Sources

https://www.reddit.com/r/learnprogramming/comments/1gbe4j/comment/caimx99/?utm_source=share&utm_medium=web2x&context=3


Interactive Graph