How is familiarity with the LLP at ITMO University: the course "Low-level programming"

    Most popular programming languages ​​are high-level languages. For example, Java, Python or C #. Of course, it is possible to program on them and weakly presenting how different levels of abstraction actually work. But for a good IT-specialist it is important to understand how the platform with which he interacts is organized, how the development environment, the compiler, the debugger functions. This leads us to talk about low-level programming.

    LLP (low-level programming) is a convenient way to deal with how to write reliable, fast, compact and efficient programs. Our students study assembler and C primarily to get a better sense of how software works.

    Photo by Pablo BD CC BY-SA

    Why do you need to know

    The IT industry is developing rapidly and is subject to fashion technologies and languages. Fundamental concepts — for example, computation models, virtual memory, compilation, and program assembly — change much less frequently. Understanding how the basic principles of such concepts manifest themselves in a single programming language will help to quickly learn a similar language if it is required for work. LLP in this case makes it clear how the program from the source text becomes a set of machine instructions, and how they are executed on the computer. In turn, familiarity with the mechanisms of memory management and principles of the compiler will help to write code that is less demanding of computational resources.

    Clarification:We often have to deal with the thesis that LLP is only hardware programming and similar tasks. This is not true.

    Where can I find LLP in practice:

    • Trading . Trading on the stock exchange makes programs with incredibly high demands on the reaction time to market fluctuations. Due to the “remoteness” of high-level languages ​​from “hardware”, it is very difficult to predict the response time of a program to an external event. Therefore, LLP is involved here to provide control over the speed of transactions.

    • Robotics . Computational resources are limited here, so the requirements for software quality and code compactness are high. Conventional software development approaches do not always work here, and often development can be done in C or another system language.

    • System software . These are OS, compilers (JIT, AOT), browsers (today they have become a platform for creating complex applications). His work is not always noticeable to the inhabitant, but creates an infrastructure for application software.

    How we prepare for this

    Our students of directions 09.03.01 "Computer science and computer engineering" and 09.03.04 "Software engineering" study a number of disciplines related to low-level programming. These are operating systems, system software (including in the Unix environment), development of compilers, virtualization technologies, etc. The

    starting point is the “Low Level Programming” course. Here students will have to work with assembler and C. In parallel - they learn the process of compiling and executing programs. The course goes in the format "from setting the task to the finished program." The main goal of the course is to get an idea of ​​how the presentation of the program changes during transitions between:

    • writing code;
    • preprocessing and compilation;
    • linking;
    • execution and debugging.

    Photo CC BY-SA

    From students who come to the course, we expect minimal programming experience in high-level languages ​​(for example, Java or C #). And recommend the following online courses:

    The course “Low-Level Programming” is read mainly by a book that is written specifically for our students. The book is published in English and translated into Japanese and Portuguese. We also often work with Intel64 software developer manual and System V AMD64 ABI.

    What's inside the course

    In simple terms, this course can be detailed as follows (in relation to those topics that were marked above):

    • Writing code . This implies fluency in assembler for Intel 64 (NASM, Linux) and C11. Here we study computational models, give extensive recommendations on the style of writing code.

    • Preprocessing and compilation . The NASM and C preprocessors are studied, formal grammars are common, common code optimization by the compiler, as well as the mechanics of a typical implementation of C constructs at the assembler level (in other words, the demonstration of the idea C is a high-level assembler).

    • Linking (linking) . Static and dynamic. In practice, the ELF format is studied - students explore what the linker and dynamic loader do exactly. By the way, a separate mini-course was devoted to this.

    • Run and debug the program . Here we understand how these tasks are related to the computer architecture, the virtual memory device and the privileged mode, interrupts, and system calls. In addition, we consider how gdb is used (a powerful debugger that allows you to “look under the hood” of any program).

    Important organizational nuances

    We break lectures by writing code together and studying compiled files using tools from binutils (objdump, readelf) or gdb. During the lecture (and not only), students ask questions both verbally and into the channel of the course in a famous messenger, and teachers answer them as soon as possible.

    As a practical training, students perform laboratory work. Sometimes students in the learning process want to develop something of their own, personally interesting to them (a game, a program to control the robot, a compiler, etc.).

    Therefore, as a replacement for the exam, students can make an individual project on the topic agreed with the teacher. After going through the code review and posting on GitHub, they record a video demonstrating the project. (this channel contains projects implemented since 2014, links to GitHub are in the description).

    Example of a student of the course: analog levitron (a detailed story about the project on Habré )

    Some other projects completed on the basis of the course:

    About the teacher

    On the course, a whole team of teachers interacts with students who give lectures, take laboratory work, and advise students. Senior students participate in discussions and help current students to understand the subtleties of low-level programming.

    The main work on the preparation of materials for the course was made by Igor Zhirkov, the author of the textbook on it. Igor studied at ITMO University and Academic University, received a master's degree in ITMO in 2016. His areas of interest are type theory, mathematical logic, programming languages, and low-level programming. His main current project is related to the formal verification of C language refactorings using Coq and the CompCert verified C compiler.

    This course helps to learn how to look at a task from an adequate level of abstraction and, let's say conditionally, not to try to “write web applications in assembler”. We try to approach the study of C and assembler in terms of understanding the concepts associated with these "tools" and their environment - operating systems and CPUs.

    By the way, here we can find a book, which was inspired by the teaching of this course (it was published in English, Japanese and Portuguese).

    Also popular now: