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.
Photo Pablo BD 3r3114. 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, computing models, virtual memory, compilation, and building programs — 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.
Specification: 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:
3r3189. Trading [/b] . 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.
3r3189. Robotics [/b] . 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.
3r3189. System Software 3r3190. . 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 ??? "Computer Science and Computer Engineering" and ??? "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. 3r-3285.
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: 3r-3285.
preprocessing and compilation;
execution and debugging.
Photo hackNY.org 3r3114. 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:
"3r33130. Java. Basic course
“ Introduction to computer architecture: Elements of OS »Kirill Krinkin
The “Low Level Programming” course is taught mainly in 3r-3287. book
which 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 indicated above): 3r-3285.
3r3189. Writing code [/b] . 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.
3r3189. Preprocessing and compiling [/b] . 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”).
3r3189. Linking (linking) [/b] . 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.
3r3189. Run and debug program [/b] . 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 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 the topic agreed with the teacher. After going through the code review and posting on GitHub, they write 3r3208. video demonstration of the project
(this channel contains projects implemented since 201? GitHub links are in the description).
[i] Example of a student course: analogue levitron (3r33225. A detailed story about the project on Habré
About the teacher
During 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 of the course 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 verified CompCert compiler for the C language. 3r3285.
Some of the projects which were especially remembered to us are
The Tanchiki clone with multiplayer over the network
a clone of the classic game "Asteroids" with vector graphics
Forth on the STM32 microcontroller.
emulator arcade machine CHIP-8 under UEFI
virtual file system to work with Telegram
Ridiculously Awesome Shell
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 is we can find a book that inspired the teaching of this course (it was published in English, Japanese, and Portuguese).
It may be interesting
I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own Blog Engine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it.