non-preemptive scheduling with Erika

Forum related to ERIKA Enterprise and RT-Druid version 2

Moderator: paolo.gai

Post Reply
Esposito
Newbie
Posts: 4
Joined: Wed May 27, 2009 8:44 am

non-preemptive scheduling with Erika

Post by Esposito » Wed May 27, 2009 8:50 am

Hi All,

I\'m Francesco Esposito and I\'m new in this community. I need a fixed priority scheduler and a non preemptive task set. I\'m working on ARM7 platform and I cannot use OIL support because I\'m developing my application with a linux host and the RT-druid support is not still available for my environment. This means that I have to configure my Erika App directly using eecfg.c, eecfg.h and makefile. I need support about the correctness of the configuration below:

I have 2 task:

thread0 (high priority task - non preemptive)
thread1 (low priority task - non preemptive)

Those are my configuration inside eecfg.c:

DeclareTask(thread0);
DeclareTask(thread1);

const EE_ADDR EE_hal_thread_body[EE_MAX_TASK] = {
(EE_ADDR)Functhread0, /* thread thread0 */
(EE_ADDR)Functhread1, /* thread thread1 */
};

const EE_TYPEPRIO EE_th_ready_prio[EE_MAX_TASK] = {
0x2, /* thread thread0 - High priority */
0x1, /* thread thread1 - low priority */
};

/* dispatch priority */
const EE_TYPEPRIO EE_th_dispatch_prio[EE_MAX_TASK] = {
0x2, /* thread thread0 - non preemptive */
0x2, /* thread thread1 - non preemptive */
};

Thanks in advance.

Francesco

Esposito
Newbie
Posts: 4
Joined: Wed May 27, 2009 8:44 am

Re:non-preemptive scheduling with Erika

Post by Esposito » Thu May 28, 2009 9:41 am

Hi All,

the problem has been addressed. Actually a demo for ARM7TDMI (MPARM simulator mantained by University of Bologna) is available with those features:

OSEK conformance class: BCC1
task-set: 2 non-preemptive tasks

Bye

Francesco

paolo.gai
Administrator
Posts: 875
Joined: Thu Dec 07, 2006 12:11 pm

Re:non-preemptive scheduling with Erika

Post by paolo.gai » Fri May 29, 2009 9:59 am

Hi Francesco,

As you discover, your data is ok. the dispatch priority in general should be higher than the ready priority. both are bit masks.

Putting the dispatch priority = max priority in the ystem makes a task non-preemptive.

Then, to insert a preemption point, use the Schedule() primitive.

The \"pic20/Flex demo board/OO/Task\" example gives you exactly this example,with the usage of the Schedule primitive!

Ciao,

PJ

Esposito
Newbie
Posts: 4
Joined: Wed May 27, 2009 8:44 am

Re:non-preemptive scheduling with Erika

Post by Esposito » Thu Jun 04, 2009 10:11 am

Hi All, now I have another question,

If I have a task set composed by 2 fully preemptive tasks:

task1, prio: 1, disp prio: 1;
task2, prio: 2. disp prio: 2;


and I\'d like the first task (task1 only - lower prio) as non-preemptive task while task2 is not important. If I modify their dispatch priority in this way:

(TASK SET 1)
task1, prio: 1, disp prio: 2;
task2, prio: 2. disp prio: 1;

Could this scenario cause a problem or unpredictable behaviour of my task set?

I\'m conscious that this scenario cannot happen because RT-Druid prevents that. If I need only the lower priority task as non-preemptive task RT-druid create a task set like this:

(TASK SET 2)
task1, prio: 1, disp prio: 2;
task2, prio: 2. disp prio: 2;

But I\'m working with ARM architecture and I have no support from RT-Druid, I need to create my task set manually, so I need to know the exact behaviour of Erika.

In my opinion the answer of the question is NO, the behaviour of TASK SET 1 and 2 should be the same because task1 is non-preemptive in both cases while task2 (in the TASK SET 1) no. But in any case task2 can never be preempted because it is the higher priority task, so Its behaviour is the same in both cases.

Can you confirm that the TASK SET 1 and 2 have the same behaviour?

Thank you in advance.

Francesco

paolo.gai
Administrator
Posts: 875
Joined: Thu Dec 07, 2006 12:11 pm

Re:non-preemptive scheduling with Erika

Post by paolo.gai » Thu Jun 04, 2009 12:59 pm

Hi Francesco,

the rules are:
- priorities must be mapped to bit masks, such as 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, and so on...

- dispatch priority must be equal or greater than the ready priority.

- if dispatch priority is

Post Reply