Virtualization of a system call

Notes:

The ptracing of all the other threads by the tracing thread is what makes UML possible. This diagram shows the process by which the tracing thread virtualizes a system call.
First, the process executes the system call instruction. This puts it in the kernel, which wakes up the tracing thread. The tracing thread annuls the system call, saves the process state, and imposes some state on the process which puts it on the kernel stack executing the system call handler.
The process executes the system call and signals itself when it is done. This signal wakes up the tracing thread again, which restores the saved process state, sets the system call return value, and continues the process. The process now continues from the system call exactly as it would in a native kernel.
The red arrows show the activities of the process. These are completely analogous to the system call path in a native kernel.