This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Earliest Deadline Scheduling

Hi all, I am trying to implement Earliest deadline scheduling algorithm using MCBSTR9 board using RTX kernel. Can anybody tell me how to calculate the deadline of the current executing task when another task comes into active state for assigning the priorities of the tasks according to the deadline?

Thanks and regards
S.Pradeep

  • Yes. The deadline of the currently executing task is identical to its deadline when it started running. The deadline is the "time" that the task needs to be completed by and this does not change not matter how long the task runs (that is until the task completes and no longer has a deadline)

  • Hi, Thanks for the reply. But still I have certain queries. I think it would be appropriate with an example.

    Let me assume I have 2 tasks A and B with A having a deadline of 40ms and B with a deadline of 50 ms.
    Their execution time be 20 and 30 ms respectively.

    Initialy Task A will have a higher priority as deadline is 40ms and starts executing. After 20 ms it finishes execution and Task B starts execution.

    However at 40ms Task A becomes active again and will have a deadline of 40ms .

    B would have already executed for 20ms duration by this time and its deadline will come at 30ms from this point.

    Now A has its deadline arriving at 40ms at this point and B has its deadline coming at 30 ms from this point.

    According to Earliest Deadline First scheduling B should have an higher priority now than A as its deadline is coming soon.

    For making a decision at to change the priorities I need to calculate the time period for which the Task B has executed when Task A becomes active the second time.

    I am not able to understand how to calculate the time for which the Task B has executed when A becomes active the second time.

    Please let me know how to calculate this.

    Thanks and regards,
    S.Pradeep

  • I would use absolute times for deadlines. All tasks are assigned an absolute deadline when they enter the system. If a task takes 40ms to complete its "deadline" is the current time plus 40ms (current time as of entering the systme). This tasks deadline is ALWAYS that original "current time" plus 40ms, not matter how long it has run.

  • Sorry for using the term "complete" instead of deadline.

    All tasks should calculate their absolute deadline time when they enter the system. The task with the lowest deadline time is the task that should be running. A tasks absolute deadline will never change, not matter how long it has been running.