2 ms·
Back in the 1970's, I was fascinated by the (now famous) ADVENT game and how it worked, so I studied the Fortran source code. When started up, it would do all
by WalterBright 8y ago
Back in the 1970's, I was fascinated by the (now famous) ADVENT game and how it worked, so I studied the Fortran source code.
When started up, it would do all kinds of slow (at the time) initialization of its data structures. Then the genius move kicked in - it saved the memory image to disk as the executable file! Next time it ran, it was already initialized and started up instantly. It blew my mind.
I liked the idea so much, that years later when I worked on the text editor I use (MicroEmacs), I did the user configuration the same way. Just change the global variables, then patch the executable file on the disk with the changed values. It was so, so much simpler than defining a configuration file, serializing the data, writing/reading the file, and deserializing it. It worked especially great on floppy disk systems, which were incredibly slow.
But then came viruses, malware, etc. Patching the exe file became a huge "malware alert", and besides, Microsoft would mark the executable as "read only" while it was running. Too bad.
- wging 8y agoGNU Emacs does a similar-sounding trick in its build process (called 'dumping' / 'unexec'), but not at runtime. https://lwn.net/Articles/707615/ https://lwn.net/Articles/707615/ Come to think of it, I think there are applications to my own work... I'd have to be careful, though.
- caf 8y agoIf you're looking at implementing something along those lines these days, take a look at CRIU: https://www.criu.org/Main_Page https://www.criu.org/Main_Page
- nicoburns 8y agoIt seems like someone should come up with an "executable+data storage" file format (where virus scanners can know to only check changes in the executable section) Maybe they can make one that is supported cross platform while they're at it...