1. A method of executing code performing one or more operations corresponding to scheduling and synchronization primitives, the method comprising: performing, by said code during execution of said code, a call using an application programming interface requesting a first of said operations corresponding to one of said scheduling and synchronization primitives; and determining, during runtime in response to said call, whether to perform said first operation, said determining using a set of one or more criteria indicating conditions as to when said scheduling and synchronization primitives are allowed to be performed, said one or more criteria being determined in accordance with a plurality of different platforms, if said determining determines that said first operation is allowable and said first operation is to be performed, then said code is allowed to be executed on each of said different platforms in a privileged execution mode and a non-privileged execution mode, wherein first code of the application programming interface provides a same set of functionality for both the privileged execution mode and the non-privileged execution mode, said same set of functionality including functionality in connection with a deferred procedure call and an interrupt service routine, wherein the first code of the application programming interface simulates functionality in connection with any of a deferred procedure call executed in the non-privileged execution mode and an interrupt service routine executed in the non-privileged execution mode using threads executed in the non-privileged execution mode.