www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Can i use D for OS develop.

reply knott <knott yandex.ru> writes:
Hello. Before i start, i must apologize for my poor English.

Can i use D language for OS development(Non-core - user mode devel)?
Aug 16 2007
next sibling parent reply Paul Collier <paching gmail.com> writes:
knott wrote:
 Hello. Before i start, i must apologize for my poor English.
 
 Can i use D language for OS development(Non-core - user mode devel)?

to write a kernel in D. You can see them at dsource.org. If you're talking userspace development, I think you'll find that 95% of D projects already run in userspace ;) If you're talking about something in the middle, you can always bind D code to C APIs and disable the garbage collector if needed.
Aug 16 2007
next sibling parent reply knott <knott yandex.ru> writes:
Paul Collier Wrote:

 knott wrote:
 Hello. Before i start, i must apologize for my poor English.
 
 Can i use D language for OS development(Non-core - user mode devel)?

to write a kernel in D. You can see them at dsource.org. If you're talking userspace development, I think you'll find that 95% of D projects already run in userspace ;) If you're talking about something in the middle, you can always bind D code to C APIs and disable the garbage collector if needed.

Im talking about a userspace development in system which in early stage of development. I want to write program on system which have only small(not full) C library.
Aug 16 2007
next sibling parent reply Paul Collier <paching gmail.com> writes:
knott wrote:
 Paul Collier Wrote:
 
 knott wrote:
 Hello. Before i start, i must apologize for my poor English.

 Can i use D language for OS development(Non-core - user mode devel)?

to write a kernel in D. You can see them at dsource.org. If you're talking userspace development, I think you'll find that 95% of D projects already run in userspace ;) If you're talking about something in the middle, you can always bind D code to C APIs and disable the garbage collector if needed.

Im talking about a userspace development in system which in early stage of development. I want to write program on system which have only small(not full) C library.

OK, you may have to omit some bits of the standard library then. (Or just not use it.) Whether you use phobos or tango or whatever you like, the source is provided, so it's pretty easy to add version() statements to stick in workarounds if you want. Is the system using ulibc or something of the sort? I wonder how compatible that is... (Also, this thread might be better to post on D.learn, but I'm not sure)
Aug 16 2007
next sibling parent Kyle Furlong <kylefurlong gmail.com> writes:
Paul Collier wrote:
 knott wrote:
 Paul Collier Wrote:

 knott wrote:
 Hello. Before i start, i must apologize for my poor English.

 Can i use D language for OS development(Non-core - user mode devel)?

projects to write a kernel in D. You can see them at dsource.org. If you're talking userspace development, I think you'll find that 95% of D projects already run in userspace ;) If you're talking about something in the middle, you can always bind D code to C APIs and disable the garbage collector if needed.

Im talking about a userspace development in system which in early stage of development. I want to write program on system which have only small(not full) C library.

OK, you may have to omit some bits of the standard library then. (Or just not use it.) Whether you use phobos or tango or whatever you like, the source is provided, so it's pretty easy to add version() statements to stick in workarounds if you want. Is the system using ulibc or something of the sort? I wonder how compatible that is... (Also, this thread might be better to post on D.learn, but I'm not sure)

If the new platform has a standard C malloc, you can modify the runtime to use it fairly easily. I'm not sure if there are any other dependencies in the runtime.
Aug 16 2007
prev sibling parent reply knott <knott yandex.ru> writes:
Paul Collier Wrote:

 knott wrote:
 Paul Collier Wrote:
 
 knott wrote:
 Hello. Before i start, i must apologize for my poor English.

 Can i use D language for OS development(Non-core - user mode devel)?

to write a kernel in D. You can see them at dsource.org. If you're talking userspace development, I think you'll find that 95% of D projects already run in userspace ;) If you're talking about something in the middle, you can always bind D code to C APIs and disable the garbage collector if needed.

Im talking about a userspace development in system which in early stage of development. I want to write program on system which have only small(not full) C library.

OK, you may have to omit some bits of the standard library then. (Or just not use it.) Whether you use phobos or tango or whatever you like, the source is provided, so it's pretty easy to add version() statements to stick in workarounds if you want. Is the system using ulibc or something of the sort? I wonder how compatible that is... (Also, this thread might be better to post on D.learn, but I'm not sure)

