public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Re: how to implement EDF scheduling in eCos
@ 2010-01-08  8:35 Nodir Kodirov
  2010-01-08  8:39 ` Nodir Kodirov
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Nodir Kodirov @ 2010-01-08  8:35 UTC (permalink / raw)
  To: ecos-discuss

Hello all,

I am going to implement EDF (Earliest Deadline First) scheduling
algorithm in eCos. I had a survey of mailing list and I found very
useful tips here
http://sourceware.org/ml/ecos-discuss/2005-10/msg00209.html and here
http://sourceware.org/ml/ecos-discuss/2005-11/msg00059.html. However,
I did not find any evidence about successful completion of
implementation.

My approach is adding two more additional fields to thread's
properties. Those are:
cyg_tick_count_t wcet /*worst case execution time*/
cyg_tick_count_t deadline /* absolute deadline thread to be finished */

Currently, I don't need TCP/IP and I don't use POSIX. It has been 5
years, since these question was aroused. So, my question to those
people who has already tried implementation is: do you see any errors
in my approach?

Regards,
Nodir.

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ECOS] Re: how to implement EDF scheduling in eCos
  2010-01-08  8:35 [ECOS] Re: how to implement EDF scheduling in eCos Nodir Kodirov
@ 2010-01-08  8:39 ` Nodir Kodirov
  2010-01-14  5:35 ` Nodir Kodirov
  2010-01-14  6:50 ` Fabian Scheler
  2 siblings, 0 replies; 7+ messages in thread
From: Nodir Kodirov @ 2010-01-08  8:39 UTC (permalink / raw)
  To: ecos-discuss

Sorry, my question was continuation to the topic here
http://sourceware.org/ml/ecos-discuss/2005-10/msg00159.html

2010/1/8 Nodir Kodirov <nodir.qodirov@gmail.com>:
> Hello all,
>
> I am going to implement EDF (Earliest Deadline First) scheduling
> algorithm in eCos. I had a survey of mailing list and I found very
> useful tips here
> http://sourceware.org/ml/ecos-discuss/2005-10/msg00209.html and here
> http://sourceware.org/ml/ecos-discuss/2005-11/msg00059.html. However,
> I did not find any evidence about successful completion of
> implementation.
>
> My approach is adding two more additional fields to thread's
> properties. Those are:
> cyg_tick_count_t wcet /*worst case execution time*/
> cyg_tick_count_t deadline /* absolute deadline thread to be finished */
>
> Currently, I don't need TCP/IP and I don't use POSIX. It has been 5
> years, since these question was aroused. So, my question to those
> people who has already tried implementation is: do you see any errors
> in my approach?
>
> Regards,
> Nodir.
>

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ECOS] Re: how to implement EDF scheduling in eCos
  2010-01-08  8:35 [ECOS] Re: how to implement EDF scheduling in eCos Nodir Kodirov
  2010-01-08  8:39 ` Nodir Kodirov
@ 2010-01-14  5:35 ` Nodir Kodirov
  2010-01-14  6:48   ` Fabian Scheler
  2010-01-14  6:50 ` Fabian Scheler
  2 siblings, 1 reply; 7+ messages in thread
From: Nodir Kodirov @ 2010-01-14  5:35 UTC (permalink / raw)
  To: ecos-discuss

