May 31, 2019

Linux as a rescue system


A look into dedicated rescue systems like GRML and knoppix show, that a recent iso file is far away from beeing small and compact. The GRML distribution which is used as a replacement for a real linux distribution will need around 400 MB on a CD-ROM drive, and systems like Fedora LXDE or Knoppix will need much more. The sad news is, that it's not possible to create a smaller Linux iso file because the Kernel alone will take 150 MB and additionally a strip down X Window system, systemd drivers and lot of additional software is needed. Even a ultracompact Linux rescue system will take around 1 GB space on the USB stick.
The alternative is to take a look at technology away from Linux and the C compiled ecosystem and Forth is the answer. A minimal Forth system which fits into 50kb of RAM is the complete operating system which includes the C compiler as well. In case of Forth the C language is Forth which allows to write much smaller sourcecode.
The only bottleneck in the Forth world is, that it is more difficult to describe than a Linux system. Explaining how to boot the GRML linux system is easy going. But explaining the same for a simple Forth kernel is much harder. The bottleneck in Forth is not the technical side. Forth is by far the most advanced operating system and programming language ever invented. The problem is, that it's poor documented and that most users are not familiar with it.
Let us make an example. From a technical side it is possible to build with Forth a webserver https://github.com/urlysses/1991 The code is ultrasmall and it is doing the same what a Linux system can do. The only problem is: how many users are able to boot the 1991 Forth webserver on their PC? And if they are not familiar which kind of literature they can consult? Exactly this is the bottleneck of Forth. It is an advanced programing language but it is hard to become familiar with it.
The problem with Forth is, that it can be implemented on any computer with any programing style. As a result, the newbie has the problem to find something which can be learned, teached and reproduced.
Back to the 1980s
In the early 1980s Forth was mentioned in the literature as a normal alternative to other language like BASIC and C. But slowly in the late 1980s, and especially in the 1990s Forth was no longer mentioned in the computing industry. The reason why can be explained on the CP/M operating system. CP/M was an early operating system for IBM PC. Before CP/M was invented, all the homecomputers were programmed in C, Basic and Forth. After CP/M, the importance of Forth had become smaller. So, what exactly was CP/M?
The idea behind an operating system was, to divide the users into programmers and endusers. The programmers are creating the software, for example a textprocessing tool, while the enduser runs the software on the computer. A second idea of a CP/M like operating system is to standardize the API with the help of layers. On the lowest level, the drivers for the floppy disk and the printers are there, on the next layer the OS commands for printing a document and access to a file are provided and so on. Both concepts are the opposite of what Forth had in mind. In the Forth ecosystem there are only programmers but no endusers, and in Forth nothing is standardized.
It is correct to assume, that without the invention of CP/M like operating system, the importance of Forth would be greater today. If a computer has no OS, Forth is a powerful technique to program the machine. Operating systems and especially graphical operating systems have reduced the importance of Forth. Most users (and even most programmers) today never heard of Forth. What they are using in their daily life are operating systems, and C- like high-level programming languages.
But why exactly was CP/M a great success? The reason is, that the normal users wasn't interested in the IBM PC but he was fascinated by applications for databases, calculations and games. The combination of an operating system plus a C like programing language makes it easier for programmers to write large scale end-user applications like dbase, Microsoft Office and similar tools. Such fullblown programs had in the 1990s a need for hundred of megabytes and today they will need gigabytes on the harddrive. The enduser likes such software because it provides him all the features he needs. In contrast, Forth software tends to be as minimalistic as possible. Even somebody writes a texteditor in Forth, he will only provide 10 features but not 10k.
Software for CP/M
In the 1980s many software were written for CP/M, for example Supercalc, dbase II, and programming languages like Turbo Pascal, Lisp, Comal, BDS C and so on. From the perspective of Forth all of these attempt are not helpful. They build an additional layer between the user and the machine and they make the overall system more complicated. But the software market in the 1980s and later had a different opinion. He came to the conclusion, that a standardized operating system, lots of application software and different programming languages which are compiling into assembly language are a here to stay.
Again, before the invention of the CP/M operating system, Forth was recognized as good alternative to existing programming languages like Assembly and BASIC. After the invention of CP/M everything has changed and nobody was interested in Forth anymore.
What remains unanswered is the question if the success of CP/M and later operating systems like MS-Windows and Linux were the right way or if Forth was the better answer in programming a computer. To answer this question it make sense to not focus on the operating system itself, but on high-level applications for example Wordstar. Wordstar was one of early large scale textproceccing software The old wordstar version for CP/M had a filesize of 390 kb and the MS-DOS version had 920 kb in size. A modern textprocessing software like MS-Word will need much more disk capacity. Why are these programs so large? Because they are providing so much features. Sure, there were alternatives available for CP/M which are equal to a small texteditor but the endusers prefered Wordstar. Perhaps this helps to explain why CP/M and other operating systems were a success. Because the idea was not to write a small efficient program which contains of 10 Forth words, but to program a fullblown application which contains of many megabytes of disc space.
And here is the bottleneck of Forth: it doesn't support very well the idea that the application will take 100 MB in size.Writing such large application doesn't make much sense for Forth programmers. All the Forth programs available are small and very small. If a Forth program is larger than 10kb in size, it is equal to a large application written by a team of programmers.
Modern non-Forth related ecosystem have the tendency to become large in size. MS-Windows and Linux as well take 20 GB on the harddrive at the minimum. If the user installs additional games and software he will need many more free diskspace. The reason is, that an operating system like Linux provides many things which are not needed. Instead of using one programming langauge for all task, Linux comes with a preinstalled Python, AWK, C, C++, Fortran, assembly, Ruby and Javascript interpreter. Instead of providing a single window manager which is the best choice for all needs, the user can decide between hundred of Window managers. All these increase the amount of occupied discspace. In the MS-Windows ecosystem the situation is the same. For one application domain like a database, the user can install many dozens of applications which are doing all the same. Windows and Linux are the opposite of what Forth is educating the user.
Applications for CP/M
CP/M and Forth can be understood both as minimalistic in design. The difference is, that CP/M wasn't a programming language but an operating system. This definition is important because of the cultural background in that time. The main reason why CP/M was successful was because of it's applications. Programs like Wordstar, dbase, Multiplan, and even Autocad were available for CP/M. Somebody may ask what has a program like Wordstar to do with a Intel based microcomputer, and exactly this is the point. There is no connection. The application stands for it's own, it is working on a higher layer. The software company MicroPro (Wordstar) was working independent from Ashton-Tate (dbase). In the company different types of programmers have written the code, they used different programming languages, and they made different mistakes.
The funny thing was, that dbase was not written for CP/M in mind. CP/M was only one target platform, later the program was migrated to MS-DOS. That means, dbase was it's own ecosystem and it has nothing to do with IBM-PC, nor a certain programming language.