Can i disagree standart library and write my own one?
Aug 16 2007
parent BCS <ao pathlink.com> writes:
Reply to knott,

 Can i disagree standart library and write my own one?
 

That's more or less what Tango is. So yes.
Aug 16 2007
prev sibling parent reply kris <foo bar.com> writes:
knott wrote:
 Paul Collier Wrote:
 
 knott wrote:
 Hello. Before i start, i must apologize for my poor English.

 Can i use D language for OS development(Non-core - user mode devel)?

to write a kernel in D. You can see them at dsource.org. If you're talking userspace development, I think you'll find that 95% of D projects already run in userspace ;) If you're talking about something in the middle, you can always bind D code to C APIs and disable the garbage collector if needed.

Im talking about a userspace development in system which in early stage of development. I want to write program on system which have only small(not full) C library.

Tango would rather not have the full C lib either. It rather deliberately uses only a handful of clib calls, and a (small) replacement for those has been on the cards for years. We just never got the time to do that. We'd be very interested in a lightweight replacement for those few clib calls, written in D
Aug 16 2007
next sibling parent reply BCS <ao pathlink.com> writes:
Reply to kris,

 knott wrote:
 
 Paul Collier Wrote:
 
 knott wrote:
 
 Hello. Before i start, i must apologize for my poor English.
 
 Can i use D language for OS development(Non-core - user mode
 devel)?
 

projects to write a kernel in D. You can see them at dsource.org. If you're talking userspace development, I think you'll find that 95% of D projects already run in userspace ;) If you're talking about something in the middle, you can always bind D code to C APIs and disable the garbage collector if needed.

stage of development. I want to write program on system which have only small(not full) C library.

deliberately uses only a handful of clib calls, and a (small) replacement for those has been on the cards for years. We just never got the time to do that. We'd be very interested in a lightweight replacement for those few clib calls, written in D

How hard would it be to Have tango be running in D right up to the when system calls jump into kernel space? with templates you could wrap the nitty gritty of systems calls real nice R SystemCall(uint number, R, A...) { asm { // whatever } } alias SystemCall!(SystemCallNumbers.open, int, ...) open; ...
Aug 16 2007
parent kris <foo bar.com> writes:
Not very hard at all.

Tango itself doesn't really use clib when compiled for Win32 (uses Win32 
calls for most everything), so some of these notions are already in use.


BCS wrote:
 Reply to kris,

 How hard would it be to Have tango be running in D right up to the when 
 system calls jump into kernel space?
 
 with templates you could wrap the nitty gritty of systems calls real nice
 
 R SystemCall(uint number, R, A...)
 {
   asm
   {
      // whatever
   }
 }
 
 alias SystemCall!(SystemCallNumbers.open, int, ...) open;
 ...
 
 
 

Aug 16 2007
prev sibling parent reply Sean Kelly <sean f4.ca> writes:
kris wrote:
 knott wrote:
 Paul Collier Wrote:

 knott wrote:
 Hello. Before i start, i must apologize for my poor English.

 Can i use D language for OS development(Non-core - user mode devel)?

projects to write a kernel in D. You can see them at dsource.org. If you're talking userspace development, I think you'll find that 95% of D projects already run in userspace ;) If you're talking about something in the middle, you can always bind D code to C APIs and disable the garbage collector if needed.

Im talking about a userspace development in system which in early stage of development. I want to write program on system which have only small(not full) C library.

Tango would rather not have the full C lib either. It rather deliberately uses only a handful of clib calls, and a (small) replacement for those has been on the cards for years. We just never got the time to do that. We'd be very interested in a lightweight replacement for those few clib calls, written in D

For what it's worth, the only standard C lib call of note used by the Tango runtime is malloc/free. A few others are used for convenience (memset, memmove), but could easily be removed. By the way, the Tango runtime is designed in a way to makes replacing the "standard library" portion quite easy, which may be of interest to you if you're thinking about writing your own. I'll be discussing the design at the D conference next week. Sean
Aug 16 2007
parent kris <foo bar.com> writes:
Brad Roberts wrote:
 On Thu, 16 Aug 2007, Sean Kelly wrote:
 
 kris wrote:
 knott wrote:
 Paul Collier Wrote:

 knott wrote:
 Hello. Before i start, i must apologize for my poor English.

 Can i use D language for OS development(Non-core - user mode devel)?

