digitalmars.D - Linux Kernel in D?
- Heisenberg (2/2) Nov 01 2016 Just an idea. Do you think it would have any advantage compared
- Edwin van Leeuwen (3/5) Nov 01 2016 There have been a number of projects working on this. For example:
- cym13 (11/13) Nov 01 2016 It would have advantages : most kernel vulnerabilities are due to
- Daniel Kozak via Digitalmars-d (3/5) Nov 01 2016 Same as any other software written in C. C is unsafe so in D it should
- Satoshi (2/4) Nov 01 2016 Look at https://github.com/Rikarin/Trinix for example
- Wild (22/24) Nov 01 2016 I think it wouldn't really be worth it. You have to make a custom
- Andrei Alexandrescu (20/24) Nov 01 2016 I tend to think the same but for different reasons. Currently the Linux
- bachmeier (9/13) Nov 01 2016 It would not be unreasonable to write new code in D. It's not as
- qznc (16/32) Nov 02 2016 Security is a big topic for Linux:
- Karabuta (3/13) Nov 02 2016 Who knew containers will suddenly become a thing? You never know
- Karabuta (4/14) Nov 01 2016 Really excited to see that you plan to improve the code style to
- Wild (5/20) Nov 01 2016 I realized that it was too different from the code style that most
Just an idea. Do you think it would have any advantage compared to the one that is written in C?
Nov 01 2016
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
Nov 01 2016
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.
Nov 01 2016
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
Nov 01 2016
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
Nov 01 2016
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
Nov 01 2016
On 11/01/2016 09:41 AM, Wild wrote:On Tuesday, 1 November 2016 at 12:12:29 UTC, Heisenberg wrote: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. AndreiJust 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.
Nov 01 2016
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.
Nov 01 2016
On Tuesday, 1 November 2016 at 16:22:58 UTC, Andrei Alexandrescu wrote:On 11/01/2016 09:41 AM, Wild wrote: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?On Tuesday, 1 November 2016 at 12:12:29 UTC, Heisenberg wrote: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.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.
Nov 02 2016
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.
Nov 02 2016
On Tuesday, 1 November 2016 at 13:41:04 UTC, Wild wrote:On Tuesday, 1 November 2016 at 12:12:29 UTC, Heisenberg wrote: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).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).
Nov 01 2016
On Tuesday, 1 November 2016 at 20:11:13 UTC, Karabuta wrote:On Tuesday, 1 November 2016 at 13:41:04 UTC, Wild wrote: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.orgOn Tuesday, 1 November 2016 at 12:12:29 UTC, Heisenberg wrote: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).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).
Nov 01 2016