DOS Subsystem for Linux
31–40 of 182 posts
Re: DOS Subsystem for Linux
#32Just wondering. Since "Windows subsystem for Linux" is running Linux on Windows, shouldn't it be named "Linux subsystem for DOS"?
EDIT: I stand corrected. A closer look at TFA confirmed that it is indeed DSL. I was confused by the screenshot which at first glance just shows DOS running in QEMU on Linux. But it goes deeper! Yes, that is correct. Windows Subsystem for Linux means it's one of Windows' subsystems which provides linux. This should be called Linux Subsystem for DOS.
Re: DOS Subsystem for Linux
#33So does this run DOS on Windows? Or DOS on Linux? Or Linux on DOS? Or DOS on Linux on Windows? Would be nice if there were an explanation in the README.
The GIF's prety much crystal clear: it runs QEMU on Linux. And QEMU runs whatever you want, because it's a machine emulator/virtualiser, in this case it's running as x86 with MS DOS on top.
Re: DOS Subsystem for Linux
#34Re: DOS Subsystem for Linux
#35Earlier quoted context omitted.
This runs Linux "inside" of DOS, allowing you to exec Linux i686 binaries "inside" of a DOS terminal I put inside in quotes because how this actually works is quite amusing (and apparently is actually how Windows 95 also works)
Is this explained somewhere? I'd love to read how it works (without trying to understand the source code).
When DSL is first invoked at the command line it boots up the Linux kernel which takes over control of the computer from DOS.
Now here’s the trick: DSL makes use of a processor feature called VM8086 which allows for a 32 bit operating system to run legacy 16 bit code mostly natively. This feature is how early Windows, DOS extenders, etc worked. The Linux kernel also supports VM86, although it is largely undocumented and not really used these days. I think dosemu is the only major user of VM86 on Linux.
DSL then returns to DOS, which has essentially been flipped inside out and is now unknowingly running inside a VM8086 task. Helpfully Linux does not appear to clobber DOS’s memory during its own boot process.
DSL does just enough emulation of hardware like the keyboard to make things work, allowing DOS raw hardware access for everything else. This situation of running two operating systems at the same time on the same hardware is extremely fragile and unsafe of course, but it does seem to work surprisingly well anyway!
Re: DOS Subsystem for Linux
#36Earlier quoted context omitted.
EDIT: I stand corrected. A closer look at TFA confirmed that it is indeed DSL. I was confused by the screenshot which at first glance just shows DOS running in QEMU on Linux. But it goes deeper! Yes, that is correct. Windows Subsystem for Linux means it's one of Windows' subsystems which provides linux. This should be called Linux Subsystem for DOS.
This is a thing you execute under DOS to run linux commands. it provides Linux. (or at least pretends to do it that way around)
So what's different?
Re: DOS Subsystem for Linux
#37Earlier quoted context omitted.
This runs Linux "inside" of DOS, allowing you to exec Linux i686 binaries "inside" of a DOS terminal I put inside in quotes because how this actually works is quite amusing (and apparently is actually how Windows 95 also works)
Is this explained somewhere? I'd love to read how it works (without trying to understand the source code).
- it first, if not yet present, starts Linux, via normal Linux kernel load. It passes over some pointers from DOS into /init arguments so that /init can know about DOS' context when Linux was first loaded
- Linux's /init then uses VM86 [1] to call back into DOS, back to the function that was run in DOS before Linux was loaded (vm86_return). This is a bit of a 'draw the rest of the fucking owl' deal, as it has to actually emulate a lot of DOS/PC behaviour (emulate INB/OUTB, etc). It's basically a small VM, like with KVM, but for 16-bit DOS.
- when DOS wants to run a Linux command, it now uses a special new interrupt (DOSLINUX_INT) to call into the kernel. This in turn triggers a VM86 exit, jumps into the VM86 monitor in /init, executes the command, and pokes the result back into DOS, resuming VM86 emulation.
Re: DOS Subsystem for Linux
#38Earlier quoted context omitted.
This is a thing you execute under DOS to run linux commands. it provides Linux. (or at least pretends to do it that way around)
Windows subsystem for Linux is a thing you execute under Windows to run linux commands. It provides Linux. So what's different?