Thread overview
real time
Dec 07, 2005
Frank Benoit
Dec 09, 2005
Dave
Dec 09, 2005
Thomas Kuehne
Dec 10, 2005
Frank Benoit
Dec 11, 2005
Dave
December 07, 2005
Hello ng

* Is it possible to write kernel modules in D?

* Is it possible to write realtime apps in D?
  For example using the rtai for linux.

* If any, what are the missing requirements?

Frank
December 09, 2005
In article <dn67ub$1u3c$1@digitaldaemon.com>, Frank Benoit says...
>
>Hello ng
>
>* Is it possible to write kernel modules in D?
>
>* Is it possible to write realtime apps in D?
>  For example using the rtai for linux.
>
>* If any, what are the missing requirements?
>
>Frank

Perhaps these will help:

http://digitalmars.com/d/iasm.html http://digitalmars.com/d/memory.html http://digitalmars.com/d/interfaceToC.html


December 09, 2005
Frank Benoit schrieb am 2005-12-07:
> Hello ng
>
> * Is it possible to write kernel modules in D?

http://dkernel.kuehne.cn/hello.d

Thomas


December 10, 2005
Thanks for the replies.


it seems to me, D can be an alternative to C/C++ in realtime programming.

From http://www.digitalmars.com/d/memory.html#realtime
"The most reliable way to guarantee latency is to preallocate all data
that will be needed by the time critical portion."

What are the things to avoid?
- every new
- dynamic arrays in general?
- slicing arrays
- concatenating strings?
- ...?

Can I make a dynamic allocation protection. A mechanism that throws an exception if the programm makes a direkt or indirekt allocation.

The disable/enable of the gc, does only throw outofmemory. Is there a possibility to get the exception at the first unwanted allocation try?

void InterruptServiceRoutine()
{
	std.gc.disable();

	try
	{
		/// all the realtime things
	}
	catch( OutOfMemory oom )
	{
	}
	finally
	{
		std.gc.enable();
	}
}

Does the gc and D work with RTAI Lxrt? http://www.rtai.org/documentation/magma/html/api/whatis_lxrt.html There is this:

"They must be POSIX real time Linux processes locked into memory using SCHED_FIFO. Thus their memory must be pre grown to its maximum extension and completely locked in memory."

I do not understand that completely, especially not the consequences for D and the gc.

Frank
December 11, 2005
In article <dndh3a$289t$1@digitaldaemon.com>, Frank Benoit says...
>
>Thanks for the replies.
>
>
>it seems to me, D can be an alternative to C/C++ in realtime programming.
>
>From http://www.digitalmars.com/d/memory.html#realtime
>"The most reliable way to guarantee latency is to preallocate all data
>that will be needed by the time critical portion."
>
>What are the things to avoid?
>- every new
>- dynamic arrays in general?
>- slicing arrays
>- concatenating strings?
>- ...?
>

I would say the basic rules would be:

- avoid the built-in new (you can override it - that's covered in the docs.).
- use static arrays instead of the built-in dynamic arrays. The compiler
disallows concatenation and
- don't use .dup on any type of array.

Slices return a reference to the array and, for D style arrays, also modify the length member. But they should not allocate memory.

>Can I make a dynamic allocation protection. A mechanism that throws an exception if the programm makes a direkt or indirekt allocation.
>
>The disable/enable of the gc, does only throw outofmemory. Is there a possibility to get the exception at the first unwanted allocation try?
>
>void InterruptServiceRoutine()
>{
>	std.gc.disable();
>
>	try
>	{
>		/// all the realtime things
>	}
>	catch( OutOfMemory oom )
>	{
>	}
>	finally
>	{
>		std.gc.enable();
>	}
>}
>
>Does the gc and D work with RTAI Lxrt? http://www.rtai.org/documentation/magma/html/api/whatis_lxrt.html There is this:
>
>"They must be POSIX real time Linux processes locked into memory using SCHED_FIFO. Thus their memory must be pre grown to its maximum extension and completely locked in memory."
>
>I do not understand that completely, especially not the consequences for D and the gc.
>
>Frank