Programing

“POSIX”의 의미는 무엇입니까?

crosscheck 2020. 9. 29. 07:17
반응형

“POSIX”의 의미는 무엇입니까?


POSIX 란? 나는 Wikipedia 기사 를 읽었으며 용어를 만날 때마다 읽었습니다. 사실 나는 그것이 무엇인지 정말로 이해하지 못했다는 것입니다.

누구든지 "POSIX의 필요성"을 설명하여 제게 설명해 주시겠습니까?


POSIXUnix-y 운영 체제에서 제공하는 애플리케이션 프로그래밍 인터페이스 (및 명령 줄 셸 유틸리티와 같은 보조 문제)를 명확하고 균일하게 만들기 위해 IEEE 에서 지정한 표준 제품군입니다 . POSIX 표준에 의존하도록 프로그램을 작성할 때, 대규모 Unix 파생 제품군 (Linux 포함, 이에 국한되지 않음)간에 쉽게 이식 할 수 있습니다. Posix의 일부로 표준화되지 않은 일부 Linux API를 사용하는 경우 향후 해당 프로그램 또는 라이브러리를 다른 Unix-y 시스템 (예 : MacOSX)으로 이식하려는 경우 더 많은 시간이 소요됩니다.


POSIX 7이 정의 하는 가장 중요한 것

  1. C API

    다음 과 같이 ANSI C크게 확장합니다 .

    • 더 많은 파일 작업 : mkdir, dirname, symlink, readlink, link(하드 링크), poll(), stat, sync,nftw()
    • 처리 및 스레드 : fork, execl, wait, pipe, semaphors이 sem_*(공유 메모리 shm_*) kill, 스케줄링 매개 변수 ( nice, sched_*), sleep, mkfifo,setpgid()
    • 네트워킹 : socket()
    • 메모리 관리 : mmap, mlock, mprotect, madvise,brk()
    • 유틸리티 : 정규식 ( reg*)

    이러한 API는 또한 그들이 의존하는 기본 시스템 개념을 결정 fork합니다. 예를 들어 프로세스 개념이 필요합니다.

    대부분의 리눅스 시스템 호출 예를 들어, 특정 POSIX C API 함수를 구현하기 위해 존재하며, 리눅스 호환을 sys_write, sys_read... 그 콜의 대부분도하지만 리눅스 특정 확장자를 가지고있다.

    주요 Linux 데스크톱 구현 : glibc, 대부분의 경우 시스템 호출에 얕은 래퍼 만 제공합니다.

  2. CLI 유틸리티

    예 : cd, ls, echo, ...

    많은 유틸리티는 해당 C API 함수 (예 : mkdir.

    주요 리눅스 데스크톱 구현 : 작은 사람을위한 GNU로 coreutils은 큰 사람을위한 별도의 GNU 프로젝트 : sed, grep, awk, ... 일부 CLI 유틸리티는 배쉬에 의해 구현되는 기본 기능으로 .

  3. 쉘 언어

    예 : a=b; echo "$a"

    주요 Linux 데스크톱 구현 : GNU Bash .

  4. 환경 변수

    예 : HOME, PATH.

    PATH 슬래시가 PATH검색을 방지하는 방법을 포함하여 검색 의미가 지정됩니다 .

  5. 프로그램 종료 상태

    ANSI C는 성공, 실패 0하거나 나머지 구현을 정의한 상태로 둡니다.EXIT_SUCCESSEXIT_FAILURE

    POSIX는 다음을 추가합니다.

  6. 정규식

    BRE (Basic) 및 ERE (Extended)의 두 가지 유형이 있습니다. Basic은 더 이상 사용되지 않으며 API를 중단하지 않도록 유지됩니다.

    Those are implemented by C API functions, and used throughout CLI utilities, e.g. grep accepts BREs by default, and EREs with -E.

    E.g.: echo 'a.1' | grep -E 'a.[[:digit:]]'

    Major Linux implementation: glibc implements the functions under regex.h which programs like grep can use as backend.

  7. Directory struture

    E.g.: /dev/null, /tmp

    The Linux FHS greatly extends POSIX.

  8. Filenames

    • / is the path separator
    • NUL cannot be used
    • . is cwd, .. parent
    • portable filenames
      • use at most max 14 chars and 256 for the full path
      • can only contain: a-zA-Z0-9._-

    See also: what is posix compliance for filesystem?

  9. Command line utility API conventions

    Not mandatory, used by POSIX, but almost nowhere else, notably not in GNU. But true, it is too restrictive, e.g. single letter flags only (e.g. -a), no double hyphen long versions (e.g. --all).

    A few widely used conventions:

    • - means stdin where a file is expected
    • -- terminates flags, e.g. ls -- -l to list a directory named -l

    See also: Are there standards for Linux command line switches and arguments?

  10. "POSIX ACLs" (Access Control Lists), e.g. as used as backend for setfacl.

    This was withdrawn but it was implemented in several OSes, including in Linux with setxattr.

Who conforms to POSIX?

Many systems follow POSIX closely, but few are actually certified by the Open Group which maintains the standard. Notable certified ones include:

  • OS X (Apple) X stands for both 10 and UNIX. Was the first Apple POSIX system, released circa 2001. See also: Is OSX a POSIX OS?
  • AIX (IBM)
  • HP-UX (HP)
  • Solaris (Oracle)

Most Linux distros are very compliant, but not certified because they don't want to pay the compliance check. Inspur's K-UX and Huawei's EulerOS are two certified examples.

The official list of certified systems be found at: https://www.opengroup.org/openbrand/register/ and also at the wiki page.

Windows

Windows implemented POSIX on some of its professional distributions.

Since it was an optional feature, programmers could not rely on it for most end user applications.

Support was deprecated in Windows 8:

In 2016 a new official Linux-like API called "Windows Subsystem for Linux" was announced. It includes Linux system calls, ELF running, parts of the /proc filesystem, Bash, GCC, (TODO likely glibc?), apt-get and more: https://channel9.msdn.com/Events/Build/2016/P488 so I believe that it will allow Windows to run much, if not all, of POSIX. However, it is focused on developers / deployment instead of end users. In particular, there were no plans to allow access to the Windows GUI.

Historical overview of the official Microsoft POSIX compatibility: http://brianreiter.org/2010/08/24/the-sad-history-of-the-microsoft-posix-subsystem/

Cygwin is a well known GPL third-party project for that "provides substantial POSIX API functionality" for Windows, but requires that you "rebuild your application from source if you want it to run on Windows". MSYS2 is a related project that seems to add more functionality on top of Cygwin.

Android

Android has its own C library (Bionic) which does not fully support POSIX as of Android O: Is Android POSIX-compatible?

Bonus level

The Linux Standard Base further extends POSIX.

Use the non-frames indexes, they are much more readable and searchable: http://pubs.opengroup.org/onlinepubs/9699919799/nfindex.html

Get a full zipped version of the HTML pages for grepping: Where is the list of the POSIX C API functions?


POSIX is:

POSIX (pronounced /ˈpɒzɪks/) or "Portable Operating System Interface [for Unix]"1 is the name of a family of related standards specified by the IEEE to define the application programming interface (API), along with shell and utilities interfaces for software compatible with variants of the Unix operating system, although the standard can apply to any operating system.

Basically it was a set of measures to ease the pain of development and usage of different flavours of UNIX by having a (mostly) common API and utilities. Limited POSIX compliance also extended to various versions of Windows.


Let me give the churlish "unofficial" explanation.

POSIX is a set of standards which attempts to distinguish "UNIX" and UNIX-like systems from those which are incompatible with them. It was created by the U.S. government for procurement purposes. The idea was that the U.S. federal procurements needed a way to legally specify the requirements for various sorts of bids and contracts in a way that could be used to exclude systems to which a given existing code base or programming staff would NOT be portable.

Since POSIX was written post facto ... to describe a loosely similar set of competing systems ... it was NOT written in a way that could be implemented.

So, for example, Microsoft's NT was written with enough POSIX conformance to qualify for some bids ... even though the POSIX subsystem was essentially useless in terms of practical portability and compatibility with UNIX systems.

Various other standards for UNIX have been written over the decades. Things like the SPEC1170 (specified eleven hundred and seventy function calls which had to be implemented compatibly) and various incarnations of the SUS (Single UNIX Specification).

For the most part these "standards" have been inadequate to any practical technical application. They most exist for argumentation, legal wrangling and other dysfunctional reasons.


POSIX is a set of standards put forth by IEEE and The Open Group that describes how an ideal Unix would operate. Programmers, users, and administrators can all become familiar with the POSIX document, and expect a POSIX-complaint Unix to provide all of the standard facilities mentioned.

Since every Unix does things a little differently -- Solaris, Mac OS X, IRIX, BSD, and Linux all have their quirks -- POSIX is especially useful to those in the industry as it defines a standard environment to operate in. For example, most of the functions in the C library are based in POSIX; a programmer can, therefore, use one in his application and expect it to behave the same across most Unices.

However, the divergent areas of Unix are typically the focus, rather than the standard ones.

The great thing about POSIX is that you're welcome to read it yourself:

The Open Group Base Specifications Issue 7

Issue 7 is known as POSIX.1-2008, and there are new things in there -- however, Google-fu for POSIX.1 and such will allow you to see the entire history behind what Unix is.


POSIX is a standard for operating systems that was supposed to make it easier to write cross-platform software. It's an especially big deal in the world of Unix.


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.

From the book: A Practical Guide To Linux


This standard provides a common basis for Unix-like operating systems. It specifies how the shell should work, what to expect from commands like ls and grep, and a number of C libraries that C authors can expect to have available.

For example, the pipes that command-line users use to string together commands are specified in detail here, which means C’s popen (pipe open) function is POSIX-standard, not ISO C-standard.


Posix is more as an OS, it is an "OS standard". You can imagine it as an imaginary OS, which actually doesn't exist, but it has a documentation. These papers are the "posix standard", defined by the IEEE, which is the big standard organization of the USA. The OSes implementing this specification are "Posix-compliant".

Government regulations prefer Posix-compliant solutions in their investments, thus being Posix-compliant has a significant financial advantage, particularly for the big IT companies of the USA.

The reward for an OS being fully posix compliant, that it is a guarantee that it will compile and run all Posix-compliant applications seamlessly.

Linux is the most well-known one. OSX, Solaris, NetBSD and Windows NT play here as well. Free- and OpenBSD are only "nearly" Posix-compliant. The posix-compliance of the WinNT is only a pseudo-solution to avoid this government regulation above.


POSIX stands for Portable Operating System Interface, and is an IEEE standard designed to facilitate application portability. POSIX is an attempt by a consortium of vendors to create a single standard version of UNIX.


POSIX defines set of standards for an operating system or a program. The goal is to write new software that is compatible with UNIX-like systems.

For example a program runs on Linux is also can be compile and run on other UNIX-like systems like Solaris, HP-UX, and AIX etc..

The most popular examples are GNU Bash which is 100% POSIX compliance and gawk utility.


Posix governs interoperability, portability, and in other areas such as the usage and mechanism of fork, permissions and filesystem standards such as /etc, /var, /usr and so on . Hence, when developers write a program under a Posix compliant system such as for example Linux, it is generally, not always, guaranteed to run on another posix compliant system such as IBM's AIX system or other commercial variants of Unix. Posix is a good thing to have as such it eases the software development for maximum portability which it strives for. Hope this answer makes sense.

Thanks to Jed Smith & Tinkertim for pointing out my error - my bad!!! :(


A specification (blueprint) about how to make an OS compatible with late UNIX OS (may God bless him!). This is why macOS and GNU/Linux have very similar terminal command lines, GUI's, libraries, etc. Because they both were designed according to POSIX blueprint.

POSIX does not tell engineers and programmers how to code but what to code.


Some facts about POSIX that are not so bright.

POSIX is also the system call interface or API, and it is nearly 30 years old.

It was designed for serialized data access to local storage, using single computers with single CPUs.

Security was not a major concern in POSIX by design, leading to numerous race condition attacks over the years and forcing programmers to work around these limitations.

Serious bugs are still being discovered, bugs that could have been averted with a more secure POSIX API design.

POSIX expects users to issue one synchronous call at a time and wait for its results before issuing the next. Today's programmers expect to issue many asynchronous requests at a time to improve overall throughput.

This synchronous API is particularly bad for accessing remote and cloud objects, where high latency matters.

참고URL : https://stackoverflow.com/questions/1780599/what-is-the-meaning-of-posix

반응형

'Programing' 카테고리의 다른 글

Python에서 싱글 톤 만들기  (0) 2020.09.29
Entity Framework와 LINQ to SQL  (0) 2020.09.29
Python 스크립트 종료  (0) 2020.09.28
% ~ dp0은 무엇을 의미하며 어떻게 작동합니까?  (0) 2020.09.28
What does in XML mean?  (0) 2020.09.28