Dan,
I think you haven't
fully realized, that there is no operating system unless you wrote some. There is no second or third usage of an area of RAM you designate to one program - not because you did use it, but because there is no other program running!
It requires an operation system, a scheduler, a memory manager and more to get into the trouble you envisioned.
Take a C64 or an Apple: there is a ROM containing the reset vector and initial setup code. Then there is a small monitor, allowing to verify/change single memory contents. You can use the monitor to start manually say BASIC. Then BASIC is running - the monitor still resides in ROM but it is not used anymore (perhaps parts of it like character I/O, but then these are subroutines called by BASIC). Usually in these small machines there is just one program operating, having full control, no need to care about other programs.
To have a second program lurking in the background, say a printer spooler (back in that days a common background task) requires careful planning and special ways to set it up correctly. Usually the spooler was started, taking some of the memory (high end) for buffering, and sets a new "memory end" value in a location, that is referenced by BASIC during startup. This was the only protection from double use of that RAM. The spooler then initiates a timer that periodically interrupts
any other program. The spooler checks the buffer do perhaps some printing and then reschedules (return from interrupt) to whatever program was actually running.
What I wish to describe is, that all and evrything that is going on on your machine, is under your control - or at least it should.
For every possible situation you have to prepare your system with adeqaute software. It is (usually) no good idea, to terminate one program, leaving valuable data in RAM, and believe that this data is "later" intact - unless you write an operating system AND cooperative software. Obviously that isn't trivial.
So far OK ?