Follow

Not sure anyone can answer that, but Knuth wrote TeX as a single ~1MB file in the early 80s... how did editors back in the day cope with that? Even when the file wasn't loaded into memory completely, it must have been rewritten on disk constantly?

@aza_leah old editors did not read the entire file into memory. That wouldn't have worked, for pretty obvious reasons.

@aza_leah

Speculating here, but paged virtual memory was a thing from the early seventies on so whatever host OS you used probably demand-loaded parts of the executable and swapped out data as needed.

Also, the computers TeX ran on were owned by institutions so they likely had multiple megabytes of RAM already.

Also also: TeX wasn't stabilized until 1989 (according to Wikipedia) so it's likely that a site's TeX was hacked up to suit it.

@aza_leah

FWIW, when I first used it in the early '90s, it was a non-issue. I edited in vi or emacs, shelled out to run tex and viewed the result with xdvi. If anything, emacs was the memory hog of that workflow (at least according to the vi fans I knew.)

@suetanvil Yes, but you also needed a file system to replace pages (you can only do that on Unix if the size didn't change). Apparently SAIL could do this.

@aza_leah

I'm not clear what you mean.

Unix (as long as I've used it) treats code (plus related data--the contents of the executable, basically, aka the text segment) as immutable and separate from process data (the stack and heap).

So if you run 8 concurrent TeX processes, there's 8 different stacks and heaps but only one copy of the executable itself in RAM. This is read-only; the disk file never gets modified.

Data swap is a separate thing from this. It gets written elsewhere.

@aza_leah

Plus, of course, the OS will demand-load parts of the program from the executable as needed.

(This is why you can crash a running program by recompiling its executable.)

This is more or less the same way it moves data between swap except it never writes it ('cuz the executable is immutable.)

@suetanvil I'm talking about changing something in the middle of a big file; on Unix, you need to rewrite the whole end.

@aza_leah

That's incorrect. Unix will let you modify a file in place if you open it with the O_RDRW flag (or "r+" if you're using fopen).

See:

freebsd.org/cgi/man.cgi?query=

(Unfortunately, I couldn't find a classic Unix manpage for this but it's not a new thing. It's definitely been part of Unix for as long as I've used it and I'm 99% sure it was there at the beginning.)

@aza_leah

So I found your blogpost on this via Metafilter and I realize now I completely misunderstood your question. So apologies for adding noise to the conversation. I hope I wasn't too annoying.

Sign in to participate in the conversation
Mastodon

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!