to write a kernel in D. You can see them at dsource.org. If you're talking userspace development, I think you'll find that 95% of D projects already run in userspace ;) If you're talking about something in the middle, you can always bind D code to C APIs and disable the garbage collector if needed.

development. I want to write program on system which have only small(not full) C library.

uses only a handful of clib calls, and a (small) replacement for those has been on the cards for years. We just never got the time to do that. We'd be very interested in a lightweight replacement for those few clib calls, written in D

runtime is malloc/free. A few others are used for convenience (memset, memmove), but could easily be removed. By the way, the Tango runtime is designed in a way to makes replacing the "standard library" portion quite easy, which may be of interest to you if you're thinking about writing your own. I'll be discussing the design at the D conference next week. Sean

There's others, file apis, socket apis, time apis, etc.. the list is quite a bit longer than you might think. I really don't understand the desire to move off of libc. libc provides a number of very useful benefits: -- no need to understand the kernel call semantics for every os -- no need to figure out how to conform to posix (and other standards) for each kernel/os. -- no need to re-optimize for each cpu interesting low level bits like how to move memory the fastest -- good malloc subsystems are _hard_ to write (definition of good is obvious debatable) There's a big downside.. it's impossible in D to restrict usage of parts of a library.. anyone can provide their own extern(C) blah and poke past the abstractions that Tango and Phobos are trying to provide. Later, Brad

Perhaps not a question of moving "off" libc? An option to link with something simpler, or written in D, or whatever? As for malloc(), many libs appear to use a derivative of Doug Lea's venerable incarnation :)
Aug 16 2007
prev sibling parent Brad Roberts <braddr puremagic.com> writes:
On Thu, 16 Aug 2007, Sean Kelly wrote:

 kris wrote:
 knott wrote:
 Paul Collier Wrote:
 
 knott wrote:
 Hello. Before i start, i must apologize for my poor English.
 
 Can i use D language for OS development(Non-core - user mode devel)?

to write a kernel in D. You can see them at dsource.org. If you're talking userspace development, I think you'll find that 95% of D projects already run in userspace ;) If you're talking about something in the middle, you can always bind D code to C APIs and disable the garbage collector if needed.

Im talking about a userspace development in system which in early stage of development. I want to write program on system which have only small(not full) C library.

Tango would rather not have the full C lib either. It rather deliberately uses only a handful of clib calls, and a (small) replacement for those has been on the cards for years. We just never got the time to do that. We'd be very interested in a lightweight replacement for those few clib calls, written in D

For what it's worth, the only standard C lib call of note used by the Tango runtime is malloc/free. A few others are used for convenience (memset, memmove), but could easily be removed. By the way, the Tango runtime is designed in a way to makes replacing the "standard library" portion quite easy, which may be of interest to you if you're thinking about writing your own. I'll be discussing the design at the D conference next week. Sean

There's others, file apis, socket apis, time apis, etc.. the list is quite a bit longer than you might think. I really don't understand the desire to move off of libc. libc provides a number of very useful benefits: -- no need to understand the kernel call semantics for every os -- no need to figure out how to conform to posix (and other standards) for each kernel/os. -- no need to re-optimize for each cpu interesting low level bits like how to move memory the fastest -- good malloc subsystems are _hard_ to write (definition of good is obvious debatable) There's a big downside.. it's impossible in D to restrict usage of parts of a library.. anyone can provide their own extern(C) blah and poke past the abstractions that Tango and Phobos are trying to provide. Later, Brad
Aug 16 2007
prev sibling parent reply Walter Bright <newshound1 digitalmars.com> writes:
knott wrote:
 Hello. Before i start, i must apologize for my poor English.
 
 Can i use D language for OS development(Non-core - user mode devel)?

Yes.
Aug 16 2007
parent Alexander Panek <alexander.panek brainsware.org> writes:
Walter Bright wrote:
 knott wrote:
 Hello. Before i start, i must apologize for my poor English.

 Can i use D language for OS development(Non-core - user mode devel)?

Yes.

Oh great, I thought I would have to come up with that answer. ;)
Aug 17 2007