As a complement to the isomalloc approach, we have designed and implemented an alternative implementation that uses much less virtual address space, and so can scale on large 32-bit machines. The idea is simple: accelerate stack-copying threads by simulating the copy using the virtual memory hardware. Like stack-copying threads, in this approach all stacks are executed from the same address. However, to switch in a new thread, we simply map the new thread's stack onto the pages at the stack address by calling mmap, rather than actually copying the stack data. That is, each thread's data is stored in separate pages of physical memory. To run a thread, we first map the thread's data into the common virtual address space with a memory mapping call as shown in Figure 3, then execute the thread.
The advantage of this approach is that only one stack-size of virtual address space is used, which allows this technique to be used even on machines with very limited address space. However, since each context switch involves an extra mmap system call, the performance of memory aliasing stacks is not as good as that of the isomalloc-based threads. However, because no data is actually copied, the performance of memory aliasing stacks is much better than the stack-copying threads. Like the stack copying threads, this technique has the same disadvantage that only one thread is allowed to be active in each address space. Section 4.2 compares the performance of these three thread migration techniques.