next up previous
Next: Thread Migration Portability Up: Thread Migration Previous: Isomalloc Thread Migration


Memory Aliasing Stacks


Table 1: Portability of current implementations of migratable threads. ``Yes'' means we have implemented this technique. ``Maybe'' indicates there are no theoretical problems, but no existing implementation. ``No'' indicates the technique is impossible on this machine.
Thread X86 IA64 Opteron Mac OS X IBM SP SUN Alpha BG/L Windows
Stack Copy Yes Maybe Yes Maybe Yes Yes Yes Maybe Yes
Isomalloc Yes Yes Yes Yes Yes Yes Yes No Maybe
Memory Alias Yes Yes Yes Yes Yes Yes Yes Maybe Maybe


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.

Figure 3: Memory-aliasing stacks
Image alias

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.


next up previous
Next: Thread Migration Portability Up: Thread Migration Previous: Isomalloc Thread Migration
Gengbin Zheng 2006-03-18