Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How did UNIX multitasking work without virtual memory? Wouldn't applications still need their own memory space? Or did applications have to know that now all visible memory spaced is theirs?

(Note to avoid confusion: By "virtual memory" I mean virtualised memory, NOT the swap file.)

share|improve this question

closed as not a real question by Linker3000, Ƭᴇcʜιᴇ007, random Aug 11 '11 at 13:48

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

"how did"? or perhaps "how does", or "how can"? – Doc Aug 10 '11 at 19:23
Are there current Unix systems that don't use virtual memory? Does the C runtime even support that? – Andrew J. Brehm Aug 10 '11 at 20:04
@Andrew some VERY limited embedded systems run without vm (more precisely without an MMU), see for example uCLinux. However, non-mmu systems are not POSIX compliant so I guess you could say they are technically not a Unix... – crasic Aug 11 '11 at 2:45
And to clarify, the OS emulates an MMU in software, giving the illusion of virtual addresses without hardware support. – crasic Aug 11 '11 at 2:52
@crasic - uClinux does not use virtual memory. See – sawdust Aug 11 '11 at 3:43
up vote 2 down vote accepted

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.

share|improve this answer
To be clear, having the MMU in hardware is a relatively recent innovation (on the unix time-scale). There is nothing stopping you from having the OS do the address translation (albeit it will be much slower than a hardware solution). Although you are correct that this would still require the cpu to support execution modes. – crasic Aug 11 '11 at 2:56
When I said "the C runtime" I meant the one(s) used by Unix (and clones). – Andrew J. Brehm Aug 11 '11 at 8:42

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.)

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.