User Identity and Access Management – What’s the Deal with IDP?
What user identity is? Why managing access is essential for businesses? How an IDP (Identity Provider) works? You will find the answer to these questions in the article.
In this article, we will tell you a bit about what compilation and code interpretation are. What are the differences and similarities between both approaches? If you’re eager to broaden your horizons and become a better programmer, we invite you to read on.
Basic Concepts
Due to the confusion surrounding these concepts within this topic, we propose starting by familiarizing yourself with the definitions we sourced from the Internet. This way, we will ensure that we understand the same phenomena under the same terms.
Compilation
Simply put, compilation is the process of translating a programming language into another language or machine code. Computers cannot understand the programming language that humans understand. Therefore, a compiler acts as a “translator” capable of producing a file in machine code, which is understood by a specific processor operating within a given architecture.
Figure 1 – High-level depiction of compilation (Source: EngMicroLectures).
In other words, there are two versions of your program – one that you understand and the computer does not (source file, e.g., “test.c”). And then there’s the version in machine code, which you don’t understand, but the computer does. So, a compiler is a “magical program” that allows us to translate “human-readable code” into “computer-readable code.” After being launched, the program is loaded from the disk memory into the operational memory (RAM) and then executed by the processor.
Figure 2 – Program execution on the CPU, reading instructions from computer memory.
Is it really that simple?
Of course, the above models are a significant simplification of this complex subject. Upon delving into the process, it becomes clear that it involves many steps and is more intricate, as illustrated in the diagram below.
Figure 3 – A more detailed representation of compilation based on C++ (Source: Stackoverflow).
The preprocessor is a program that is part of the compilation driver, processing the source code according to specific rules called directives, resulting in source code ready for compilation. The C++ standard fully describes the correct operation of the preprocessor.
We also have a compiler, a program that converts a high-level language into assembly code tailored to a specific architecture. Subsequently, all files are transformed into an “object binary” form (think of this as an intermediate state between assembly and machine code).
In the end, an executable is created, a binary file that can be run on a specific system with a particular processor.
Example
Let’s consider the following example to familiarize ourselves more closely with the practical functioning of a compiler. We’ll use the C language and the GCC compiler on a Linux system.
Figure 4 – This is a simple program written in C. The program uses a function, two constants, and an argument to print “Hello Alex” on the screen.
Figure 5 – Preprocessor output after executing instructions with the -E and -P switches.
We stop after preprocessing and see constants resolved to specific values. Variables remain unchanged. Additionally, function headers are included in the file using the #include <stdio.h> directive.
Figure 6 – Compilation to assembly language.
To proceed to the next step with the help of the GCC compiler, let’s compile our program into assembly language. The -S option in GCC generates an assembly file.
Figure 7 – Contents of the test.s file -> x86 assembler.
Let’s compile the source C file again into ASM (.s), specifying the file name after the “-o” parameter. Then, compile testASM.s into an object file (test.o). The .o file can be compiled from both an assembly file and a C file using the GCC compiler. With the -c option, we take a step further and compile our code into an object file “.o”.
Figure 8 – Compilation to assembly language, then to an object file.
Figure 9 – Contents of test.o – Text is unreadable in a regular editor.
Generated files can be examined using a hex editor. Here’s the “test.o” file. It has 100 lines.
Figure 10 – Object file in a hexadecimal editor.
Now let’s link the .o file to an executable file and try to run the program. The linker resolves dependencies of individual files and merges everything into a single executable file.
Figure 11 – End of the compilation process, program execution.
Using a binary editor, you can see that the executable file, due to the included dependencies, has around 1000 lines, which is significantly larger than the object file with just 100 lines.
Summary
We hope that we have presented to you in an understandable manner how compilation works. Next week, we will continue with topics related to low-level program operations and file formats. If you are interested, feel free to join us!
Sources:
User Identity and Access Management – What’s the Deal with IDP?
What user identity is? Why managing access is essential for businesses? How an IDP (Identity Provider) works? You will find the answer to these questions in the article.
Security
Hey, hey... Programmer, this is another article for you! The second part of the article on design patterns. Get to know Adapter and Memento.
Programming
Programmer, this article is for you! Grab a handful of useful information about design patterns.
Programming