什么是完全用汇编编写一个操作系统的优势在哪里? [英] What's the advantage of writing an OS entirely in assembly?

查看:176
本文介绍了什么是完全用汇编编写一个操作系统的优势在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MenuetOS 是完全用汇编编写的操作系统的一个实例。是否有任何优势,如C汇编写它,而不是低级语言的?

MenuetOS is an example of an OS written entirely in Assembly. Is there any advantage to writing it in Assembly instead of a low-level programming language such as C?

推荐答案

与操作系统的接口往往是在它被写在最简单的语言 - C的UNIX和Win32,C ++中的BeOS等MenuetOS专门设计使开发装配应用方便,所以最好的选择是写汇编操作系统本身。

Interfacing with an OS tends to be easiest in the language it was written in -- C in UNIX and Win32, C++ in BeOS, etc. MenuetOS was designed specifically to make developing assembly applications easy, so the best choice was to write the OS itself in assembly.

有关它们不旨在是通用,如嵌入式系统和微控制器,以C的机械翻译(即编译)引入到组件可以是不可接受的开销操作系统。编译器并不像人类一样聪明,特别是当它涉及到各种嵌入式平台所需繁琐一点优化,直接用汇编编写,保证不会有一个编译器打乱精心设计的算法。

For OSes which aren't intended to be general-purpose, such as embedded systems and microcontrollers, the overhead introduced by mechanical translation (ie compilation) of C into assembly can be unacceptable. Compilers aren't as smart as humans, especially when it comes to the sorts of fiddly little optimizations required on embedded platforms, and writing directly in assembly guarantees there won't be a compiler mucking up carefully-designed algorithms.

这篇关于什么是完全用汇编编写一个操作系统的优势在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