What is Bootstrapping? – Computerphile

What is Bootstrapping? – Computerphile


As the Digital equivalent of the dilemma of the chicken and the egg. Which came first? Okay. Alright. And I was as confused as that. The reason its called bootstrapping Is that it comes from an old tale of literally pulling yourself up by your boot straps. So that way in which you would actually get something started is that you would pull yourself up with your bootstraps. and that bootstrapping sequence is the thing that starts that process. One of the hardest bits of doing Computing is that you ultimately have to recognise, that there comes a moment when you can’t understand it all. You can’t understand the thing that you are building is so complex that it doesn’t all fit in your head. Okay? Thats the hardest and most difficult moment I face I’ve ever faced. And it’s the bit that everybody kind of doing Computing, Struggles with. It happened to me when I learn’t about Compilers. Now Compilers are the things which take the programming languages that we have and translate that programming language, into the sequence of instructions that run, at the chip, on that computer. Okay? So they go all the way from a high level programming language like Java down to the machine codes that you might be running on. Here’s what it kind of gets difficult on this one. You’re gonna have to bear with me on this one. And as the digital equivalent of the dilemma of the chicken and the egg. Which came first? Okay All right And as I was confuse in that. Okay. And so you will write something in a language, say for example, You write something in one of the language, let it be java And you write things in java And it has a particular style of writting “if”, you know, if statements a whole set of things but how do you start? where do the first language come from? and how do you get there it is that moment of complexity that almost feels like magic ok, because it works And it teach you where to figure why it works And it feels quite allusive Bootstraping is is a means by wich we can allow our software systems to exist independent of the machines that they’re running on. Without things like bootstrap and without compilers You’d essentially have to rewrite programs and replicate all the instructions for every machine that you’d ever built; Ok, or every family of machines. so if you, if everything stayed at the level of ones and zeros and flicking switches you’d have to have a different sequence of flicking switches for every machine that exists in the world and that gets tiresome at best but virtually impossible given the complexity and the size we’ve got.

