Finding reasons not to using Forth is not easy. At first, we must admit, that from a technical point of view, Forth is superior. It allows to write small operating systems and efficient BIOS routines. But there are some reasons not to using Forth, but a programming language called C together with the MINIX operating system. An example homebrew project is the MAGIC-1 computer http://www.homebrewcpu.com/overview.htm
Why is Forth not used on the device? From the technical point of view, it would be possible to implement a Forth interpreter on that machine. I would guess, that Forth would be more efficient then a MINIX port. On the other hand, Forth is a closed source system, while Minix is open. What does that mean? Suppose, we are booting Minix on the system. Then it is possible to compile any c-program which is available under the GNU license for that computer. That means, we have access to a huge amount of software written in the past. In case of Forth we have no access to such software. Because Forth is a programming language, while Minix is a social movement.
The question is not, if an algorithm contains a stack or a for-loop, the question is about the license of the software. The term license is a legal term and describes the copyright situation. That means, we are able to download GNU software for free from the internet, while it is forbidden to download Forth software for free.
In a diary http://www.homebrewcpu.com/minix_port.htm, the inventor of the MAGIC-1 computers describes how he have installed Minix and also a webserver on the system. The most interesting aspect is, that he himself is not the programmer of the software. That means, he has only used the Minix OS, written by somebody else and he has no idea of how to program a webserver. And that is the major difference between a Forth driven cpu and a minix-driven homebrew CPU. Minix is some kind of social biotop in which knowledge is distributed freely, while Forth is about protecting electronics knowledge behind a software license. If a Forth programmer has no idea about TCP/IP, he is not able to run a webserver. He can not download a ready-to-run software out of the internet. Because, at first there is no webserver available and secondly not under the GPL license.
In a youtube video, the inventor of the MAGIC-1 homebrew CPU explains how the Minix operating system works on his computer, https://www.youtube.com/watch?v=0jRgpTp8pR8 The surprising fact is, that according to the video, the MAGIC-1 computer has solved the software crisis. That means, after installing the MINIX operating system on it, the computer is not only working on a technical level, but the user has also access to a huge kind of software library. In the youtube-video it is demonstrated the minix system itself, which contains the /bin directory with lots of preinstalled software. But the more interesting aspect is, that it is possible to compile a lot of more software from sourcecode and to start it also on the machine. Software, which was already written and is available right now. That is the major difference between the MAGIC-1 and a homebrew computer programmed in Forth.
Role playing games
Right now, there are two famous example of homebrew CPU available on the internet: Mark-1 FORTH (which is forth based CPU), and the MAGIC-1 (which is a Minix based homebrew project). What is the difference? The hardware is nearly the same. In both cases a computer was build from scratch which is able to run software. And both projects can be seen as a replica of early real computers. And here comes the difference, because the projects are emulating a different social role playing game.
The Mark-1 Forth CPU can be seen as a second trial of the Microsoft idea, while the Magic-1 project has a lot of common with the PDP-11 project which is a Unix machine. The question is not, what the machine itself can do, the question is what follows after the machine was realized. Microsoft was based on the idea of programming commercial software. Which means the sourcecode is restriced and books about the inner working of the operating system are not available. That is the same idea behind the Mark-1 Forth project, and the later iforth compiler, which is a commercial Forth compiler. In contrast, the Unix development around the PDP-11 machine was realized as an open system, which means that the sourcecode is free.
Let us describe some of the ideas behind UNIX. The main idea is, that the amount of space consumed by the programs is huge. A unix machine in the 1980s needs around 200 MB at a harddrive space, while todays machines needs around 10 gb. The reason why is, because the number of programs is huge and often they are many programs for the same purpose. For example under Unix are at least 100 different texteditors available, written by people from all over the world. The reason why so much software is available for UNIX has to do with the costs of creating new software.
The original tapes with the BSD-unix were distributed for free, and even beginners are able to write his own texteditor in the c programming language in a short amount of time. In contrast, writing software for a Forth system is hard and the numbers of people who are able to do so is limited. The typical Forth programmer is working for a commercial company, for example for Microsoft. And that is the reason why the software quality of Microsoft is higher then a Linux system.
Easy and hard tasks
Building a computer and a BIOS system from scratch is hard, right? No it is not. Wiring some transistors together, form a cpu and boot the system into a Forth prompt is an easy task. On the hardware level some lowcost components are enough and porting a forth integrated development system to the new CPU is also very easy. Easy in this situation means, that both parts (hardware and software) can be realized by single person in under a year. That means, the amount of work which is needed is one man month, not more.
That this is not only a theoretical assumption but the reality can be seen at endless number of homebrew cpu projects. Usually there are completed successful. At the end, at least a Forth system and sometimes a BASIC interpreter can be seen at the boot prompt. But there is another task, which is way more complicated. Writing software for such a computer. That is a task, which needs lots of more energy. A single programmer can write in one year only a limited amount of code. That means, a single amateur is not able to program a Linux like operating from scratch in his garage, even if he is doing nothing else. His project will fail.
Even large companies have problems to develop large software repositories from scratch. That means, a company which has 10 highly skilled programmers and let them program for one year on a computer game, they will probably fail. The reason is, that the amount of man hour which is needed to develop a complex game is greater, then the output of only 10 programmers. That is not a problem of understanding the inner working of a computer. Usually, the programmers are familiar with programming languages, compilers, stacks and the reverse polish notation. The problem is somewhere else. It is called productivity, and means, that a single person can not write more then 10 lines of code per day. And if the new game should have 10 million lines of code, the number of needed workhours can be calculated. And that is the reason why huge software projects fail. And because of the same reason we have a software crisis.
An easy task is everything which needs a low amount of manhours. For example, building a homebrew CPU from scratch, or porting a 2 kb long forth interpreter to a new CPU. The amount of work can be predicted in advance, and it is low. That means, the average expert needs less then a year. In contrast, difficult tasks are problem which need more amount of man hours. That means, even if the programmer is an expert on his field, he is not able to present a result in under a year. Let me give an example. Suppose we need a operating system which consists of 1000 lines of code. According to the average productivity, such a software can be programmed in 100 days by a single person. That means, it is an easy task because the programmer will present a working result in under a year.
And now we need an operating system which contains 1 million lines of code. If the same programmer with the same productivity is starting right now his job he will be finished in 274 years. That means, the project fails. What is the reason of failure? It is not a misunderstanding of what a computer is. It is not missing programming skills. The problem has to do with management. For realizing huge software projects, many programmers have to work in parallel. The programming work has to be distributed between the people. And this is the reason why Linux is superior to Forth. Not because of technical reasons, but because of management issues.
The question is not, who an operating system work from a technical perspective, the main question is how to manage large groups of programmers that a huge codebase can be created and improved in teams. The reason why the C programming language and not Forth is used for big applications has to do with this question.
Z80 UNIX
Since a while, there are some projects out there which are trying to port the UNIX operating system to Z80 cpus. https://www.youtube.com/watch?v=1WG8zopGzaA The Z80 cpu can be seen as the standard computer of the homebrew computer community. But what is so special about it? Usually, homebrew computer chips are driven not by dedicated operating systems, instead CP/M or Forth like system kernels are used. Installing Forth or CP/M on a homebrew computer means to not install any operating system. Because the amount of RAM is low, and the assumption is no OS is needed to run the machine. And instead, many z80 projects from the past doesn't need no operating system. Instead the proof of concept is dealing with the computer itself, that means a simple Forth prompt without any further features was enough.
The difference between using a dedicated operating system like UNIX and not using any kind of OS has to do with the amount of lines of code. A system which has only a BIOS like interface contains not more then 100 lines of code, perhaps 200 lines of code. The focus is not on a software-engineering task but on the computer. From the perspective of a user, such systems are useless. This has nothing to do with understanding the computer, but with using the computer for doing useful stuff. The idea of installing UNIX like operating systems on small 8bit machine is a new development, it is something which breaks with the past. The idea is, that a z80 computer (even it works great) is useless, because a computer without software can't be used in reality. The idea is, that the user is not interested in registers, memory address or interrupts, but he is interested in running games, webservers and databases on the machine. Such a use case is a bit esoteric because it is located of core computing science. It is defined in the literature as practical computing and software-engineering.
The main idea behind “UNIX on the Z80” computer is simply: not the programming language C or the UNIX guidelines are important, but such a project is about lines of code. That means, the typical UNIX implementation contains at least 10000 lines of code, and sometimes more. The amount of feature is proportional to the lines of code.
To understand what is new on the FUSIX operating system we must focus on how Z80 computers were used in the past. Usually, they were used together with assembly code or with a slim operating system written in Assembly for example CP/M or MS-DOS. The idea is, that the software is an addon for the CPU, which is less important. That means, the typical homebrew Z80 computer is delivered without operating system software or with a small Forth interpreter which fits on 1 kb of ROM. The assumption was, that the average doesn't need more. But in reality the reason why this was common has to do with the amount of energy which needs to be invested. Programming a operating system which has a lot of feature is way more complicated then writing a simple BIOS routine in Forth. And to save the time, it wasn't done.
Nowadays, nothing has changed. In spite of the progress in technology it is harder then ever to write an operating system from scratch, especially it should have features like TCP/IP and a GUI.
No comments:
Post a Comment