This article is from the Mac Programming FAQ, by Jon Watte email@example.com with numerous contributions by others.
Write better software!
Or install The Debugger from Jasik Designs, which can provide your
application with write-protection of critical parts of memory, if you have
a 68030-equipped Mac.
Making the Mac OS memory-protected is tricky, because applications expect
to be able to write to low memory, the system heap, temporary memory,
window lists, and even each other's heaps in some interapplication
communication solutions that date back to before AppleEvents and the PPC
Toolbox. To add to the burden, Apple's own software tends to be the
worst offender in these cases.
But fear not, Mac fans! Jonathan Kimmitt has written Patmos, the
"Protected address translation mode operating system". It is an
application that brings the advantages of protected mode programs to
your Quadra class Macintosh by the simple expedient of taking over the
memory management unit of the 68040 in a very simple kernel (<100K in
size), we immediately gain compatibility with the BSD unix program
environment. The advantages of this are as follows:
(a) You can run certain programs (such as /bin/sh) designed for MacBSD
(b) You can compile almost all GNU software including C and C++ without.
modifying the source code in any way
(c) All programs run with a flat 32-meg address space, with no worries
about 32K segments or the other mac paraphernalia.
(d) The majority of program bugs can be caught cleanly without crashing
(e) All your files are shared between Patmos and MacOS so you can edit
using your favourite mac editor, then immediately compile in Patmos
without having to reboot or copy files around.
The downside is that not all macs use the memory management unit in the
same way, or even have the same kind of MMU, so Patmos may not run on
your particular mac model. However, since the kernel source code is
very small, the task of adapting it to a new environment is very simple,
and once achieved, all application programs running in user mode are
enabled to run without even recompiling.
<ftp://nic.switch.ch in /software/mac/src/patmos>