[-- Attachment #1: Type: text/plain, Size: 2135 bytes --]

Hello all!

I started EDF implementation to eCos. I did basic works for it, such
as adding scheduler to eCosConfigTool, extending thread's structure
with properties needed for EDF (deadline, period and wcet), and
creating EDF scheduler files (edf.hxx and edf.cxx) in kernel folder
structure. I was able to build eCos library target from modified eCos
repository. But, I have problem with my application.

When I "make" my application (which creates eCos threads with extended
deadline, period and wcet) it gives me compile errors. Here is excerpt
of common error and full error and my application code you can find in
attached files.

> /my_dev/ecos_edf_rep/ecos-3.0/packages/kernel/v3_0/src/common/thread.cxx:7
> 68: undefined reference to `Cyg_Scheduler_Implementation::rem_thread (Cyg_Thread*)'
> /my_dev/ecos_edf/install/lib/libtarget.a (kernel_thread.o): In function `Cyg_Thread':
> /my_dev/ecos_edf_rep/ecos-3.0/packages/kernel/v3_0/src/common/thread.cxx:2
> 19: undefined reference to `Cyg_Scheduler_Implementation::register_thread (Cyg_Thread*)'
> ...

Last two days I am struggling with them, if you have some idea to fix
it, please let me know.
Regards,
Nodir.

2010/1/8 Nodir Kodirov <nodir.qodirov@gmail.com>
>
> Hello all,
>
> I am going to implement EDF (Earliest Deadline First) scheduling
> algorithm in eCos. I had a survey of mailing list and I found very
> useful tips here
> http://sourceware.org/ml/ecos-discuss/2005-10/msg00209.html and here
> http://sourceware.org/ml/ecos-discuss/2005-11/msg00059.html. However,
> I did not find any evidence about successful completion of
> implementation.
>
> My approach is adding two more additional fields to thread's
> properties. Those are:
> cyg_tick_count_t wcet /*worst case execution time*/
> cyg_tick_count_t deadline /* absolute deadline thread to be finished */
>
> Currently, I don't need TCP/IP and I don't use POSIX. It has been 5
> years, since these question was aroused. So, my question to those
> people who has already tried implementation is: do you see any errors
> in my approach?
>
> Regards,
> Nodir.

[-- Attachment #2: compile error.txt --]
[-- Type: text/plain, Size: 7973 bytes --]

$ make
i386-elf-gcc -c -I/my_dev/ecos_edf/install/include -I/opt/ecos/gnutools/i386-elf/i386-elf/include sixthreads.c -Wall -Wpointer-arith -Wstrict-prototypes -Wundef -Woverloaded-virtual -Wno-write-strings -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions sixthreads.c
cc1: warning: command line option "-Woverloaded-virtual" is valid for C++/ObjC++ but not for C
cc1: warning: command line option "-fno-rtti" is valid for C++/ObjC++ but not for C
cc1: warning: command line option "-Woverloaded-virtual" is valid for C++/ObjC++ but not for C
cc1: warning: command line option "-fno-rtti" is valid for C++/ObjC++ but not for C
i386-elf-gcc -I/my_dev/ecos_edf/install/include -I/opt/ecos/gnutools/i386-elf/i386-elf/include -nostartfiles -L/my_dev/ecos_edf/install/lib -Ttarget.ld -g -nostdlib -Wl,--gc-sections -Wl,-static -o sixthreads sixthreads.o
/my_dev/ecos_edf/install/lib/libtarget.a(kernel_thread.o): In function `Cyg_Thread::exit()':
/my_dev/ecos_edf_rep/ecos-3.0/packages/kernel/v3_0/src/common/thread.cxx:768: undefined reference to `Cyg_Scheduler_Implementation::rem_thread(Cyg_Thread*)'
/my_dev/ecos_edf/install/lib/libtarget.a(kernel_thread.o): In function `Cyg_Thread':
/my_dev/ecos_edf_rep/ecos-3.0/packages/kernel/v3_0/src/common/thread.cxx:219: undefined reference to `Cyg_Scheduler_Implementation::register_thread(Cyg_Thread*)'
/my_dev/ecos_edf/install/lib/libtarget.a(kernel_thread.o): In function `Cyg_Thread::reinitialize()':
/my_dev/ecos_edf_rep/ecos-3.0/packages/kernel/v3_0/src/common/thread.cxx:249: undefined reference to `Cyg_Scheduler_Implementation::deregister_thread(Cyg_Thread*)'
/my_dev/ecos_edf/install/lib/libtarget.a(kernel_thread.o): In function `Cyg_Thread::suspend()':
/my_dev/ecos_edf_rep/ecos-3.0/packages/kernel/v3_0/src/common/thread.cxx:578: undefined reference to `Cyg_Scheduler_Implementation::rem_thread(Cyg_Thread*)'
/my_dev/ecos_edf/install/lib/libtarget.a(kernel_thread.o): In function `Cyg_Thread::sleep()':
/my_dev/ecos_edf_rep/ecos-3.0/packages/kernel/v3_0/src/common/thread.cxx:349: undefined reference to `Cyg_Scheduler_Implementation::rem_thread(Cyg_Thread*)'
/my_dev/ecos_edf/install/lib/libtarget.a(kernel_thread.o): In function `Cyg_Thread::resume()':
/my_dev/ecos_edf_rep/ecos-3.0/packages/kernel/v3_0/src/common/thread.cxx:617: undefined reference to `Cyg_Scheduler_Implementation::add_thread(Cyg_Thread*)'
/my_dev/ecos_edf/install/lib/libtarget.a(kernel_thread.o): In function `Cyg_ThreadQueue::remove(Cyg_Thread*)':
/my_dev/ecos_edf/install/include/cyg/kernel/thread.inl:623: undefined reference to `Cyg_ThreadQueue_Implementation::remove(Cyg_Thread*)'
/my_dev/ecos_edf/install/lib/libtarget.a(kernel_thread.o): In function `Cyg_Thread::wake()':
/my_dev/ecos_edf_rep/ecos-3.0/packages/kernel/v3_0/src/common/thread.cxx:383: undefined reference to `Cyg_Scheduler_Implementation::add_thread(Cyg_Thread*)'
/my_dev/ecos_edf/install/lib/libtarget.a(kernel_thread.o): In function `~Cyg_Thread':
/my_dev/ecos_edf_rep/ecos-3.0/packages/kernel/v3_0/src/common/thread.cxx:276: undefined reference to `Cyg_Scheduler_Implementation::deregister_thread(Cyg_Thread*)'
/my_dev/ecos_edf_rep/ecos-3.0/packages/kernel/v3_0/src/common/thread.cxx:276: undefined reference to `Cyg_Scheduler_Implementation::deregister_thread(Cyg_Thread*)'
/my_dev/ecos_edf/install/lib/libtarget.a(kernel_thread.o): In function `Cyg_Thread':
/my_dev/ecos_edf_rep/ecos-3.0/packages/kernel/v3_0/src/common/thread.cxx:219: undefined reference to `Cyg_Scheduler_Implementation::register_thread(Cyg_Thread*)'
/my_dev/ecos_edf/install/lib/libtarget.a(kernel_thread.o): In function `Cyg_IdleThread':
/my_dev/ecos_edf_rep/ecos-3.0/packages/kernel/v3_0/src/common/thread.cxx:1279: undefined reference to `Cyg_Scheduler_Implementation::set_idle_thread(Cyg_Thread*, unsigned int)'
/my_dev/ecos_edf/install/lib/libtarget.a(kernel_sched.o): In function `Cyg_Scheduler':
/my_dev/ecos_edf/install/include/cyg/kernel/sched.hxx:147: undefined reference to `Cyg_Scheduler_Implementation::Cyg_Scheduler_Implementation()'
/my_dev/ecos_edf/install/lib/libtarget.a(kernel_sched.o): In function `Cyg_SchedThread':
/my_dev/ecos_edf_rep/ecos-3.0/packages/kernel/v3_0/src/sched/sched.cxx:484: undefined reference to `Cyg_SchedThread_Implementation::Cyg_SchedThread_Implementation(unsigned int)'
/my_dev/ecos_edf/install/lib/libtarget.a(kernel_sched.o): In function `Cyg_Scheduler::start_cpu()':
/my_dev/ecos_edf_rep/ecos-3.0/packages/kernel/v3_0/src/sched/sched.cxx:385: undefined reference to `Cyg_Scheduler_Implementation::schedule()'
/my_dev/ecos_edf/install/lib/libtarget.a(kernel_sched.o): In function `Cyg_Scheduler::unlock_inner(unsigned int)':
/my_dev/ecos_edf_rep/ecos-3.0/packages/kernel/v3_0/src/sched/sched.cxx:184: undefined reference to `Cyg_Scheduler_Implementation::schedule()'
/my_dev/ecos_edf/install/lib/libtarget.a(kernel_sched.o): In function `Cyg_SchedThread_Implementation::timeslice_save()':
/my_dev/ecos_edf/install/include/cyg/kernel/edf.hxx:312: undefined reference to `Cyg_Scheduler_Implementation::timeslice_count'
/my_dev/ecos_edf/install/lib/libtarget.a(kernel_sched.o): In function `Cyg_SchedThread_Implementation::timeslice_restore()':
/my_dev/ecos_edf/install/include/cyg/kernel/edf.hxx:317: undefined reference to `Cyg_Scheduler_Implementation::timeslice_count'
/my_dev/ecos_edf/install/include/cyg/kernel/edf.hxx:317: undefined reference to `Cyg_Scheduler_Implementation::timeslice_count'
/my_dev/ecos_edf/install/lib/libtarget.a(kernel_mutex.o): In function `Cyg_ThreadQueue::enqueue(Cyg_Thread*)':
/my_dev/ecos_edf/install/include/cyg/kernel/thread.inl:602: undefined reference to `Cyg_ThreadQueue_Implementation::enqueue(Cyg_Thread*)'
/my_dev/ecos_edf/install/lib/libtarget.a(kernel_mutex.o): In function `Cyg_ThreadQueue::dequeue()':
/my_dev/ecos_edf/install/include/cyg/kernel/thread.inl:616: undefined reference to `Cyg_ThreadQueue_Implementation::dequeue()'
/my_dev/ecos_edf/install/include/cyg/kernel/thread.inl:616: undefined reference to `Cyg_ThreadQueue_Implementation::dequeue()'
/my_dev/ecos_edf/install/lib/libtarget.a(kernel_mutex.o): In function `Cyg_ThreadQueue::enqueue(Cyg_Thread*)':
/my_dev/ecos_edf/install/include/cyg/kernel/thread.inl:602: undefined reference to `Cyg_ThreadQueue_Implementation::enqueue(Cyg_Thread*)'
/my_dev/ecos_edf/install/lib/libtarget.a(kernel_clock.o): In function `Cyg_RealTimeClock::dsr(unsigned int, unsigned int, unsigned int)':
/my_dev/ecos_edf_rep/ecos-3.0/packages/kernel/v3_0/src/common/clock.cxx:930: undefined reference to `Cyg_Scheduler_Implementation::timeslice()'
/my_dev/ecos_edf/install/lib/libtarget.a(services_memalloc_common_malloc.o): In function `Cyg_ThreadQueue::dequeue()':
/my_dev/ecos_edf/install/include/cyg/kernel/thread.inl:616: undefined reference to `Cyg_ThreadQueue_Implementation::dequeue()'
/my_dev/ecos_edf/install/lib/libtarget.a(services_memalloc_common_malloc.o): In function `Cyg_ThreadQueue::enqueue(Cyg_Thread*)':
/my_dev/ecos_edf/install/include/cyg/kernel/thread.inl:602: undefined reference to `Cyg_ThreadQueue_Implementation::enqueue(Cyg_Thread*)'
/my_dev/ecos_edf/install/lib/libtarget.a(services_memalloc_common_malloc.o): In function `Cyg_ThreadQueue::dequeue()':
/my_dev/ecos_edf/install/include/cyg/kernel/thread.inl:616: undefined reference to `Cyg_ThreadQueue_Implementation::dequeue()'
/my_dev/ecos_edf/install/lib/libtarget.a(services_memalloc_common_malloc.o): In function `Cyg_ThreadQueue::enqueue(Cyg_Thread*)':
/my_dev/ecos_edf/install/include/cyg/kernel/thread.inl:602: undefined reference to `Cyg_ThreadQueue_Implementation::enqueue(Cyg_Thread*)'
/my_dev/ecos_edf/install/lib/libtarget.a(services_memalloc_common_heaps.o): In function `Cyg_ThreadQueue::dequeue()':
/my_dev/ecos_edf/install/include/cyg/kernel/thread.inl:616: undefined reference to `Cyg_ThreadQueue_Implementation::dequeue()'
collect2: ld returned 1 exit status
make: *** [all] Error 1

[-- Attachment #3: twothreads.c --]
[-- Type: application/octet-stream, Size: 2277 bytes --]

#include <cyg/kernel/kapi.h>

#include <stdio.h>
#include <math.h>
#include <stdlib.h>

/* now declare (and allocate space for) some kernel objects,
   like the six threads we will use */
cyg_thread thread_s[2];		/* space for two thread objects */

char stack[2][4096];		/* space for two 4K stacks */

/* now the handles for the threads */
cyg_handle_t simple_threadA, simple_threadB;

/* and now variables for the procedure which is the thread */
cyg_thread_entry_t simple_program;

/* and now a mutex to protect calls to the C library */
cyg_mutex_t cliblock;

/* we install our own startup routine which sets up threads */
void cyg_user_start(void)
{
	printf("After thread extension with EDF data structure\n");
	printf("and with underlying file support (edf.cxx, edf.hxx)\n");
	printf("Running with EDF scheduler\n");
	printf("Entering twothreads' cyg_user_start() function\n");
	
	cyg_mutex_init(&cliblock);
	
	cyg_thread_create(4, simple_program, (cyg_addrword_t) 0,
		"Thread A", (void *) stack[0], 4096,
		 &simple_threadA, &thread_s[0],
		0, 0, 0);
	cyg_thread_create(4, simple_program, (cyg_addrword_t) 1,
		"Thread B", (void *) stack[1], 4096,
		&simple_threadB, &thread_s[1],
		0, 0, 0);
		
	cyg_thread_resume(simple_threadA);
	cyg_thread_resume(simple_threadB);
}

/* this is a simple program which runs in a thread */
void simple_program(cyg_addrword_t data)
{
	int message = (int) data;
	int delay;
	
	printf("Beginning execution; thread data is %d\n", message);
	
	cyg_thread_delay(200);
	cyg_thread_info info;
	cyg_handle_t cur_thread;
	
	for (;;) {
		delay = 400 + (rand() % 50);
		cur_thread = cyg_thread_self();
		/* note: printf() must be protected by a
			call to cyg_mutex_lock() */
		cyg_mutex_lock(&cliblock); {
			printf("Thread %d: and now a delay of %d clock ticks\n",
				message, delay);
			cyg_thread_get_info(cur_thread, cyg_thread_get_id( cyg_thread_self() ), &info);
			printf("ID: %d, name: %10s, ser pri: %d cur pri: %d stack use: %d\n\n", info.id, info.name,  info.set_pri, info.cur_pri, info.stack_used);
			/* printf("Name of the thread is %d\n",
				cyg_thread_get_id( cyg_thread_self() ));*/
		}
		
		cyg_mutex_unlock(&cliblock);
		cyg_thread_delay(delay);
	}
}

[-- Attachment #4: Type: text/plain, Size: 148 bytes --]

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ECOS] Re: how to implement EDF scheduling in eCos
  2010-01-14  5:35 ` Nodir Kodirov
@ 2010-01-14  6:48   ` Fabian Scheler
  0 siblings, 0 replies; 7+ messages in thread
From: Fabian Scheler @ 2010-01-14  6:48 UTC (permalink / raw)
  To: ecos-discuss

Hi Nodir,

>> /my_dev/ecos_edf_rep/ecos-3.0/packages/kernel/v3_0/src/common/thread.cxx:7
>> 68: undefined reference to `Cyg_Scheduler_Implementation::rem_thread (Cyg_Thread*)'
>> /my_dev/ecos_edf/install/lib/libtarget.a (kernel_thread.o): In function `Cyg_Thread':
>> /my_dev/ecos_edf_rep/ecos-3.0/packages/kernel/v3_0/src/common/thread.cxx:2
>> 19: undefined reference to `Cyg_Scheduler_Implementation::register_thread (Cyg_Thread*)'
>> ...

hm, maybe you forgot to add a 'compile'-directive within one of your
scheduler specific cdl-files or you just did not implement a bunch a
methods referenced within thread.cxx.

Ciao, Fabian

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ECOS] Re: how to implement EDF scheduling in eCos
  2010-01-08  8:35 [ECOS] Re: how to implement EDF scheduling in eCos Nodir Kodirov
  2010-01-08  8:39 ` Nodir Kodirov
  2010-01-14  5:35 ` Nodir Kodirov
@ 2010-01-14  6:50 ` Fabian Scheler
       [not found]   ` <392aa5941001140946j30ad2b3bnd12fb58f82d59b4c@mail.gmail.com>
  2 siblings, 1 reply; 7+ messages in thread
From: Fabian Scheler @ 2010-01-14  6:50 UTC (permalink / raw)
  To: ecos-discuss

Hi Nodir,

> My approach is adding two more additional fields to thread's
> properties. Those are:
> cyg_tick_count_t wcet /*worst case execution time*/
> cyg_tick_count_t deadline /* absolute deadline thread to be finished */

is that deadline provided by the application or is it computed by the
scheduler. In the first case a relative deadline might be easier to
handle, the scheduler than needs to map that relative deadline to an
absolute one.

Ciao, Fabian

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ECOS] Fwd: [ECOS] Re: how to implement EDF scheduling in eCos
       [not found]   ` <392aa5941001140946j30ad2b3bnd12fb58f82d59b4c@mail.gmail.com>
@ 2010-01-15  6:39     ` Fabian Scheler
  2010-01-15  8:46       ` Alois Z.
  0 siblings, 1 reply; 7+ messages in thread
From: Fabian Scheler @ 2010-01-15  6:39 UTC (permalink / raw)
  To: ecos-discuss

Hello Friedrich,

I think you forgot to reply to the mailing list, so I hope it's ok to
forward your message.

Ciao, Fabian


---------- Forwarded message ----------
From: Friedrich Schick <Friedrich.Schick@web.de>
Date: 2010/1/14
Subject: Re: [ECOS] Re: how to implement EDF scheduling in eCos
To: Fabian Scheler <fabian.scheler@gmail.com>


Hello,

Something you might consider when you are writing an EDF scheduler.

There are two types of tasks, event and time based. Lets call them
e_task and t_task. E_tasks are like a CAN message, which occurs on a
none regular basis, while t_task are more like a FlexRay message,
which do have a certain deadline.

I would consider following scheduling algorithm. You have three eCos
threads. The first e_thread is to handle all e_tasks, the second
t_thread to handle all t_tasks and the last one is the does some
background processing.

The are following fixed priorities to schedule (0 is the lowest).

4    time_high
3    event
2    time_low
1    background
0    idle

Starting scheduling the t_thread has the priority time_low, the
e_thread the priority event. If no e_task is waiting the t_tasks are
processed. But if an event occurs there is a switch to the e_thread.
The t_thread has a deadline (which is the sum of all
t_tasks-deadlines). If this deadline is to be missed, t_threads
priority will be increased to time_high. After the t_thread has
processed all t_tasks, it switches back its priority to time_low.

  Locking

What about mutexes? EDF scheduling does not need any mutexes (per
definition), but since we are mixing scheduling-algorithm there must
be a support of mutexes. The easiest way to support mutexes (and not
running in priority-inversion) is to set the mutex-locking thread to
the a new priority level (5 mutex).

But regarding device drivers (DSR), you should consider scheduler_lock.

  Ethernet

The ethernet might be handled as a t_task.

  Implementation

The EDF-scheduling is all done in thread context (so you do not have
to write a completely new scheduler). To enable the EDF-scheduling
there must be a timer interrupt which invokes the priority switch.


Best regards,

Friedrich



On Thu, Jan 14, 2010 at 7:50 AM, Fabian Scheler
<fabian.scheler@gmail.com> wrote:
>
> Hi Nodir,
>
> > My approach is adding two more additional fields to thread's
> > properties. Those are:
> > cyg_tick_count_t wcet /*worst case execution time*/
> > cyg_tick_count_t deadline /* absolute deadline thread to be finished */
>
> is that deadline provided by the application or is it computed by the
> scheduler. In the first case a relative deadline might be easier to
> handle, the scheduler than needs to map that relative deadline to an
> absolute one.
>
> Ciao, Fabian
>
> --
> Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
>

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ECOS] Fwd: [ECOS] Re: how to implement EDF scheduling in eCos
  2010-01-15  6:39     ` [ECOS] Fwd: " Fabian Scheler
@ 2010-01-15  8:46       ` Alois Z.
  0 siblings, 0 replies; 7+ messages in thread
From: Alois Z. @ 2010-01-15  8:46 UTC (permalink / raw)
  To: ecos-discuss

Hi,

Just a few remarks to your comment:

I would not split between timed tasks and event tasks. EDF works also in mixed mode. And is also reliable in the mixed execution of time triggered and event triggered tasks.

Synchronization is independent of the scheduling algorithm. So you definitely need mutexes, semaphores also when doing EDF scheduling.

Just my two cents,
Alois

> 
> ---------- Forwarded message ----------
> From: Friedrich Schick <Friedrich.Schick@web.de>
> Date: 2010/1/14
> Subject: Re: [ECOS] Re: how to implement EDF scheduling in eCos
> To: Fabian Scheler <fabian.scheler@gmail.com>
> 
> 
> Hello,
> 
> Something you might consider when you are writing an EDF scheduler.
> 
> There are two types of tasks, event and time based. Lets call them
> e_task and t_task. E_tasks are like a CAN message, which occurs on a
> none regular basis, while t_task are more like a FlexRay message,
> which do have a certain deadline.
> 
> I would consider following scheduling algorithm. You have three eCos
> threads. The first e_thread is to handle all e_tasks, the second
> t_thread to handle all t_tasks and the last one is the does some
> background processing.
> 
> The are following fixed priorities to schedule (0 is the lowest).
> 
> 4    time_high
> 3    event
> 2    time_low
> 1    background
> 0    idle
> 
> Starting scheduling the t_thread has the priority time_low, the
> e_thread the priority event. If no e_task is waiting the t_tasks are
> processed. But if an event occurs there is a switch to the e_thread.
> The t_thread has a deadline (which is the sum of all
> t_tasks-deadlines). If this deadline is to be missed, t_threads
> priority will be increased to time_high. After the t_thread has
> processed all t_tasks, it switches back its priority to time_low.
> 
>   Locking
> 
> What about mutexes? EDF scheduling does not need any mutexes (per
> definition), but since we are mixing scheduling-algorithm there must
> be a support of mutexes. The easiest way to support mutexes (and not
> running in priority-inversion) is to set the mutex-locking thread to
> the a new priority level (5 mutex).
> 
> But regarding device drivers (DSR), you should consider scheduler_lock.
> 
>   Ethernet
> 
> The ethernet might be handled as a t_task.
> 
>   Implementation
> 
> The EDF-scheduling is all done in thread context (so you do not have
> to write a completely new scheduler). To enable the EDF-scheduling
> there must be a timer interrupt which invokes the priority switch.
> 
> 
> Best regards,
> 
> Friedrich
> 
> 
> 
> On Thu, Jan 14, 2010 at 7:50 AM, Fabian Scheler
> <fabian.scheler@gmail.com> wrote:
> >
> > Hi Nodir,
> >
> > > My approach is adding two more additional fields to thread's
> > > properties. Those are:
> > > cyg_tick_count_t wcet /*worst case execution time*/
> > > cyg_tick_count_t deadline /* absolute deadline thread to be finished
> */
> >
> > is that deadline provided by the application or is it computed by the
> > scheduler. In the first case a relative deadline might be easier to
> > handle, the scheduler than needs to map that relative deadline to an
> > absolute one.
> >
> > Ciao, Fabian
> >
> > --
> > Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
> > and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
> >
> 
> -- 
> Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-01-15  8:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-08  8:35 [ECOS] Re: how to implement EDF scheduling in eCos Nodir Kodirov
2010-01-08  8:39 ` Nodir Kodirov
2010-01-14  5:35 ` Nodir Kodirov
2010-01-14  6:48   ` Fabian Scheler
2010-01-14  6:50 ` Fabian Scheler
     [not found]   ` <392aa5941001140946j30ad2b3bnd12fb58f82d59b4c@mail.gmail.com>
2010-01-15  6:39     ` [ECOS] Fwd: " Fabian Scheler
2010-01-15  8:46       ` Alois Z.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).