Stories
Slash Boxes
Comments

SoylentNews is people

posted by Fnord666 on Wednesday June 10 2020, @02:57AM   Printer-friendly
from the a-new-OS-is-forth-coming dept.

It appears the leadership of Collapse OS have decided to switch from Z-80 to Forth. In this article, they explain their reasoning.

Collapse OS' first incarnation was written in Z80 assembler. One of the first feedbacks I had after it went viral was "why not Forth?". I briefly looked at it and it didn't seem such a great choice at first, so I first dismissed it. Then, I had what alcoholics refer to as a "Moment of clarity".

[...] The Z80 asm version of Collapse OS self-hosts on a RC2014 with a 5K shell on ROM, a 5K assembler binary loaded in RAM from SD card (but that could be in ROM, that's why I count it as ROM in my project's feature highlights) and 8K of RAM. That is, it can assemble itself from source within those resources.

[...] If I wanted to re-implement that assembler feature-for-feature in Forth, it would probably require much more resources to build. Even though higher level words are more compact, the base of the pyramid to get there couldn't compete with the straight assembler version. This was under this reasoning that I first dismissed Forth.

So, again, what makes Forth more compact than assembler? Simplicity. The particularity of Forth is that it begins "walking by itself", that is, implementing its own words from its base set, very, very early. This means that only a tiny part of it needs to be assembled into native code. This tiny part of native code requires much less tooling, and thus an assembler with much less features. This assembler requires less RAM.

What is more compact than something that doesn't exist? Even Z80 assembler can't beat the void.

That's how although Forth is not more compact that native code (duh!), a Forth Collapse OS achieves self-hosting with as much resources than its Z80 counterpart.


Original Submission

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 0) by Anonymous Coward on Wednesday June 10 2020, @04:30PM (1 child)

    by Anonymous Coward on Wednesday June 10 2020, @04:30PM (#1005859)

    It makes a certain kind of sense, but not much. Most of the consumer-grade equipment will be unusable due to age, EMP, or failed infrastructure, so you could see the knowledge disappear entirely in areas within a generation. Hydro and wind should be mostly unaffected, although installations could be targeted in whatever apocalyptic war caused the collapse. Solar would be unreliable in a nuclear winter situation, if it works at all. Hand-crank and crystal radios, but I've you'll need batteries at least for transmission. I imagine there will be relatively unaffected areas, with stable electrical generation capabilities, but manufacturing may have to be practically bootstrapped from nothing - any area with significant manufacturing capability will be a strategic target.

  • (Score: 1, Interesting) by Anonymous Coward on Wednesday June 10 2020, @09:36PM

    by Anonymous Coward on Wednesday June 10 2020, @09:36PM (#1006003)

    I think the more interesting task for someone preparing for a collapse would be writing a textbook on how to go from smelters and iron ore to Apollo-mission level computers.

    I also think the fact that so much can be done with 8k RAM is an indictment of 21st century society. Capitalism, to its credit, has pushed humanity to make mind-blowing advances in computing technology. But capitalism, to its condemnation, has pushed humanity to a disgracefully low focus on efficiency. I'm not blaming individual engineers, managers, teams, companies, or countries, the problem is just the whole system. Any team that's trying to make a nice application that runs quickly and securely with low resource utilization on twenty year old hardware will be crushed by competitors getting to market ten times as fast with something less than 1% as efficient.