A method for executing a Hard Real-Time task in a multithreaded processor having a plurality of hardware shared resources, the method comprising the steps of: a. Determining the slack time of the HRT task and set it as the remaining slack time comprising the substeps of: a1. Obtaining the Worst Case Execution Time (WCET) of the HRT task; a2. Obtaining the deadline of the HRT task; a3. Subtracting the obtained WCET from the obtained deadline of the HRT task; b. Starting the execution of the HRT task; c. Every time the HRT task is going to use a hardware shared resource, verifying by a module of the hardware shared resource if the resource is being used by at least one Non Hard Real-Time (NHRT) task; In case of the resource not being used by one or more NHRT tasks, h. continuing the execution of the HRT task; and In case of the resource being used by at least one NHRT task, d. Determining the delay caused by the NHRT task; e. Subtracting the determined delay from the remaining slack time of the HRT task on the execution time of the HRT task; f. Verifying if the new value of the remaining slack time is lower than a critical threshold; In case of the remaining slack time not being lower than a critical threshold, h. continuing the execution of the HRT task; and In case of the remaining slack time being lower than a critical threshold, g. Stopping the NHRT tasks; and h. Continuing the execution of the HRT task. a. Determining the slack time of the HRT task and set it as the remaining slack time comprising the substeps of: a1. Obtaining the Worst Case Execution Time (WCET) of the HRT task; a2. Obtaining the deadline of the HRT task; a3. Subtracting the obtained WCET from the obtained deadline of the HRT task; a1. Obtaining the Worst Case Execution Time (WCET) of the HRT task; a2. Obtaining the deadline of the HRT task; a3. Subtracting the obtained WCET from the obtained deadline of the HRT task; b. Starting the execution of the HRT task; c. Every time the HRT task is going to use a hardware shared resource, verifying by a module of the hardware shared resource if the resource is being used by at least one Non Hard Real-Time (NHRT) task; In case of the resource not being used by one or more NHRT tasks, h. continuing the execution of the HRT task; and In case of the resource being used by at least one NHRT task, d. Determining the delay caused by the NHRT task; e. Subtracting the determined delay from the remaining slack time of the HRT task on the execution time of the HRT task; f. Verifying if the new value of the remaining slack time is lower than a critical threshold; In case of the remaining slack time not being lower than a critical threshold, h. continuing the execution of the HRT task; and In case of the remaining slack time being lower than a critical threshold, g. Stopping the NHRT tasks; and h. Continuing the execution of the HRT task. d. Determining the delay caused by the NHRT task; e. Subtracting the determined delay from the remaining slack time of the HRT task on the execution time of the HRT task; f. Verifying if the new value of the remaining slack time is lower than a critical threshold; In case of the remaining slack time not being lower than a critical threshold, h. continuing the execution of the HRT task; and In case of the remaining slack time being lower than a critical threshold, g. Stopping the NHRT tasks; and h. Continuing the execution of the HRT task. g. Stopping the NHRT tasks; and h. Continuing the execution of the HRT task.