What is the POSIX?

Asked

Viewed 7,017 times

21

I know the acronym Portable Operating System Interface (POSIX), but what is it? Does it have to do with UNIX? Windows cannot be POSIX?

What this matters to the developer?

1 answer

27


What is?

POSIX, as the name suggests, is a standard for determining common interfaces between operating systems.

POSIX is nothing more than a way to dictate several expected features of an operating system. Usually when we write and compile programs in C and C++ it is common to take as truth some system behaviors.

For example, when using a command interpreter that is POSIX-compatible, it is expected that it is possible to invoke the ls command.

Where did you come from?

In the 70s and 80s several initiatives of operating systems began to emerge, and as each company/developer made its own interfaces it was realized that a standardization was necessary.

To try to make programs more compatible across multiple operating systems, POSIX was written. It basically defines system calls, basic commands (such as awk and echo), a shell script compatible command interpreter, various expected system behaviors (such as signals, Pipes, basic process management, etc).

Note: It is important to remember that Richard Stallman is one of the authors of POSIX.

What UNIX has to do with POSIX?

UNIX served as the basis for the standard as it was more neutral so to speak. This does not mean that it is 100% compatible.

Windows is compatible with?

In a way, we can say yes. If you read the pattern carefully, you’ll notice that the Linux kernel doesn’t meet the 100% standard either. The big difference between Windows and Linux is that in Windows we have much less compatibility.

Note: macOS since version 10.5 Leopard is certified POSIX compliant.

What this matters to the developer?

Usually when we write a cross-platform program it is necessary to study which interfaces are implemented and which are not. Usually we have libraries that deal with these differences for the programmer.

It is very common today to avoid using Shell Script when we aim at Windows as it has no support. That’s why it’s so common to see configuration scripts in Python or even a shell script and another in bat.

  • Excellent explanation, congratulations.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.