All linux OS are they compiled to machine code ie binary?
The kernel, libraries, and OS services are compiled to machine code.
There are support scripts, and some helper utilities and simple applications that use interpreted languages.
Most Android applications, however, are bytecode: see
Android Runtime.
The CPUs used do they have the same instruction sets?
No, not at all.
We do use the exact same source code for all architectures, but that source code does have architecture-specific quirks.
If you write a program in C or C++ for Linux, you will be able to compile it to any hardware/CPU architecture machine code Linux supports, and run it (in Linux using that hardware).
If you think about it, that is really neat. Particularly when one realizes how different some of the architectures are in their details. (The one I like to point out is hardware locking primitives: both load-linked store-conditional (LL/SC) and compare-exchange (CMPXCHG) -type architectures are supported in Linux, so that code using futexes or pthread mutexes will behave the same on both types of architectures.)
In the old days writing machine code on a 10MHz CPU was struggle to get speed performance in multitasking
With CPUs speed above 1GHz programs should really fly I have a suspicion all they programs are executed via a line interpreter which is like interpreter BASIC which was so so slow
No, it is just that current programmers are very lazy, and prefer to waste CPU and memory resources if it makes their programming job a tiny bit easier.
You can verify this for yourself when you start doing intensive math. For example, even though the machine I'm writing this post on is over five years old, it only takes seconds to loop over all 32-bit integers, one by one. Some of my own brute-force mathy stuff verifies (a formula) for
all possible finite single-precision floating-point numbers, just to make sure.
When you use Linux and move from traditional spinny disks to good NVMe SSDs, you also realize how much time is taken by just loading stuff from storage to memory. (I personally am looking forward to getting two same NVMe SSDs to run in software RAID-0, or "striping" mode, up to doubling the data rate.)
_ _ _ _ _
Note that Linux is not used only on desktops and laptops, and Android on phones. Both are extensively used in all sorts of appliances, from routers (very often Linux) to TVs (often dedicated variants of Linux or Android) and everything in between. And on most web servers, including this one. Hell, over 50% of Microsoft Azure compute cores run Linux,
according to Microsoft.
Linux is one of those things that people don't notice, because it is so ubiquitous, and tends to just work. (That said, on the cheaper end, like in routers, the systems integration work I have seen is laughably atrocious -- literally looks like highschoolers' hobby work.)
(Before you point out that even this forum has had many issues, those tend to be either the forum software or database-related, and not "Linux" issues at all.)
Very often the annoying issues humans see in computer and appliance operation is not actually about speed, but about
latency. For example, my laptop takes about half a minute to boot up from a cold start. 25 seconds or so of that is EFI BIOS, i.e. the computer firmware checking things out, enabling internal buses and waiting for them to stabilise, and so on. The actual Linux OS takes only about 5 seconds for me to start up –– and unlike Windows, it is actually immediately usable after that, having started up everything, instead of still starting things up in the background. (This one has a 512 GB Samsung PM961 NVMe SSD, which is pretty darned good, though, even being over five years old.)
Similarly, for example digital TV channel switching is
sloooow, because the image cannot be displayed until a P-frame is received. (To simplify, P-frames describe the entire displayed image, whereas most frames are I-frames, which describe changes to the previous (or next, depending on format) P-frame, typically using motion vectors for small rectangular chunks.) The channel change latency is due to the technology, and cannot be shortened except when the receiver can "secretly" monitor the data sequences for the other channels. It is not a programming issue at all.
With graphical user interfaces, the "bling" consumes a surprising amount of resources. You can see this when comparing e.g. Gnome or KDE desktops to more lightweight (but less visually "bling-y") desktops like LXDE or XFCE. For pure computing boxes, eschewing display altogether and using remote consoles via e.g. SSH makes a big difference, also explaining why basically all of the 500 most powerful computing clusters in the entire world all run Linux.
_ _ _ _ _
I personally don't touch Raspberry Pis because of Broadcom and their attitude towards Linux, and would suggest e.g.
Odroid-C4 or
Odroid-M1 instead. They are both faster and use less power than 'Pi-4, but are also a bit more expensive.
Those who only interface to Linux stuff via the Raspberry Pi community seem to be quite happy with Pis, though.
In any case, the storage medium you use with such SBCs will affect the experience a lot. With Odroid-C4, I recommend getting one of the C4-compatible eMMC modules (or at
minimum a USB3-connected SSD with just boot on SD-card), and with Odroid-M1, a PCIe 3.0 NVMe M.2 SSD (max. 1600 MB/s) (can also be used as boot media, because Petitboot is on SPI flash on the board).
_ _ _ _ _
Apologies for the wall of text. I can't help it, me overly verbose.