操作系统,内核,应用程序和程序集 [英] OS, Kernel, Applications, and Assembly

查看:78
本文介绍了操作系统,内核,应用程序和程序集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将这四件事组合在一起:

1)汇编是直接与硬件对话的语言,在汇编和引脚电压之间没有其他语言.

2)操作系统的内核是操作系统使用的一组汇编功能.

3)操作系统向应用程序提供功能(系统调用?),然后系统调用利用内核来完成工作. (例如,如果您试图通过将某些代码包装在对象或函数中(JS背景)来缩小某些代码的范围,则OS会包装内核.)

我的问题:

4a)应用程序可以编译为OS功能吗?
4b)应用程序可以编译到汇编中吗?如果是这样,那么操作系统的目的是什么?

侧面问题:
1)到3)是正确的吗?

解决方案

1)汇编语言将汇编语言(通常为纯文本")转换为另一种语言(机器代码).机器代码是CPU本身执行的.在执行之前/执行过程中,CPU可能会将机器代码转换为其他语言(例如微操作).

2)操作系统的内核是机器代码;所使用的原始语言(源代码)在经过编译器转换为机器代码之前可能已经是汇编语言,C或C ++或其他任何语言.

3)大多数内核确实提供了进程(应用程序)可以使用的类似函数"的接口;但这不是一个严格的要求,也没有什么能真正阻止内核使用不喜欢类似"的接口(例如,可能基于流的数据包或消息).

4a)进程(应用程序)通常使用系统库,其中系统库使用内核的API.这也不是严格的要求.例如;一个进程可能会直接使用内核的API,而无需使用系统库(在相似但不同的内核之间会损失一些可移植性).

4b1)进程(应用程序)通常被编译为机器代码.这也不是严格的要求-例如内核可能会解释字节码或其他内容(Lisp机器).

4b2)操作系统"一词定义不清,目的也不明确(不同的人有不同的定义,等等).我个人认为OS的主要目的是提供方便的抽象.这样,每个进程(应用程序)都不必为每个可能的设备都包括设备驱动程序,而只需使用漂亮的抽象(打开/读取/写入文件,通过网络发送/接收数据包等)即可.

注意:应用程序只是一种进程,其他类型的进程包括实用程序,守护程序,服务器,服务以及(对于微内核系统)设备驱动程序,文件系统等.

I'm trying to piece together how these four things work together:

1)Assembly is the language which talks directly to hardware, there is no other language between Assembly and voltages on pins.

2)The Kernel of an OS is a set of Assembly functions that the OS uses.

3)An OS makes functions available to Applications (system calls?), the system calls then utilize the Kernel to do stuff. (Like if you're trying to reduce the scope of some code by wrapping it up in an object or function (JS background). The OS wraps up the Kernel).

My Question:

4a) Applications compile to OS functions?
4b) Applications compile to Assembly? And if so, then what is the purpose of the OS?

Side-question:
Are 1) through 3) correct?

解决方案

1) Assembly language (typically "plain text") is converted into a different language (machine code) by an assembler. Machine code is what the CPU itself executes. The CPU may convert machine code into a different language (e.g. micro-ops) before/during executing it.

2) The kernel of an OS is machine code; where the original language used (source code) may have been assembly or C or C++ or anything else before it was converted into machine code by a compiler.

3) Most kernels do provide a "function like" interface that processes (applications) can use; but this isn't a strict requirement and nothing really prevents a kernel from using a "not function like" interface (e.g. maybe based on packets or messages of streams) instead.

4a) Processes (applications) typically use system libraries, where the system libraries use the kernel's API. This isn't a strict requirement either. For example; a process may use the kernel's API directly without a system library (with some loss of portability between similar but different kernels).

4b1) Processes (applications) are typically compiled to machine code. This is also not a strict requirement - e.g. a kernel might interpret byte-code or something (Lisp machines).

4b2) The term "operating system" isn't well defined, and neither is its purpose (different people have different definitions, etc). I personally consider the main purpose of OS to be providing convenient abstractions; so that every process (application) doesn't have to include a device driver for every possible device, and can just use nice abstractions (to open/read/write files, send/receive packets over a network, etc) instead.

Note: An application is only one kind of process, other types of process include utilities, daemons, servers, services, and (for micro-kernel systems) device drivers, file systems, etc.

这篇关于操作系统,内核,应用程序和程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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