Re: Linux Kernel in D?
On Sunday, 18 December 2016 at 02:54:10 UTC, Whatsthisnow wrote: What are your thoughts on how I have implemented the strcpy type stuff? It looks like you are trying to wrap D types to interact with C. I think Walter's advice should be considered. Convert the files to match the original as closely as possible, and don't fix bugs or change any algorithm. Once that is complete and passing tests refactoring can take place.
Re: Linux Kernel in D?
On Sunday, 18 December 2016 at 11:22:49 UTC, Whatsthisnow wrote: thousands of programmers that program for Linux, so creating an entire OS in D based on Linux would encourage (hopefully) a lot of Linux programmers to also write for a D Linux. Since its largely familiar, the learning process would be relatively painless. I would put to much faith in Linux developers having an interest in supporting a language change. Now the idea that their is interest in having libc written in D, the project could be of use if the entire Linux kernel could be built and use it, talk about real world testing.
Re: Linux Kernel in D?
On Sunday, 18 December 2016 at 10:51:48 UTC, rikki cattermole wrote: Alternatively help out Wild with his PowerNex project[0]. Pure D port isn't all that exciting, pure D OS that actually tries to do things on its own, now that's something to write home about! [0] https://github.com/Vild/PowerNex If you read the README in the github master, you will notice that it isn't just porting the kernel, it is also porting glibc to D, as well as all the userland applications to D. Essentially making an entire D OS as you say, but using already established designs/technology as a base point. Linux is effective, powerful, widely used, and there are already thousands of programmers that program for Linux, so creating an entire OS in D based on Linux would encourage (hopefully) a lot of Linux programmers to also write for a D Linux. Since its largely familiar, the learning process would be relatively painless.
Re: Linux Kernel in D?
On 18/12/2016 11:13 PM, Whatsthisnow wrote: On Sunday, 18 December 2016 at 08:05:20 UTC, Jacques Müller wrote: A Minix port could be interesting as well. The kernel seems to be pretty small. Well if others want to work on porting those kernels they can, we could potentially look into expanding my repo to include all kinds of kernel projects, assuming there is enough interest in them, then we have a solid an entire project collection of potential D kernel solutions. That would be one heck of a boost for D I think. Alternatively help out Wild with his PowerNex project[0]. Pure D port isn't all that exciting, pure D OS that actually tries to do things on its own, now that's something to write home about! [0] https://github.com/Vild/PowerNex
Re: Linux Kernel in D?
On Sunday, 18 December 2016 at 08:05:20 UTC, Jacques Müller wrote: A Minix port could be interesting as well. The kernel seems to be pretty small. Well if others want to work on porting those kernels they can, we could potentially look into expanding my repo to include all kinds of kernel projects, assuming there is enough interest in them, then we have a solid an entire project collection of potential D kernel solutions. That would be one heck of a boost for D I think.
Re: Linux Kernel in D?
A Minix port could be interesting as well. The kernel seems to be pretty small.
Re: Linux Kernel in D?
On Sunday, 18 December 2016 at 03:05:13 UTC, Whatsthisnow wrote: On Sunday, 18 December 2016 at 00:10:47 UTC, sarn wrote: [...] I am basing the kernel on Linux because, well, I like Linux, and its the only complete kernel with free source that I currently know of. Given that it is widely Used as an OS kernel, it kinda made sense to port it, give it a new engine under the hood so to speak. I would like to keep it as close to the original as possible such that linux programmers will still have a generally familiar environment to work with, rather than having to learn an entirely new kernel. [...] I'd be inclined to start with a smaller OS like Plan9. Even FreeBSD would be simpler, althoguh no less gargantuan than Linux, it is better organised and documented IMO. Anyway good luck with this, even if you don't finish you're bound to learn a lot in the process. bye, lobo
Re: Linux Kernel in D?
On Sunday, 18 December 2016 at 03:05:13 UTC, Whatsthisnow wrote: I am basing the kernel on Linux because, well, I like Linux, and its the only complete kernel with free source that I currently know of. Given that it is widely Used as an OS kernel, it kinda made sense to port it, give it a new engine under the hood so to speak. I would like to keep it as close to the original as possible such that linux programmers will still have a generally familiar environment to work with, rather than having to learn an entirely new kernel. As far as GlibD, well the point of the project is to give Linux, as a I said before, a metaphorical new engine under the hood, so it wouldn't be sensible to not convert libc and the coreutils etc to D as well since Linux requires them. Plus, this might be a good opportunity for the community, as well as the creators of D, to incorporate some features into the kernel that would benefit the D language itself. I think i remember reading somewhere, someone (maybe one of the creators) stated that garbage collection should be done in the Kernel, well I think this would be a perfect opportunity to test that as an experimental feature. Possibly pull GC out of the D libraries and put it in the kernel for this project. Anyway, thats some of my thoughts on the project. Having said that though, keeping it as familiar as possible, it would be a no brainer to make full use of D's features to make the kernel the best it can be. I am no master with D at the moment, so I was hoping some community members might be interested in putting their hands in the project and committing some good code ports.
Re: Linux Kernel in D?
On Sunday, 18 December 2016 at 00:10:47 UTC, sarn wrote: On Friday, 16 December 2016 at 16:12:38 UTC, D.Rex wrote: A D port of the Linux Kernel? https://github.com/whatsthisnow/ProjectD Any thoughts on the project? Depends on how strictly you want to reimplement GNU/Linux, or whether something Posix-y is enough. Anyway, a D "libc" would be really awesome. Something like Newlib in pure D would be great for OS programming in D. I am basing the kernel on Linux because, well, I like Linux, and its the only complete kernel with free source that I currently know of. Given that it is widely Used as an OS kernel, it kinda made sense to port it, give it a new engine under the hood so to speak. I would like to keep it as close to the original as possible such that linux programmers will still have a generally familiar environment to work with, rather than having to learn an entirely new kernel. As far as GlibD, well the point of the project is to give Linux, as a I said before, a metaphorical new engine under the hood, so it wouldn't be sensible to not convert libc and the coreutils etc to D as well since Linux requires them. Plus, this might be a good opportunity for the community, as well as the creators of D, to incorporate some features into the kernel that would benefit the D language itself. I think i remember reading somewhere, someone (maybe one of the creators) stated that garbage collection should be done in the Kernel, well I think this would be a perfect opportunity to test that as an experimental feature. Possibly pull GC out of the D libraries and put it in the kernel for this project. Anyway, thats some of my thoughts on the project.
Re: Linux Kernel in D?
On Saturday, 17 December 2016 at 17:19:55 UTC, Jesse Phillips wrote: On Friday, 16 December 2016 at 16:12:38 UTC, D.Rex wrote: A D port of the Linux Kernel? https://github.com/whatsthisnow/ProjectD Any thoughts on the project? I think the project should have started with a fork of the official source and should always build a working kernel, making conversions to D in pieces but always building. It is also a large project which could provide some entertainment. Thats not a bad idea, once I figure out how to incorporate D into the original Source and build with make files I will give it a shot. Start with some basic Conversions, then branch out further to the bigger stuff. One of my main interests In converting it entirely to do is to see how much faster the kernel would compile. Hopefully the idea is to give it a much faster compile time and make changes faster and easier to implement. What are your thoughts on how I have implemented the strcpy type stuff?
Re: Linux Kernel in D?
On Friday, 16 December 2016 at 16:12:38 UTC, D.Rex wrote: A D port of the Linux Kernel? https://github.com/whatsthisnow/ProjectD Any thoughts on the project? Depends on how strictly you want to reimplement GNU/Linux, or whether something Posix-y is enough. Anyway, a D "libc" would be really awesome. Something like Newlib in pure D would be great for OS programming in D.
Re: Linux Kernel in D?
On Friday, 16 December 2016 at 16:12:38 UTC, D.Rex wrote: A D port of the Linux Kernel? https://github.com/whatsthisnow/ProjectD Any thoughts on the project? Linux is too bloated and there is no any reasons to re-implement it.
Re: Linux Kernel in D?
On Friday, 16 December 2016 at 16:12:38 UTC, D.Rex wrote: A D port of the Linux Kernel? https://github.com/whatsthisnow/ProjectD Any thoughts on the project? I think the project should have started with a fork of the official source and should always build a working kernel, making conversions to D in pieces but always building. It is also a large project which could provide some entertainment.
Linux Kernel in D?
A D port of the Linux Kernel? https://github.com/whatsthisnow/ProjectD Any thoughts on the project?
Re: Linux Kernel in D?
On Wednesday, 2 November 2016 at 13:56:22 UTC, qznc wrote: On Tuesday, 1 November 2016 at 16:22:58 UTC, Andrei Alexandrescu wrote: [...] Nevertheless, I don't see a successful D kernel in the foreseeable future. Building a kernel for IoT devices is trendy, but you want a lot more portability for that and C compilers are everywhere. On the server, you could build a hypervisor OS with D, but currently containers are hyped so much more. You'd only have a chance, if you also port the JVM onto your D-OS. Still, where is the advantage to Linux? Who knew containers will suddenly become a thing? You never know what might happen, a D kernel might as well be the game changer.
Re: Linux Kernel in D?
On Tuesday, 1 November 2016 at 16:22:58 UTC, Andrei Alexandrescu wrote: On 11/01/2016 09:41 AM, Wild wrote: On Tuesday, 1 November 2016 at 12:12:29 UTC, Heisenberg wrote: Just an idea. Do you think it would have any advantage compared to the one that is written in C? I think it wouldn't really be worth it. I tend to think the same but for different reasons. Currently the Linux kernel is a large mature product that has its own evolution. It would be very difficult to reimplement it from first principles in any other language and get a competitive, timely product. As an intellectual exercise, D's safety would help but at this point impart little advantage; the kernel has reached good stability and safety bugs are few and far across. This trend is likely for the foreseeable future. Security is a big topic for Linux: https://lwn.net/Articles/662219/ Mostly the problem are drivers. They are produced hastily by careless companies without the scrutiny of the core kernel parts (like scheduler, file system, etc). I think D might help there, because it could enforce @safe or other properties onto the drivers. Nevertheless, I don't see a successful D kernel in the foreseeable future. Building a kernel for IoT devices is trendy, but you want a lot more portability for that and C compilers are everywhere. On the server, you could build a hypervisor OS with D, but currently containers are hyped so much more. You'd only have a chance, if you also port the JVM onto your D-OS. Still, where is the advantage to Linux?
Re: Linux Kernel in D?
On Tuesday, 1 November 2016 at 20:11:13 UTC, Karabuta wrote: On Tuesday, 1 November 2016 at 13:41:04 UTC, Wild wrote: On Tuesday, 1 November 2016 at 12:12:29 UTC, Heisenberg wrote: Just an idea. Do you think it would have any advantage compared to the one that is written in C? It is better to instead design a new kernel from scratch, and structure everything in a way that seems more logical for D code. This is what I target with my kernel PowerNex (The current code structure is horrible, I'm currently planning to fix it so it matches the D style). Really excited to see that you plan to improve the code style to fit D's. I glanced through your code and that was the only killer issue (IMO). I realized that it was too different from the code style that most D people use and I don't really know if I liked that style. Hopefully the new code style will fit the project better. https://github.com/Vild/PowerNex/blob/master/Codestyle.org
Re: Linux Kernel in D?
On Tuesday, 1 November 2016 at 13:41:04 UTC, Wild wrote: On Tuesday, 1 November 2016 at 12:12:29 UTC, Heisenberg wrote: Just an idea. Do you think it would have any advantage compared to the one that is written in C? It is better to instead design a new kernel from scratch, and structure everything in a way that seems more logical for D code. This is what I target with my kernel PowerNex (The current code structure is horrible, I'm currently planning to fix it so it matches the D style). Really excited to see that you plan to improve the code style to fit D's. I glanced through your code and that was the only killer issue (IMO).
Re: Linux Kernel in D?
On Tuesday, 1 November 2016 at 16:22:58 UTC, Andrei Alexandrescu wrote: As an intellectual exercise, D's safety would help but at this point impart little advantage; the kernel has reached good stability and safety bugs are few and far across. This trend is likely for the foreseeable future. It would not be unreasonable to write new code in D. It's not as though safety is the only advantage that D brings to the table. This would have to be a fork, and wouldn't likely be of much interest to most Linux users/developers, but maybe there is room to optimize the kernel for a specific application that is also written in D. Using D rather than C would greatly reduce the cost of getting into kernel development.
Re: Linux Kernel in D?
On 11/01/2016 09:41 AM, Wild wrote: On Tuesday, 1 November 2016 at 12:12:29 UTC, Heisenberg wrote: Just an idea. Do you think it would have any advantage compared to the one that is written in C? I think it wouldn't really be worth it. I tend to think the same but for different reasons. Currently the Linux kernel is a large mature product that has its own evolution. It would be very difficult to reimplement it from first principles in any other language and get a competitive, timely product. As an intellectual exercise, D's safety would help but at this point impart little advantage; the kernel has reached good stability and safety bugs are few and far across. This trend is likely for the foreseeable future. One thing where D would be able to help quite a bit more is code size. D has better abstraction abilities than C (or C++) and using those would allow eliminating a lot of subtle duplication in kernel code. Consequently we'd be looking at a lower bug rate, better maintainability etc. I estimate that a 25% reduction in LOC is easily attainable. However, the dynamics of large projects makes even this relatively high reduction of little value. You'd not be looking at enjoying 25% savings, but instead at rebuilding 75% of the project. Because of that, you'd need a reduction of one order of magnitude to make the alternative appealing. Andrei
Re: Linux Kernel in D?
On Tuesday, 1 November 2016 at 12:12:29 UTC, Heisenberg wrote: Just an idea. Do you think it would have any advantage compared to the one that is written in C? I think it wouldn't really be worth it. You have to make a custom runtime and a custom standard library. Because most of the awesome D features are for the standard library and not directly from the language itself. Porting the Linux kernel to D language to fix a few bugs isn't really worth it, if you have to implement all the stuff I mentioned. It is better to instead design a new kernel from scratch, and structure everything in a way that seems more logical for D code. This is what I target with my kernel PowerNex (The current code structure is horrible, I'm currently planning to fix it so it matches the D style). Conclusion: Yes D features could probably fix bugs in the Linux kernel and make it more safe, but you need to implement a lot of extra code just to be able to use basic D features. So it wouldn't be worth it. - Dan
Re: Linux Kernel in D?
On Tuesday, 1 November 2016 at 12:12:29 UTC, Heisenberg wrote: Just an idea. Do you think it would have any advantage compared to the one that is written in C? Look at https://github.com/Rikarin/Trinix for example
Re: Linux Kernel in D?
On Tuesday, 1 November 2016 at 12:12:29 UTC, Heisenberg wrote: Just an idea. Do you think it would have any advantage compared to the one that is written in C? It would have advantages : most kernel vulnerabilities are due to buffer overflows, use-after-frees and such that are directly linked to the use of C. While it is possible to have these bugs in D they require that you go out of your way (using raw pointers instead of slices for example) which makes them less likely to happen. On the other hand "normal D" cannot be used for the kernel as you need to grow a specific druntime that is able to manage memory allocations and such without depending on an existing kernel, so it's work.
Re: Linux Kernel in D?
Dne 1.11.2016 v 13:12 Heisenberg via Digitalmars-d napsal(a): Just an idea. Do you think it would have any advantage compared to the one that is written in C? Same as any other software written in C. C is unsafe so in D it should be more safe and easier to mantain
Re: Linux Kernel in D?
On Tuesday, 1 November 2016 at 12:12:29 UTC, Heisenberg wrote: Just an idea. Do you think it would have any advantage compared to the one that is written in C? There have been a number of projects working on this. For example: https://github.com/Vild/PowerNex
Linux Kernel in D?
Just an idea. Do you think it would have any advantage compared to the one that is written in C?