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, 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.
The IT industry is developing rapidly and is subject to fashion technologies and languages. Fundamental concepts — for example, computing models, virtual memory, compilation, and program building — change much less frequently. Understanding how the basic principles of such concepts are manifested in one 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 the 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 "iron", 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 course “Low Level Programming”. Here students will have to work with an 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:
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 primarily from 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 the Intel64 software developer manual and System V AMD64 ABI.
What's inside the course
In simple terms, this course can be detailed as follows (with reference to the topics that were indicated 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, common compiler code optimizations, and the mechanics of a typical implementation of C constructions at the assembler level (in other words, the demonstration of the idea “C is a high-level assembler”) are affected.
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 details
We break lectures by jointly writing code 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 the famous messenger, and the 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 a topic agreed with the teacher. After going through the code review and posting on GitHub, they record a video with a demonstration of the project (projects implemented since 2014 are collected on this channel, GitHub links are in the description).
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 done 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 compiler for C language.
This course helps to learn to look at a task from an adequate level of abstraction and, let's say, by convention, not to try to “write web applications in assembly language”.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 that was inspired by the teaching of this course (it was published in English, Japanese, and Portuguese).