Patent ID: 8079035

Claim:
A computer-implemented method, comprising: generating, by an operating system (“OS”), a thread to execute under management of the OS, wherein the operation of generating the thread comprises providing a thread environment block (TEB) for the thread; generating, by an application-managed thread unit, a user-level thread (“shred”) to execute under management of the application-managed thread unit, wherein: the application-managed thread unit comprises a user-level application, the operation of generating the shred comprises providing a shred environment block (SEB) for the shred, and the SEB is organized according to an organizational structure of the TEB; maintaining state data for the shred from the SEB across a context switch from the application-managed thread unit to a thread unit that is managed by the OS; using the TEB to register an exception handler for the thread; using the SEB to register an exception handler for the shred; and in response to an exception thrown to the OS from the shred, automatically transferring control from the OS to the exception handler for the shred.