1[section:concepts Concepts] 2In this section, some of the underlying concepts of the operating system used in this library, will be explained. 3In the following chapters we will presume knowledge of that. Though please note, 4that this is a short summary and not conclusive of everything that can be done. 5 6The goal of this library is to implement a portable wrapper, so that we will explain mostly what 7windows and posix have in common. 8 9[section:pipes Pipes] 10Pipes are a facility for communication between different threads, processes and in some cases machines, the operating system provides. 11 12The typical feature of a pipe is, that it is one channel, to which two handles are given, one for reading (source), one for writing (sink). 13In that it is different than other facilities (like sockets) and provides another way to manage the connectivity: if one side of the pipe is closed 14(i.e. the pipe is broken), the other is notified. 15 16Pipes are typically used for interprocess communication. The main reason is, that pipes can be directly assigned to the process stdio, i.e. stderr, stdin and stdout. 17Additionally, half of the pipe can be inherited to the child process and closed in the father process. This will cause the pipe to be broken when the child process exits. 18 19Though please note, that if the same thread reads and writes to a pipe, it will only talk to itself. 20 21[section:anonymous Anonymous Pipes] 22 23The most common pipes are anonymous. Since they have no name, 24a handle to them can only be obtained from duplicating either handle. 25 26In this library the following functions are used for the creation of unnamed pipes: 27 28* [@http://pubs.opengroup.org/onlinepubs/7908799/xsh/pipe.html posix] 29* [@https://msdn.microsoft.com/de-de/library/windows/desktop/aa365152.aspx windows] 30 31[endsect] 32 33[section:named Named Pipes] 34 35As the name suggests, named pipes have a string identifier. This means that a 36handle to them can be obtained with the identifier, too. 37 38The implementation on posix uses [@(http://pubs.opengroup.org/onlinepubs/009695399/functions/mkfifo.html fifos], 39which means, that the named pipe behaves like a file. 40 41Windows does provide a facility called [@https://msdn.microsoft.com/en-us/library/windows/desktop/aa365150(v=vs.85).aspx named pipes], 42which also have file-like names, but are in a different scope than the actual file system. 43 44[note The main reason named pipes are part of this library, is because they need to be internally used for asynchrounous communication on windows.] 45 46[endsect] 47 48[endsect] 49 50 51[section:process Processes] 52 53A process is an independently executable entity, which is different from a thread, in that it has its own resources. 54Those include memory and hardware resources. 55 56Every process is identified by a unique number[footnote it is unique as long as the process is active], called the process identification digit, `pid`. 57 58[section:exit_code Exit code] 59A process will return an integer value indicating whether it was successful. On posix 60there are more codes associated with that, but not so on windows. Therefore there is no such encoding currently in the library. 61However an exit code of zero means the process was successful, while one different than zero indicates an error. 62[endsect] 63 64[section:termination Termination] 65Processes can also be forced to exit. There are two ways to do this, signal the process to do so and wait, and just terminate the process without conditions. 66 67Usually the first approach is to signal an exit request, but windows - unlike posix - does not provide a consistent way to do this. Hence this is not part of the 68library and only the hard terminate is. 69 70[endsect] 71 72[endsect] 73 74[section:env Environment] 75 76The environment is a map of variables local to every process. The most significant one for this library 77 is the `PATH` variable, which contains a list of paths, that ought to be searched for executables. A shell will do this automatically, 78 while this library provides a function for that. 79 80[endsect] 81 82[endsect] 83