A trusted execution environment scheduling method for a device comprising a multicore processor , the processor operable to execute a rich execution environment, REE, and a trusted execution environment, TEE, the method comprising: providing a REE global scheduler in the REE, the REE global scheduler operable to schedule threads for execution in the REE; providing a TEE scheduler in the TEE, the TEE scheduler operable to schedule threads for execution in the TEE, wherein the TEE scheduler determines a number of runnable TEE threads which are either presently executing or are awaiting execution in the TEE, and stores the number of runnable TEE threads in a location accessible to threads executing in the REE; providing a plurality of worker threads in the REE, the worker threads being in an activated state or in an deactivated state, wherein when an activated worker thread of the plurality of worker threads is executed according to the schedule of the REE global scheduler the worker thread makes a call to the TEE to cause execution of the TEE on the same core as the worker thread, wherein the worker thread retrieves the number of runnable TEE threads and compares the retrieved number of runnable TEE threads to the number of currently activated worker threads, wherein in response to a determination that the number of runnable TEE threads is greater than the number of currently activated worker threads, the worker thread activates additional worker threads, and wherein in response to a determination that the number of runnable TEE threads is fewer than the number of currently activated worker threads, the worker thread deactivates itself. providing a REE global scheduler in the REE, the REE global scheduler operable to schedule threads for execution in the REE; providing a TEE scheduler in the TEE, the TEE scheduler operable to schedule threads for execution in the TEE, wherein the TEE scheduler determines a number of runnable TEE threads which are either presently executing or are awaiting execution in the TEE, and stores the number of runnable TEE threads in a location accessible to threads executing in the REE; providing a plurality of worker threads in the REE, the worker threads being in an activated state or in an deactivated state, wherein when an activated worker thread of the plurality of worker threads is executed according to the schedule of the REE global scheduler the worker thread makes a call to the TEE to cause execution of the TEE on the same core as the worker thread, wherein the worker thread retrieves the number of runnable TEE threads and compares the retrieved number of runnable TEE threads to the number of currently activated worker threads, wherein in response to a determination that the number of runnable TEE threads is greater than the number of currently activated worker threads, the worker thread activates additional worker threads, and wherein in response to a determination that the number of runnable TEE threads is fewer than the number of currently activated worker threads, the worker thread deactivates itself. wherein when an activated worker thread of the plurality of worker threads is executed according to the schedule of the REE global scheduler the worker thread makes a call to the TEE to cause execution of the TEE on the same core as the worker thread, wherein the worker thread retrieves the number of runnable TEE threads and compares the retrieved number of runnable TEE threads to the number of currently activated worker threads, wherein in response to a determination that the number of runnable TEE threads is greater than the number of currently activated worker threads, the worker thread activates additional worker threads, and wherein in response to a determination that the number of runnable TEE threads is fewer than the number of currently activated worker threads, the worker thread deactivates itself. <EOS>