TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Writing Linux Modules in Ada (2016)

134 点作者 slondr超过 1 年前

13 条评论

gscho超过 1 年前
Back in university I took a course in legacy programming. We did a project in each of Fortran, COBOL and Ada. I enjoyed Ada very much. The module system made a lot of sense to me and the compiler found a lot of mistakes (compared to C). Thanks for sharing this article. It brought me back and makes me want to give Ada another go now that I have 10 years of real world experience.
评论 #37288912 未加载
评论 #37291863 未加载
评论 #37295200 未加载
inamberclad超过 1 年前
Hah, my perfect niche!<p>I think that an ada-like language could make a real resurgence in embedded programming. Ada gets all the things about bare-metal right that C got wrong. However, it&#x27;s held up by legacy tooling, clunky syntax, and obtuse compiler errors. Adacore has gone a long way towards alleviating those issues over the last few years, with alire and the ada_language_server. Time will see where this language takes us.
评论 #37289254 未加载
评论 #37291107 未加载
mkovach超过 1 年前
Ahh, Lovely Ada. When I was a wee lad, toiling as an Email consultant, having my mind slowly destroyed by Sendmail configurations, the constant fear induced by anything related to Microsoft and Email, and, well, let&#x27;s not mention Lotus Notes, some wounds never heal, I had the grand idea of writing a secure collection of Email tools.<p>This included SMTP, IMAP, POP3 daemons, and various other tools. I was going to write them all in Ada. I had a basic SMTP daemon that would accept mail and deliver it. But then, one of the various Outlook worms generated a ton of revenue at the expense of sleep, hygiene, and dignity, and I decided to get out of the Email business ASAP.<p>Still wish I would have kept working with Ada. I really liked it, and one could write tight code with it.
评论 #37313107 未加载
tombert超过 1 年前
I&#x27;ve never used Ada, and I also don&#x27;t really do systems stuff, but it does seem like it&#x27;s a pretty neat language, at least compared to C. From what I have seen, it looks like it has better memory guarantees while still being fast and low-level.<p>With be the popularity of Rust, it makes me kind of wonder why Ada isn&#x27;t more popular. I should give the language a go.
评论 #37290771 未加载
评论 #37322110 未加载
MarcusE1W超过 1 年前
Here is a really good ada tutorial for low level and systems programming.<p><a href="https:&#x2F;&#x2F;learn.adacore.com&#x2F;courses&#x2F;intro-to-embedded-sys-prog&#x2F;index.html" rel="nofollow noreferrer">https:&#x2F;&#x2F;learn.adacore.com&#x2F;courses&#x2F;intro-to-embedded-sys-prog...</a><p>Here the bit fiddling in Ada data structures is explained <a href="https:&#x2F;&#x2F;learn.adacore.com&#x2F;courses&#x2F;intro-to-embedded-sys-prog&#x2F;chapters&#x2F;low_level_programming.html#specifying-representation" rel="nofollow noreferrer">https:&#x2F;&#x2F;learn.adacore.com&#x2F;courses&#x2F;intro-to-embedded-sys-prog...</a> Quite cool
butterisgood超过 1 年前
I want to like Ada, but the lack of support for Mac OS on anything Apple Silicon related is a huge reason to skip it and do something else (for me).<p>One thing I still haven&#x27;t wrapped my head around is how &quot;dynamic&quot; memory allocation and cleanup works in Ada. It doesn&#x27;t seem as important to mention that early in any documentation anywhere. And, maybe it&#x27;s the C&#x2F;C++ programmer in me, but that strikes me as a bit odd. Or, perhaps I just can&#x27;t see past the tip of my nose and it&#x27;s there.<p>I kind of need to know how dynamic memory works in any programming language before I plan to invest deeply in learning it. And it needs to work on my hardware.
评论 #37293202 未加载
评论 #37296633 未加载
cmrdporcupine超过 1 年前
It&#x27;s interesting to see the positive talk about Ada in here. I think that&#x27;s good, but also indicative of perhaps a change in perspective. I feel like if the topic of Ada had come up here 10 years ago (probably did), the responses would have been quite different and more along the lines of <i>&quot;that annoying stuffy&#x2F;overly-verbose&#x2F;old&#x2F;obsolete&#x2F;design-by-committee language&quot;</i> .<p>I think there&#x27;s a good growing consciousness of the fairly terrifying unsafety of C&#x2F;C++, and the relative success of Rust is some evidence of that, at least.<p>Many moons ago I bought an Ada 95 manual, and learned a bit of the language with intent to fiddle with it but never finished. I like the <i>idea</i> but not sure I&#x27;d be wanting to give up various... modern conveniences... I get from Rust in order to work in that world.
eggy超过 1 年前
I always recommend this book, &quot;Building High Integrity Applications with SPARK&quot; as an introduction to how SPARK can be used for high-integrity, safe programs for mission-critical applications. SPARK has a legacy of large, high-integrity applications over the past two decades. This puts it ahead of Rust in real-world usage for such applications. SPARK2014 the latest, is a formally verified PL along with verification tools&#x2F;ecosystem made for these type of uses.<p>I am trying to write show control software in SPARK2014 at the moment. Show control are critical since it is used to power lifts and stage machinery as well as performer flying systems where safety and high-integrity software is critical. I like Rust, but I feel it is not quite there yet especially in terms of the number of real-world systems in this niche. I also find SPARK2014 easier to write and read. I have been programming since 1978, and although I gravitate towards terse, functional languages like Haskell, APL&#x2F;BQN&#x2F;J, I experience a lot of friction whenever I dive back into Rust. SPARK2014 is very verbose and Pascal-like, but this is tedium vs. confusion or confidence in what I am writing. I know AdaCore is working with Ferrous Systems to bring Rust more up to the features of Ada&#x2F;SPARK2014, but for now I needed to make a pragmatic choice based on real-world usage and ease of use and understanding.
评论 #37312962 未加载
binary132超过 1 年前
I’ve always been attracted to the idea of Ada (particularly SPARK) as a “really safe C-like”. I guess my main concern versus C is portability and ease of integrating libraries or exporting a usable C API, and secondarily the quality of the optimizer.
评论 #37293035 未加载
ggm超过 1 年前
A very long time ago The University of York (UK) secured the contract from the UK Science and Engineering Council (SERC) to write a unix Ada compiler.<p>It was a multi pass, 5-10 stage process (or more. I want to say 13 but time plays tricks) Very costly language to compile, in those days. (Vax 11&#x2F;780 running Unix 32V, a precursor to BSD and Ultrix by some years)<p>The story was it emitted an error&#x2F;warning code along the lines of &quot;Congratulations you have used the most abstruse feature of the ADA language&quot; -which the approval people made them take out before it got certified.<p>Wirth had a sabbatical residency in York around the time of the Ada language selection process, his choices didn&#x27;t make it through the strawman&#x2F;steelman process, I think they resurfaced in Modula-II. It was a pascal teaching department like many others in the UK of the time, so it made sense for him to spend time there. Modula-II is said to be a systems programming language too.<p>Ada was very hard to teach. The ideas of asynchronous, and exception handling didn&#x27;t sit very well on young minds. Maybe now they&#x27;re well enough understood to teach in Rust. At the time, the absence of a rationale around &quot;why&quot; was very strong. York had a miniature 2-lift engine model which it used as a proving ground for Ada programs and undergraduate projects. Lift sequencing is a bit of a black art in itself but if you put that optimality of &quot;which lift, which direction, which floor&quot; to one side, the mixture of real-time controls and sensors were probably a good fit. (lift == elevator for the other side of the Atlantic)<p>I remember some concern in the department the only logical endpoint for Ada was to code military flight control&#x2F;weapons&#x2F;radar systems, and people felt uncomfortable about the implicit participation in the UK War economy. This was during the time of the Greenham common protests against US nuclear forces on UK soil.<p>During the Alvey 5th Generation funding debacle (&quot;Catch up with Japan at all costs&quot;) there was another round of this using GEC400 computers, again very directly related to Uk MOD needs for weapons control systems and what I think became the Nimrod airborne radar. Probably signals processing is a very good fit for Ada. (I didn&#x27;t work on that project, or the compiler)<p>People said that the consistency of mapping data structures to devices, chip signal lines, real things, and the abstractions around that in types worked well in Ada. I found it horrendously complicated to understand. People might say C is a hack but the literal directness of C structs on a PDP11 or Vax to the underlying architecture worked pretty well to me. I guess the problem is that C was always too close to Assembler for some people. Bliss&#x2F;32 was the systems programming language of choice in Digital, and I think continued to be used to write VMS, although I read now it was almost entirely written in DEC Macro assembler.
评论 #37291233 未加载
musicale超过 1 年前
Memory safety might not be a bad idea for Linux in general.
评论 #37290064 未加载
zeroCalories超过 1 年前
Cool project for a proof of concept. That said, the kernel has so many unsafe features that making real world modules that are safe requires a lot of boilerplate to get around those features. Sometimes it&#x27;s impossible. Rust is only barely useable now after tons of work to make it viable.
ChrisArchitect超过 1 年前
(2016)
评论 #37289751 未加载