0

This question applies to all operating systems and hardware, but I was curious what is going on behind the scenes when you install an OS on hardware. I know that macOS comes preinstalled on Macbooks, but hypothetically speaking, if you had to install it, what is going on behind the scenes between machine code and CPU/quantum mechanics.

closed as too broad by Tetsujin, jksoegaard, jaume, Mark, Graham Miln Aug 24 '18 at 9:57

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Your question is extremely broad - please be more specific. Are you interested in what sets macOS installation apart from Windows, Linux or other OS installation procedures? Basically any ordinary operating system installation consists of possibly partitioning/formatting storage, copying over files, copying over a bootloader and altering installation specific configuration (such as adding user accounts, network configuration, etc). – jksoegaard Aug 24 '18 at 8:57
  • I meant like how does the binary talk to the CPU. Not really how to the configuration stuff works. Like one layer lower than human. Is there a consistent way that the binary/CPU relationship works for all operating systems that is OS agnostic. – Cody Rutscher Aug 24 '18 at 8:58
  • It depends on what exactly you mean by your question - but in general terms, each platform provides one or more specific so called ABIs that defines how the operating system (or other programs) needs to be structured in order to work. The platforms binary interface is OS agnostic. The OS will then again provide a ABI for applications running on top of the OS - that will be a mix of requirements from the platform binary interface and the OS' own requirements. – jksoegaard Aug 24 '18 at 9:28
2

Each platform comes with one or more specific platform binary interfaces that define how operating systems (or stand-alone programs that are not operating systems) must be structured.

The first run parts of an operating system is generally defined in binary machine code. The CPU will read the machine code, divide it into instructions and carry out those instructions. The instructions make up the operating system.

All operating systems running on a specific platform must abide to the same (or a small number of) binary platform interface. They again offer an application binary interface (ABI) to user programs running on top of the operating system. The ABI is a mix of the platform binary interface and specific requirements for that specific operating system. Some operating systems offers multiple ABIs.

A platform in these terms is a combination of a CPU architecture and model and various peripherals (for example a platform could be a Mac with an Intel x64 CPU, UEFI firmware interface, etc.).

  • Is it possible for a human to make sense of the binaries that talk to the machine? Or do we just have to trust that they are doing their job and communicating with the CPU effectively? – Cody Rutscher Aug 24 '18 at 9:37
  • Humans create these binaries, so yes humans can make sense of them. In the early days of computing, binaries were "handmade" you could say. Today we use human-created tools to make it easier to produce binaries - but they could as well be hand-built if anyone had the time and reason for doing so. – jksoegaard Aug 24 '18 at 10:09
1

The CPU is running a program. The binary contains data read by this program. Based on the values of the 1's and 0's in this data, the program (running inside the CPU) determines where to transfer data from various storage locations inside and outside of the CPU. Many of the transfers pass the data through logic which perform operations. Addition and multiplication are examples of such operations. There is much addition hardware beyond just the CPU. This additional hardware operates in parallel with the CPU to transfer the data to and from various peripherals.

  • What is powering the CPU to run the program and transfer this data around? Is it the battery? – Cody Rutscher Aug 24 '18 at 9:41
  • Electricity. Some Mac use electricity from a battery. Mostly, electrons. Basically, the CPU is either filling or emptying buckets of electrons. – David Anderson Aug 24 '18 at 9:43
  • How do you go from electrical circuits/transistors to binary? Or is that not relevant? Is binary just an arbitrary way to describe a transistor being on or off? – Cody Rutscher Aug 24 '18 at 9:45
  • Then computer chip has locations where electrons can be stored. I like to think of the locations as buckets. During a clock cycle, a bucket either set to contain sufficient electrons to be considers a binary 1 or drained of enough electrons to be considered a binary 0. For the most part, the buckets are constructed from transistors. The CPU speed is limited by how fast this can be done. – David Anderson Aug 24 '18 at 10:00

Not the answer you're looking for? Browse other questions tagged .