rust_微软如何采用Rust

rust

重点 (Top highlight)

Microsoft has one of the largest C/C++ codebases in the world. All of its core products from Windows and Office to the Azure cloud run on it. Unsurprisingly, since C++ is not a memory-safe language, a lot of memory bugs popup in their codebase, and a lot of time has to be spent fixing them. Last year, Microsoft began looking at alternative programming languages that could help fix their memory safety issues. As a result of these pursuits, Microsoft has begun experimenting, and in some cases integrating, Rust into their codebase. Rust is a relatively new programming language that promises the same low-level performance of C and C++ with a feature set expected from a modern programming language. Microsoft thinks Rust has potential, and here is how they are integrating it into their products.

Microsoft拥有世界上最大的C / C ++代码库之一。 从Windows和Office到Azure云的所有核心产品均在其上运行。 毫不奇怪,由于C ++不是一种内存安全的语言,因此在其代码库中会弹出很多内存错误,并且必须花费大量时间来修复它们。 去年,Microsoft开始研究可以帮助解决其内存安全问题的替代编程语言。 作为这些追求的结果,Microsoft已开始尝试在某些情况下将Rust集成到其代码库中。 Rust是一种相对较新的编程语言,它具有与C和C ++相同的低级性能,并具有现代编程语言所期望的功能集。 微软认为Rust具有潜力,这就是他们将Rust集成到产品中的方式。

在Rust中重写Windows (Rewriting Windows in Rust)

Ok, they aren’t rewriting all of Windows in Rust just yet; but, they are interested in seeing how Rust will fit into its ecosystem. Microsoft determined that 70% of security patches pushed to computers are to fix memory-related bugs and believes that Rust would’ve been able to catch these bugs during the development phase. As a result, they tasked some engineers to rewrite some components of Windows in Rust to get some developer sentiment.

好的,他们还没有在Rust中重写所有 Windows。 但是,他们有兴趣了解Rust将如何适应其生态系统。 微软确定推送到计算机的安全补丁程序中有70%用于修复与内存相关的错误 并相信Rust在开发阶段就能够捕获这些错误。 结果,他们要求一些工程师用Rust重写Windows的某些组件,以引起开发人员的注意。

Microsoft has unfortunately kept the name of the components being rewritten secret, however, one engineer described that he was working on a “low-level system of Windows.” This shows the faith Microsoft has in Rust’s potential. They aren’t just looking to rewrite some of their small services or native Windows app, but possibly core components of the operating system.

不幸的是,Microsoft一直将要重写的组件的名称保密,但是,一位工程师称他正在开发“ Windows的低级系统”。 这表明微软对Rust的潜力充满信心。 他们不仅希望重写某些小型服务或本机Windows应用程序,还可能希望重写操作系统的核心组件。

The engineers described their work with Rust as “generally positive” but did note that some important features available in C were missing for Rust. The engineers, however, do think that it’s worth helping to develop such features for Rust. Intel has already begun working on bringing Rust to feature-parity with C, and Microsoft could join them on this effort. Since some features of C are missing from Rust, the team found that Rust will be best suited for new or recently-developed Windows components. It wouldn’t be surprising if Microsoft fully committed to migrating part of their codebase to Rust. They’re already building a standard Windows library for Rust that will have all of the capabilities of the C++ version. Linux is also considering migrating some of its kernels over to Rust, so I wouldn’t be shocked if a race sprung up between the two operating systems to see which one could push Rust code to production first.

工程师将他们在Rust上的工作描述为“总体上是积极的”,但确实注意到Rust中缺少C中可用的一些重要功能。 然而,工程师们确实认为为Rust开发这样的功能值得帮助。 英特尔已经开始着手将Rust与C进行功能奇偶校验,微软可以加入他们的行列。 由于Rust缺少C的某些功能,因此该团队发现Rust最适合新的或最近开发的Windows组件。 如果Microsoft完全致力于将其部分代码库迁移到Rust,也就不足为奇了。 他们已经在为Rust构建标准的Windows库,该库将具有C ++版本的所有功能。 Linux也正在考虑将其某些内核迁移到Rust,因此,如果在两个操作系统之间展开激烈的竞争,看看哪个操作系统可以将Rust代码首先投入生产,我不会感到震惊。

