How did UNIX multitasking work without virtual memory? [closed]
Solution 1:
Multitasking and multiprocessing can be accomplished on computers that do not have a memory management unit (MMU) to provide virtual memory. There are many operating systems that support multitasking and/or multiprocessing for processors that do not have an MMU. I don't know when Unix utilized virtual memory.
There are other hardware requirements besides virtual memory that Unix needs to implement its multiprocessing features. Key is the protected or supervisor modes of the CPU, i.e. kernel mode versus user mode.
Are there current Unix systems that don't use virtual memory?
I assume that all modern versions of Unix utilize a MMU.
uClinux is a version of Linux that does not require a MMU and does not use virtual memory. But don't expect the same level of security between processes as with real Linux. It is an OS for embedded devices to run trusted application programs.
Does the C runtime even support that?
The C programming language is not tied to Unix or Linux. Nor does it require virtual memory. C can be used to program 8-bit microcontrollers. A runtime library is specific to a version of an operating system and a compiler. There are versions of the C runtime library for uClinix for processors that do not have a MMU.
Solution 2:
Older versions of Unix multitasked by swapping. When a task reached a blocking point (waiting for a read, eg) it would be swapped out to disk and another task swapped in.
Basically one task at a time could be in memory, and all were mapped to the same set of memory locations.
"Fork" (start new sub-task) was accomplished by simply swapping out the current task, then assigning a new task ID to the task image still in memory and letting it continue running (as the "forked" subtask).
This approach (the original Bell Unix) was simple and worked pretty well on primitive hardware, but Berkley Unix took advantage of memory-mapping hardware in newer processors to enable multiple tasks to be in memory simultaneously, slowly morphing into a full virtual memory scheme.
(I don't know what scheme Linux uses.)