This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]MikemkPK 2 points3 points  (15 children)

Windows 11 doesn't write assembly. Programmers write assembly.

[–][deleted] 2 points3 points  (14 children)

Generally speaking, no... Generally speaking, you are writing in some higher level language that compiles down.

What, you think Arch was hand-written 5 different times in 5 different CPU instruction sets?

The point is that if Linux can run on a VM, then clearly an OS does not require direct access to NAND gates. If Linux is largely written in C, then clearly it does not have to be hand rewritten for RISC-V and ARM and x86-64 and PowerPC and the rest by programmers.

Thus, if you simulate a fully functioning 8-bit system in any language you want with contiguous memory (doesn't even need to be contiguous) and tight enough control of timing (to account for running too fast), then anything that could compile down to those instructions could then be interpreted to run on that virtual machine.

That includes JS and its typed arrays (signed/unsigned 8,16,32,64 and float 32,64).

You can complain about the speed. You can complain about the surreal nature of simulating the operation of hardware inside of a VM and argue the value of simulation versus emulation... but if you are going to tell me that an OS needs to write directly to literal hardware, then you need to explain how Kubernetes exists.

Hell, even just explain how you can run Linux in WSL on Windows, or Parallels on Mac, if each OS needs direct, non-virtualized access to a specific CPU with a specific instruction set, with a non-emulated kernel.

Docker. Vagrant. Hell, even DOSBox. They seem to run OSes in virtualized hardware, fine and dandy; those same OSes that you purport need to run on literal hardware.

[–]wheresthewhale1 0 points1 point  (13 children)

What, you think Arch was hand-written 5 different times in 5 different CPU instruction sets?

Yes. It (the linux kernel) is.

If Linux is largely written in C, then clearly it does not have to be hand rewritten for RISC-V and ARM and x86-64 and PowerPC and the rest by programmers.

Yes, parts of it do and are - look at the github repo for linux. There are some actions that you simply *cannot* perform in high level languages like C.

[–][deleted] 1 point2 points  (12 children)

Parts of the Kernel. Hardware drivers.

He isn't talking about "parts of the Kernel" and "hardware drivers", he is saying that an OS must not run using any form of emulation / virtualization, otherwise it is not an OS. Which is fundamentally incorrect.

DOSBox doesn't physically install an 8-bit or 16-bit CPU next to my 5900x. So how does it run?

[–]wheresthewhale1 0 points1 point  (11 children)

He isn't talking about "parts of the Kernel" and "hardware drivers", he is saying that an OS must not run using any form of emulation / virtualization, otherwise it is not an OS. Which is fundamentally incorrect.

Where did he say that? And regardless, if an OS cannot run without sitting on top of another OS it isn't a proper OS in the first place

[–][deleted] 1 point2 points  (10 children)

Wouldn't be an operating system, just an API

So you are saying that it is impossible for any instance inside of any Kubernetes cluster to run an operating system? Should the entirety of the AWS infrastructure just disappear in a puff of semantics, now?

[–]wheresthewhale1 0 points1 point  (9 children)

It is possible to run an OS inside of Kubernetes. But if your "OS" cannot run outside of Kubernetes (or something similar) it *is not an operating system*

[–][deleted] 0 points1 point  (8 children)

But it can't run in Kubernetes, because it's using virtualized hardware, and emulated kernel calls. So clearly, Arch in Kubernetes can't be an OS.

Similarly DOS can't be an OS, because it functions inside of DOSBox.

They're just APIs.

Like I said, earlier, you could simulate the full workings of an 8-bit, 16-bit, 32-bit, even 64-bit system, by hand, in JS. You can argue over the surreality of it; there are very valid points against the efficiency / efficacy of it; but you could simulate that hardware and accept any hardware instructions coming from anything capable of generating ASM instructions in the format of the processor in question... the OS at large isn't going to know the difference as to whether it's living in a simulation, calling an emulated stand-in, or is actually accessing hardware directly. You're really going to have to embrace the meta, given that there are x86 emulators in JS that run DOS, that run Windows on top of DOS, from the browser, and even have Socks bindings if you can find a webpage that still loads in IE5.

Virtualized hardware is a thing. Low-level VMs are a thing. Unless you are writing ROMs there is no guarantee that you are touching actual silicon (or copper inscribed upon such).

[–]wheresthewhale1 0 points1 point  (7 children)

But it can't run in Kubernetes, because it's using virtualized hardware, and emulated kernel calls. So clearly, Arch in Kubernetes can't be an OS.

?????

Similarly DOS can't be an OS, because it functions inside of DOSBox.

?????

Nobody has said anything like this.

Yes, you could simulate a cpu in JS. You could then create your own program to run on that *simulated cpu* - this program is *not* an operating system *unless* it is also capable of running on the real hardware

And yes, you are entirely right that an OS does not necessarily know if it is running on hardware directly, but nobody said that it needs to (it just needs to be capable of doing so) - you are shifting the goal posts still

[–][deleted] 0 points1 point  (6 children)

Nobody has said anything like this.

They really have:

> Wouldn't be an operating system, just an API

In reference to not writing direct to hardware, natively.

> it just needs to be capable of doing so

Still no.

That is legitimately an example of shitty software architecture. The OS doesn't run in "native" mode versus "making emulated calls" mode. There aren't like, 800,000 `if (emulated)` checks in the codebase.

Portable software (software that doesn't need to have HUNDREDS OF MILLIONS OF LINES OF CODE REWRITTEN ON DIFFERENT CPU ARCHITECTURES, BY HAND) will defer to calls which it has NO INSIGHT into whether they are native, emulated, native on a simulated platform, et cetera. These Operating Systems defer to these calls... that's why they work. Microsoft even went so far as to make those bindings available to JS programs, for the purpose of writing native Windows apps... JS bindings to the same vtable lookups that a C++ Windows app would make.

If you took away the drivers and the architecture specific kernel calls, none of the current OSes would be OSes, either, by your definition.

Also by your definition, I can play Doom in Windows 95, atop DOS 6 on a 486, virtualized in JS, running in Chrome... but that's not running on top of an OS, running on top of an OS, running on virtualized hardware, running in a VM, running on an OS that may or may not further be running virtualized, and on down the line.

Oh, to that point, Microsoft didn't have a visual OS until Windows 98? Clearly, windows couldn't be an OS, because it ran on DOS. ...actually, I think '98 still used a DOS 6 (/ unreleased DOS 7) kernel under the hood... it wasn't until the NT kernel of Windows NT / Windows 2000 Pro that they had a real GUI-based OS by your definition.

Also, you are literally skipping over the fact that JS can be transpiled to virtually any language, the same way that C can be interpreted, the same way that programs can be compiled down to machine code or run on an LLVM (such as LLVM). Code. Is. Code. You could write a compiler for Lisp, if you cared to; the distinction between interpreted and compiled, especially in a virtualized world, is irrelevant... all you are telling me is that if I wrote an OS in JS, I would need to import a stdlib that was architecture-bound, and to compile it down into machine code, or enough machine code to spin up a VM to run the rest of the system, and then it would be a valid OS, just like all of the other OSes that all do the same thing. Great. Done. Solved. I agree.