Basically ... your computer can just start the disk, because:
The BIOS includes this disk device in boot order.
When booting, the BIOS scans all boot devices in order, such as a floppy drive, hard drive, and CD. Each device accesses its media and checks for a hard-coded location (usually a sector on a disk or CD) for a fingerprint that identifies the medium and indicates the location to go to the disk (or medium) where the instructions begin. The BIOS tells the device to move its head (or something else) to the specified location on the media and read a large piece of instructions. The BIOS sends these instructions to the CPU.
The processor executes these instructions. In your case, these instructions are about to start Ubuntu OS. They can also be instructions for stopping or adding 10 + 20, etc.
As a rule, the OS starts up, taking a large chunk of memory (again, directly from the CPU, since library commands, such as "GlobalAlloc", etc., are unavailable because they are provided by the unloaded OS) and starts creating structures for the OS itself.
The OS provides a bunch of "features" for applications: memory management, file system, I / O, task scheduling, network connectivity, graphics management, access to printers, etc. This is what it does before you “get control”: creating / starting all services, so later applications can work together and not stomp each other in memory and have a good API for the provided OS.
Each feature provided by the OS is a big topic. The OS provides them with everything, so applications just have to worry about calling the right OS library, and the OS manages situations, for example, if two programs try to print at the same time.
For example, without an OS, each application must deal with a situation where another program is trying to print, and "do something," like printing in any case, or cancel another job, etc. Instead, just the OS to handle this, applications simply tell the OS to “print this stuff,” and the OS ensures that one application will print, and all other applications just need to wait until the first one completes or the user cancels it.
The smallest number of bytes that an OS should be does not really make sense, since "OS" can mean many or very few functions. If all you wanted to do was run the program from a CD, that would be very few bytes. However, this is not an OS. The task of the OS is to provide services (I call them functions) to allow the launch of many other programs, as well as to control access to these services for programs. This is complicated, and the more common resources you add (networks, and Wi-Fi, and CD recorders, and joysticks, and iSight videos, and two monitors, etc. Etc.), the more difficult it becomes .