100 thoughts to “What is Bootstrapping? – Computerphile”

  1. This video answers one of the most common questions people new to programming or computers in general ask. Thanks a lot!

  2. What was there first, the chicken or the egg? Thats and easy question. It was of course the egg. Chicken are birds and birds come from reptils (i.e. dinosaurs). Dinosaurs layed eggs, because they were reptiles. Conclusion: Stupid Question

  3. The title of this video is misleading.  Most of it is really about compilers not about bootstrapping.  Bootstrapping is the process of initiating the machine code – the operating system within the operating system.  It is often responsible for the switch from physical addressing to virtual addressing.  The bootstrap process in DEC's VMS operating system is one of the most elegant pieces of code I ever saw.

  4. I must be old school since I relate bootstrapping as part of making a computer usable as a computing device. IE the series of programs needed to allow the machine to operate from when it is turned on. Compiling, which this video talks about, is something different. Now purely in the abstract sense, these are related since the logical question is how are the bootstrap programs written?

  5. Machine language should be the first thing students learn in the first place… Make it low level translated but java basic or C is really not the hardware level programming.
    The overhead is really killing the CPU.

  6. when you make machine learning code and you get 6 or so vectors. It gets hard to wrap your head around

  7. The first language is the hardware architecture, it is just logic gates and a set of binary flags to trigger instructions sets.

  8. Since bootstrapping can have so many meanings in computing, this is what he's actually referring to: https://en.wikipedia.org/wiki/Bootstrapping_(compilers)

    The article also cleared up some questions I had after watching this video.

  9. Great video! As a web designer I'm constantly baffled how my html and css code gets interpreted by computers, smartphones, tablets and TV's and somehow looks everywhere how I wanted it to look. Just imagine all the calculations that have to be done to convert the code into a color-matrix which can be sent over to the display!

  10. @Brandon Best. Oh I am aware of how compilers work. I remember compiling GCC itself on unique hardware to get GCC runnable on that unique hardware. I was commenting on the fact that my old school brain relates bootstrapping to turning on a computer.

  11. I also think it was a bit disingenuous to use Java as an example language. But Java can be compiled in the traditional sense as there are plenty of Java compilers available. It is true that the larger use case of Java is through the JVM.

  12. bootstrapping may have this specific meaning among compiler-writers, but in a much more common sense it refers to what happens when you turn on your computer

    a chip on the motherboard, called the BIOS, runs a self-checking and hardware identification program, then if all goes well, the operating system is loaded and takes over

    it is called "booting" for short, and the word is a misnomer anyway because nothing is causing its own self to move or execute

    its just a logical sequence of events like everything else that happens in a computer

    when you think about it nothing can "pull itself up by its own bootstraps"
    anybody know the original context of this phrase? it must have been ironic

  13. How was the first ever compiler compiled if there wasn't already a compiler to compile it?

    I think that makes sense. LOL

  14. Enjoyed this, good description about high/low level languages. However I must admit I thought bootstrapping was loading and passing of control from the boot loader firmware to the OS?

  15. Java probably isn't the best example since it gets converted into bytecode and is executed via virtual machine instead of being actually compiled…

  16. Though it is also important to understand how the low level stuff works because their restrictions and limitations doesn't vanish when using high level language.
    For example CPU cache. An algorithm can be correct and run slowly because it isn't optimized to fit in the CPU cache.

  17. I hoped to see something about to boot sequence of a computer or something on the history of languages and compilers (from assembler to BCPL, C, and VMs languages). But still, that was cool !

  18. I have an idea for a video: About how emulation works. For example, an emulator that runs software made for a different system, like a video game emulator.

  19. This video makes it sound way more complicated than it is – bootstrapping is just building a compiler with itself. If a compiler can build its own code, that is, if it can bootstrap, it is called self-hosting.

  20. Just like with the chicken and the egg, the egg is the idea. The blueprint of the chicken. The egg came first. (Reasoning, without a cell dividing there is no chicken. The egg starts out as a cell)

    So now then, the idea that spawned binary logic (around the year 1705) was the egg and from that, the first logic gate was realized.
    That has given rise to ever more complex machinery which eventually led to electric powered logic gates.
    At one point in time, someone made a "simple" computer capable of being used to write more complex programs running on more complex machines that in turn were used to write even more complex (or higher level) software.

    We are not quite there yet, we still need human intervention but some time in the future we will have machines developing more advanced machines on their own using whatever set of "rules" to guide them towards progress.
    At that point, we humans won't even be capable of understanding the process. We will just accept that it works, no matter how badly optimized it is.
    We will just say "hey, i would like XYZ" and a machine will build it for us.

  21. The quintessential instance of bootstrapping occurred when we needed to create the first compilers (actually, "assemblers") which would allow programmers to write native machine code in a textual format. Before you could write 6502 assembly language, someone first had to write a 6502 compiler in pure machine language, or do the translation from assembler to machine code by hand. Of course it's even possible that the first 6502 compiler was written on a Z80 or any other existing architecture. Once the 6502 compiler existed, it could then be improved, writing the next version using that initial hand-compiled version.

    Taking the Atari 6502 computers as an example, their first 6502 assembler was probably a reference assembler that had been hand-coded by the chip-maker. But they quickly used that tool to build a better assembler, and used that first Atari-based program to write the core Atari OS, the code to read and write to its memory-mapped custom chips, to handle tape and disk I/O, keyboard polling, etc. They used that first assembler to create a better Macro Assembler (one which allows coders to combine blocks of assembly code into reusable units) as a full Integrated Development Environment (IDE) combining file management, editing, assembly, debugging, etc. They used this tool to write AtariBASIC, a simple high-level language. And other developers used the assembler to write the "Deep Blue C" compiler, one of the earliest C compilers. The "B Key" compiler (which turns AtariBASIC into small and efficient bytecode that runs much faster) was itself written in AtariBASIC, then used to compile itself, so it's a bootstrap within a bootstrap.

    So very quickly the bare 6502 chip became a computer with innovative audiovisual hardware and a multi-language code platform, all bootstrapped from that first early reference assembler. Today we don't need to bootstrap new chips, because we can just make a GCC or Clang plugin that spits out the right machine code. But we can always get a similar experience by building 3D printers that make new 3D printers, robots that construct newer and better robots, tools that allow us to make better tools…

  22. You should do a video on Operating Systems!

    Virtual Address Space (and translation), Processes/Threads, Program memory etc.

    I think that the OS is often just viewed as "Something I can boot, which lets me click things and access files". A more in-depth view of the OS would hopefully clear up many of the misconceptions.

  23. For anyone who wants to get that feeling of "This is madness" go do Open security training x86 and Life of binary course. You can rage on me when your brain melts 🙂

  24. Our bootstrap in 1973 was a punched card with 40 pairs of numbers (80 column total).  It consisted of <memory location to start loading card><memory location to start executing> <Hex number pairs to load into computer> and FF to mark the end.  The instructions on the boot card read 1 block from the disk, which then executed code to read more from the disk.  Our line printer in the morning printed the 1'st few lines very uneven, so the same boot process was used to create a card that printed rows of E's on the printer to warm it up.  That was machine coding.

  25. The egg came first!!! An animal that was not a chicken laid an egg, the cells in that egg had a genetic mutation that made it a chicken and it's parent not a chicken. Thought this was well known by now

  26. Interesting – never heard this use of bootstrapping before.  32 years ago when we were taught computing at high school in the UK (in the days of the Acorn BBC B microcomputer), bootstrapping was used to describe the powering-up process of the computer, whereby it checked itself out (what we'd call POST now) and launched the BASIC interpreter from ROM. Do people still say 'booting up'?  That comes from the 'old' use of the term bootstrapping.

  27. Back in the the 1970s I first learned how to write binary diagnostics for an Interdata Model 70 (an IBM clone) which needed to be entered via front panel switches. Alternatively, you could input the 50-sequence (a bootstrap-loader) which would bootstrap a small librarian from tape with which you could run a collection of pre-written diags. A year later we bought a firmware module which contained a copy of the 50-sequence so we could boot faster. It seems to me that this gentleman is using the phrase "bootstrap" in a different context (i.e. using software tools to make better software tools)

  28. Wow, I've been wondering about this for a long time but never knew where to find any information on it! Thanks.

    Like, since everything is simply ones and zeros, mustn't the first people who ever programmed something have written it in ones and zeros?

  29. This reminded me of Ken Thompson's talk Reflections on Trusting Trust which demonstrates the most insidious hack I can imagine, where an exploited compiler adds a vulnerability to the compiled binaries of itself which can be potentially impossible to detect. You guys should definitely do a video on it.

  30. Why are all the compterphile people British?  No disrespect to Turing, Boole, Lovelace, and Babbage, but some Americanization might make this channel better.

  31. An eloquent essay on the complexity of computing:

    https://plus.google.com/+JeanBaptisteQueru/posts/dfydM2Cnepe

  32. Computerphile – Thanks much for the reminder of the joys of writing our own bootstrap programs for the Honeywell 2000 and having to get the entire program on a single 80 column card or hand entering it through the console keyboard, if the cardreader was down for some reason.   And having to run the bootstrap every time the machine was turned on.  No such thing as a Load N Go Program at that time.

  33. Really interesting video, but found it very confusing and hard to visualise without some visuals to accompany it.

  34. I heard once from a ASIC manufacturer that there are not 2 100% identical chips because impurity ( http://en.wikipedia.org/wiki/Wafer_(electronics) but 99.99999% is ok I guess 😉

  35. But the egg obviously came before the chicken by millions of years.

    There was no first chicken, but if there was it would have been inside a non-chicken egg (if you define a chicken egg as an egg laid by a chicken) or it would have been inside a chicken egg (if you define a chicken egg as an egg with a chicken in it).

    In all cases the chicken could never have come before the egg.

    The chicken had to be bootstrapped by a non-chicken 🙂

  36. Wrong! Bootstrap code has nothing to do with compilers or other programs. It IS specific to the machine it runs on. It refers to the first few instructions on the 'rebooted' machine which load the core filing system which is then used to load whatever program is desired. Nowadays this is held in firmware but it was initially keyed in by hand using physical switches and so was as small as possible. It 'loads the loader'. Everything else (even the OS) is applications software.

  37. Years ago it was possible to use 6502 machine code directly on my Acorn machine. "LDA"=Load value A. "JSR" Jump to Subroutine in register. and Many others all followed by a memory address or pointer to the Hi byte or Lo byte of said address. I forget now it was years ago, but it could be done if you had the patience and inspiration!!!

  38. The way he says it sounds like you need different code for each individual computer, only later (when Brady gets confused) is it made clear that it's about different architectures

  39. Since all this computer architecture is built upon itself, does this mean there are inefficiencies that get multiplied throughout the entire code from low level to high level? If so, is it possible to rewrite the very low level code so that it is of maximum efficiency? Or are we stuck with ancient old code because it would be impossible to go back and change it without changing the entire computer industry standards?

  40. You cannot understand the entire tech stack, that is the curse of the computer engineer, and the source of so many problems

  41. The first chiken egg comes from the Red junglefowl "Gallus gallus" It is thought to be ancestral to the domestic chicken.

  42. I have to say that after a year of IT stud I still have trouble understanding the term "Abstraction". Much Like I had problems, and still do to some extent, understanding "Entropy" when studying Mechanical Engineering

  43. The trouble is how you choose your base levels. You can go a long way and then realize that you have to go back to square one because you realize that if you designed your hardware differently you could do a lot more.

  44. Isn't the answer to the chicken and egg question obvious? If the chicken came first, it came from an egg, so thus the egg came first!

  45. No one has bootstrapped compilers in the decades since cross-compilers were invented.  But every day, people bootstrap their computers when they push the power button.

  46. To my knowledge – bootstrapping is the phase where the machine is going to start the first piece of code – and needs to know where to find it – and since the machine doesn't know for sure – its told where to find it – either from floppy or some harddisk or tape.
    hardcoded instructions make the assumption where to find this piece of code
    the first piece of code loaded from the media – like the bootsector – master boot record – if such exists – since those are late implementations ( iow – early machines didn't read from a media like floppy.. but a mechanical key selector – or relays – or papertape –

    the BIOS is the 'static' code where the machine can find assumed settings – like where to find the first media to boot from – if you find the bios code for the 8088 (ibm) – and you debug this – you will find very primitive instructions that test the mainboard if all items are working or available.

  47. I must be getting old because that is not how understood bootstrapping at all. I thought the bootstrap was the firmware installed of the motherboard that exposed the hardware of the machine and a device on which could run, so the incoming operating system which one was trying to install could do its stuff. As I say I'm old School and things probably move on with out consulting me.

  48. "there come a time when you understand you can't understand everything about computers" – man, the feels. That's been my life's quest, and I've reluctantly come to the same conclusion 🙁

  49. "There comes a moment when you can’t understand it all, you can’t understand the thing that your building is so complex it doesn't all fit in your head."
    And this is precisely why I still program Apple II computers, I CAN understand the whole system. I don't need a compiler, don't really need an assembler – I know the 6502 op codes, where everything is in memory, exactly what the program is going to do at any given time.

  50. well explained, if you think he was chatting crap you either hate our eglish accent or your too young or your programming and hardware knowledge is from youtube… This video was all facts.. the new form of bootstrapping is people who use complex code they know nothing about but use it to do the things they know it can from a base binary level, tweak it abit and maybe it works, thats the bootstrapping some of you are referring to right, so called xbox hacking etc, that aint boot strap at all, i think many used the bootstrap in the wrong way and got many beginners hooked onto something way over their heads, bootsrapping should be seen as a boot that has a particular configuration made to do whatever its meant to at its best and tries its best not to have any external dependancies to boot..

  51. Wow! That's advanced bootstrapping! Many early machines didn't have a ROM. Bootstrapping was the sequence of instructions that were individually (manually) set into RAM address by address via a sequence of switches. This allowed a tape to be read which loaded the drivers and operating system when the computer was switched on or rebooted. Have a look at a PDP 11 for example.#

    On a lighter note of course the rooster came first.

  52. Chicken or egg….neither came first as chickens evolved from dinosaurs and dinosaurs evolved from fish and bacteria so there you go

  53. I was recently looking into a BASIC compiler (because I'm working on a LLVM front-end as a challenge). The compiler was written in BASIC and I had to download the bootstrap version.

  54. Nowadays nobody does this kind of bootstrapping for new platforms because it would be silly. People use cross-compiling for this. For instance I don't think anybody writes mobile software using smartphones. Folks just use some PC based SDKs and IDEs which output packages that mobile OSes can install.

  55. isn't the program written for the architecture such as x86 hence why the code works on all x86 as all manufactures conform to the design.

  56. For everyone out there wondering. The Egg came first. At some point way back in time some creature that wasn’t a chicken laid an egg that hatched Into a chicken. That’s how evolution works.

Leave a Reply

Your email address will not be published. Required fields are marked *