将Rust整合到Azure服务中 (Incorporating Rust into Azure services)

DeisLabs, one of Azure’s incubators, focuses on building tools for Kubernetes and recently chose Rust to build their new product Krustlet, a service that allows developers to run multiple WebAssembly modules in Kubernetes. Kubernetes was developed by Google and written in Go. As a result, most engineers tend to stick with Go when writing their Kubernetes components, so it’s quite surprising that DeisLabs chose Rust.

作为Azure孵化器之一的DeisLabs专注于为Kubernetes构建工具,最近选择了Rust构建其新产品Krustlet,该服务使开发人员可以在Kubernetes中运行多个WebAssembly模块。 Kubernetes由Google开发并用Go编写。 结果,大多数工程师在编写Kubernetes组件时倾向于坚持使用Go,因此DeisLabs选择Rust令人感到惊讶。

In the end, the decision seemed to pay off. While employees did note that the shift to Rust was difficult — noting the uniqueness of Rust’s ownership philosophy — it only took the team a month to return to full efficiency. They found that they were writing fewer tests for null values and debugging fewer problems. The engineers were also impressed by Rust’s compiler, which they claim would’ve caught security flaws found in another one of their projects that Go’s compiler failed to find. They concluded that more teams should consider working with Rust in the future and that it could be better suited for Kubernetes development than Go.

最后,这个决定似乎是有回报的。 尽管员工确实注意到向Rust转移很困难-注意到Rust的所有权理念的独特性-团队仅用了一个月的时间就恢复了全部效率。 他们发现他们为空值编写的测试更少,并且调试的问题更少。 Rust的编译器也给工程师们留下了深刻的印象,他们声称Rust会发现Go的编译器未能找到的另一个项目中发现的安全漏洞。 他们得出的结论是,将来会有更多的团队考虑使用Rust,并且与Go相比,它更适合Kubernetes开发。

一种新的编程语言 (A new programming language)

A little while ago, Microsoft had investigated creating their programming language inspired by Rust. One of the leaders of the project is the primary maintainer of C#, so it seems likely that the language is a version of Rust with syntax more similar to the C-family of programming languages. This language, dubbed Project Verona, is aimed to address memory-related bugs in systems programming. Some speculate that Project Verona could eventually find its way into a lot of major Microsoft products, such as Windows, Xbox, and Azure.

不久前,微软曾研究过如何在Rust的启发下创建他们的编程语言。 该项目的负责人之一是C#的主要维护者,因此该语言似乎是Rust的一种版本,其语法更类似于C语言的编程语言。 该语言被称为Project Verona,旨在解决系统编程中与内存相关的错误。 有人推测,维罗纳计划最终可能会进入许多主要的微软产品,例如Windows,Xbox和Azure。

Ultimately, Microsoft still doesn’t have any use-cases for Project Verona. They do claim that the language is already “completely memory safe.” However, Microsoft remains in favor of using Rust instead. It already has a community and the support of companies like Mozilla and Intel. Joining forces with those companies would allow Rust to become much more powerful much quicker.

最终,Microsoft仍然没有针对Verona项目的用例。 他们确实声称该语言已经“完全内存安全”。 但是,Microsoft仍然赞成使用Rust。 它已经有了社区,并得到Mozilla和Intel等公司的支持。 与这些公司合作将使Rust更快地变得更强大。

The future is very bright for Rust. With large companies backing it and a growing community, it has a very promising future. It wouldn’t be surprising to hear over the next couple of months the different ways Microsoft plans to incorporate Rust into its company. Rust is also well-optimized for microcontrollers and IoT devices, and we can expect to hear the use-cases companies in these spaces have found for Rust.

Rust的未来非常光明。 有了大公司的支持和不断发展的社区,它的前景非常光明。 在接下来的几个月中,听到微软计划将Rust纳入其公司的不同方式也就不足为奇了。 Rust还针对微控制器和IoT设备进行了优化,我们可以期待听到这些领域的公司为Rust找到的用例。

翻译自: https://medium.com/the-innovation/how-microsoft-is-adopting-rust-e0f8816566ba

rust

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值