POSIX是什么?我读过维基百科上的文章,每次遇到这个词我都会去读。事实上,我从来没有真正理解它是什么。

有没有人可以通过解释“POSIX的需求”来解释给我听?


当前回答

In 1985, individuals from companies throughout the computer industry joined together to develop the POSIX (Portable Operating System Interface for Computer Environments) standard, which is based largely on the UNIX System V Interface Definition (SVID) and other earlier standardization efforts. These efforts were spurred by the U.S. government, which needed a standard computing environment to minimize its training and procurement costs. Released in 1988, POSIX is a group of IEEE standards that define the API, shell, and utility interfaces for an operating system. Although aimed at UNIX-like systems, the standards can apply to any compatible operating system. Now that these stan- dards have gained acceptance, software developers are able to develop applications that run on all conforming versions of UNIX, Linux, and other operating systems.

摘自《Linux实用指南》

其他回答

让我来给出粗鲁的“非官方”解释。

POSIX是一组标准,试图将“UNIX”和类UNIX系统与与它们不兼容的系统区分开来。它是由美国政府为采购目的而创建的。当时的想法是,美国联邦采购部需要一种方法来合法地规定各种投标和合同的要求,这种方法可以用来排除现有代码库或编程人员无法移植到的系统。

因为POSIX是事后写的……为了描述一组大致相似的竞争系统……它不是以一种可以实现的方式编写的。

因此,例如,微软的NT是用足够的POSIX一致性编写的,有资格参加一些投标…尽管POSIX子系统在实际可移植性和与UNIX系统的兼容性方面基本上是无用的。

在过去的几十年里,已经编写了各种UNIX标准。比如SPEC1170(指定了1170个函数调用,必须兼容地实现)和SUS(单一UNIX规范)的各种版本。

在大多数情况下,这些“标准”对任何实际技术应用都是不够的。它们大多是为了争论、法律纠纷和其他不正常的原因而存在的。

关于如何使操作系统与晚期UNIX操作系统兼容的规范(蓝图)(愿上帝保佑他!)这就是为什么macOS和GNU/Linux有非常相似的终端命令行、GUI、库等。因为它们都是根据POSIX蓝图设计的。

POSIX并不告诉工程师和程序员如何编码,而是告诉他们编码什么。

另一方面,POSIX代表“可移植操作系统接口”,POSIX是一组定义操作系统和应用软件之间接口的标准。POSIX类似于UNIX标准,它旨在确保为一个POSIX兼容的操作系统编写的软件可以在其他POSIX兼容的操作系统上运行而无需修改。

POSIX标准定义了一组在基于unix的操作系统中常见的系统调用、库和实用程序。

许多操作系统,包括Linux、BSD和macOS,都是POSIX兼容的,这意味着它们满足POSIX标准中定义的要求。

In 1985, individuals from companies throughout the computer industry joined together to develop the POSIX (Portable Operating System Interface for Computer Environments) standard, which is based largely on the UNIX System V Interface Definition (SVID) and other earlier standardization efforts. These efforts were spurred by the U.S. government, which needed a standard computing environment to minimize its training and procurement costs. Released in 1988, POSIX is a group of IEEE standards that define the API, shell, and utility interfaces for an operating system. Although aimed at UNIX-like systems, the standards can apply to any compatible operating system. Now that these stan- dards have gained acceptance, software developers are able to develop applications that run on all conforming versions of UNIX, Linux, and other operating systems.

摘自《Linux实用指南》

POSIX为操作系统或程序定义了一组标准。 目标是编写与类unix系统兼容的新软件。

例如,在Linux上运行的程序也可以在其他类unix系统上编译和运行,如Solaris、HP-UX和AIX等。

最流行的例子是GNU Bash,它100%符合POSIX和gawk实用程序。