Each process begins with the execution of the three segments of memory: the code (text), and the stack. Segment data is divided into initialized data and uninitialized data (also known as BSS). Segment text is a segment of read-only, and is usually divided among all the processes running the file, while in the field of data and the stack can be achieved record and individually for each process. Segment text and initialized data to be read out of the executable file. The executable file is different in that it is normal file (and not a catalog, special file or symbolic link) and it installed one or more bits to allow access for execution. Each executable file is the title of exec, containing the magic number denoting the type of executable file. FreeBSD supports a number of executable formats, including the following. Files that should be read as interpreter. Files that can be performed directly, including AOUT, ELF and compressed gzip ELF. The executable file is first analyzed the structure of the revitalization of the image (imgact). The title of the file to be executed, passed on a list of registered activators image to detect a suitable format. When a suitable format is found, activates the appropriate way of preparing a file to perform U file into the first category, magic number (2 occupies the first byte file) is a sequence of two characters «#!», Followed by the path name to the interpreter, to be be used. This path name is currently limited to a constant-time compilation of 128 characters. For example, #! / Bin / sh refers to the Bourne shell. Activator image, which will be selected, handles call interpreters. It will download and run this interpreter, passed as an argument to the file name to be interpreted. To prevent infinite loop FreeBSD allows only one level of interpretation, and the interpreter file can not be interpreted For reasons of productivity, most files are in the second category and are immediately carried out. The information in the header directly execute the file includes architecture and operating system for which the executable file was created, and indicates whether it is statically configured or using shared libraries. Selected activator can be used in information such as knowledge of operating system, which was compile an executable file that otkonfigurirovat nucleus for the use of appropriate interpretation system calls during the program. For example, an executable file, built to run on Linux, can easily run on FreeBSD vector using redirects calls to emulation system calls Linux. The title also indicates the size of segments of text, initialized data, uninitialized data and additional information for debugging. Debug information is not used by the kernel or running the program. In the title should be a segment of text, followed by the image of initialized data. Uninitialized data does not contain executable files, because they can be created on demand using zeros memory filled. More detail you can see the domestic appliance in the library of BSD Unix documentation
