Thread virtualization techniques
Various technologies and techniques are disclosed for virtualizing threads. An operating system thread is virtualized by intercepting accesses of the operating system thread state and emulating a normal operating system behavior. A kernel mode thread state is virtualized by intercepting kernel accesses of the kernel mode thread state and emulating a normal kernel mode behavior. A user mode thread state is virtualized by intercepting user mode accesses of the user mode thread state and emulating a normal user mode behavior. If the access is a write access, then the write access is applied to a virtual thread structure. If the access is a read access, then the read access is applied to the virtual thread structure.
1 . A computer-readable medium having computer-executable instructions for causing a computer to perform steps comprising:
virtualize an operating system thread by intercepting accesses of the operating system thread state and emulating a normal operating system behavior;
virtualize a kernel mode thread state by intercepting kernel accesses of the kernel mode thread state and emulating a normal kernel mode behavior; and
virtualize a user mode thread state by intercepting user mode accesses of the user mode thread state and emulating a normal user mode behavior.
2 . The computer-readable medium of claim 1 , further having computer-executable instructions for causing a computer to perform steps comprising:
select a kernel thread to run a user thread based on a current virtualized state of the user thread.
3 . The computer-readable medium of claim 1 , further having computer-executable instructions for causing a computer to perform steps comprising:
modify a kernel thread to run a user thread based on a current virtualized state of the user thread.
4 . The computer-readable medium of claim 1 , further having computer-executable instructions for causing a computer to perform steps comprising:
enable a user mode execution context to make use of all system services.
5 . The computer-readable medium of claim 1 , wherein the kernel mode thread state is virtualized by trapping system call entries.
6 . The computer-readable medium of claim 1 , wherein a read of operating system thread state is virtualized by applying the read to a virtual thread structure.
7 . The computer-readable medium of claim 1 , wherein a write of operating system thread state is virtualized by applying the write to a virtual thread structure.
8 . The computer-readable medium of claim 1 , wherein a read of kernel mode thread state is virtualized by selecting a kernel thread block associated with a virtual thread and performing the read from the kernel thread block.
9 . The computer-readable medium of claim 1 , wherein a write of kernel mode thread state is virtualized by selecting a kernel thread block associated with a virtual thread and performing the write from the kernel thread block.
10 . The computer-readable medium of claim 1 , wherein a read of user mode thread state is virtualized by selecting a user thread block associated with a virtual thread and performing the read from the user thread block.
11 . The computer-readable medium of claim 1 , wherein a write of user mode thread state is virtualized by selecting a user thread block associated with a virtual thread and performing the write from the user thread block.
12 . The computer-readable medium of claim 1 , wherein a virtual thread structure is used for the virtualization of the operating system thread state, the kernel mode thread state, and the user mode thread state.
13 . The computer-readable medium of claim 12 , wherein the virtual thread structure uses user mode execution when possible.
14 . A method for virtualizing an operating system thread comprising the steps of:
intercepting an access of operating system thread state;
if the access is a write access, then applying the write access to a virtual thread structure; and
if the access is a read access, then applying the read access to the virtual thread structure.
15 . The method of claim 14 , wherein the virtual thread structure uses user mode execution when possible.
16 . A computer-readable medium having computer-executable instructions for causing a computer to perform the steps recited in claim 14 .
17 . A method for virtualizing a thread state comprising the steps of:
intercepting an access to thread state; and
selecting a thread block associated with a virtual thread and performing the intercepted access using the thread block.
18 . The method of claim 17 , wherein the access is a kernel access to kernel mode thread state, and wherein the thread block is a kernel thread block.
19 . The method of claim 17 , wherein the thread state is user mode thread state, and wherein the thread block is a user mode thread block.
20 . A computer-readable medium having computer-executable instructions for causing a computer to perform the steps recited in claim 17 .