Computing Reviews
Today's Issue Hot Topics Search Browse Recommended My Account Log In
Best of 2016 Recommended by Editor Recommended by Reviewer Recommended by Reader
Search
Low-level programming : C, assembly, and program execution on Intel 64 architecture
Zhirkov I., Apress, New York, NY, 2017. 435 pp. Type: Book (978-1-484224-02-1)
Date Reviewed: Mar 7 2018

Despite the ease of programming in high-level languages, there will always be things that are best programmed in low-level languages (such as speed, resource usage, and size). Assembler is certainly the lowest language, but assembler programs are far from portable across architectures, and at the very lowest level they can be difficult to port even in a consistent processor family.

Thus C (and an interesting emerging candidate, Rust) enters the picture. C is a nice language, far easier than assembler for a program of any size, but still providing low-level access to the hardware. C has also been around for more than a few years and there are lots of advantages for low-level programming: a huge installed base, compilers for almost every instruction set around, many options for libraries, access to inline assembler, and just the right level of abstraction for many tasks.

The problem, of course, is that the more control a language gives a programmer, the greater the capability to make mistakes; this requires very careful programming. Mistakes that higher-level languages prohibit (or at least make very hard to commit) are cheerfully accepted by the compiler and libraries, and they often provide for fatal errors, security problems, or (worst) errors in what actually gets done.

This book covers C as a low-level language on Intel architectures, as well as just enough assembler to make trouble. Programs are written with Linux as a target, which simplifies a number of things.

There are three main parts.

Part 1, “Assembly Language and Computer Architecture,” covers Intel assembler and uses simple examples to show how to do subroutine calls and system calls, how compiling/assembling works, some basic notions of stored programming and programs, and the basics of “architecture”: bits, bytes, hardware data types, registers, and protection. And of course: “Hello World.”

Part 2, “The C Programming Language,” covers the basics of C, syntax, loops, conditionals and functions, arrays, pointers, built-in data types, and programmer-defined data types. And, of course, “Hello World.” There’s a nice chapter on good practices, which are essential to working C programmers.

Part 3, “Between C and Assembly,” covers the interactions of C and assembly, considering things like the function calling conventions and symbol tables (and fun tools like objdump and ld). There’s also a chapter on performance, how to get performance, and a bit about measuring it. Finally, there’s a chapter on threading including sections on locks, mutexes, and other valuable notions.

There are several appendices including coverage of gdb, make, system calls, and performance testing.

There are a number of small problems and errors. In one place, the description of the code sample does not seem to match what the code sample does. The section on the C preprocessor needs rather a bit of work--there’s nothing incorrect, but a reader might end up with some wrong ideas. In the section on good code practices, the text says to avoid changing the value of global variables, and then provide a sample function to traverse a linked list and apply a function to every element. But the function is declared as having no return value, so to be even remotely usable, it needs to change global variables. Surely a sample “reduce” or “map” would be better examples (as well as reflecting current interests in functional programming). In the same sample code (but another function), a return value of zero looks like it is meant to signal an error; however, in the context, a return value of zero is a quite reasonable value (yes, C does make this kind of thing difficult, though setjmp and longjmp are discussed about 20 pages later).

Memory management is discussed, but in insufficient detail for a C programmer. Effective and safe programming in C is helped quite a bit by understanding how memory management, and in particular malloc, actually works. Memory management is often the single worst problem in a C program, and getting it right can be quite troublesome. It would also be good if the authors mentioned memory debugging tools like Valgrind and Electric Fence.

On the whole, this is a decent text, with good points and bad points. I’d not want to use it myself as a text in a low-level programming class, but it might be a good choice for a course that touches only peripherally on C and assembler.

More reviews about this item: Amazon

Reviewer:  Jeffrey Putnam Review #: CR145900 (1806-0270)
Bookmark and Share
  Reviewer Selected
Editor Recommended
Featured Reviewer
 
 
Sequential Programming (D.1.4 )
 
 
C (D.3.2 ... )
 
Would you recommend this review?
yes
no
Other reviews under "Sequential Programming": Date
A technique for developing loop invariants
Remmers J. Information Processing Letters 18(3): 137-139, 1984. Type: Article
Jul 1 1985
Learning Joomla! 1.5 extension development: creating modules, components, and plugins with PHP
LeBlanc J., Packt Publishing, 2007.  176, Type: Book (9781847191304)
Feb 8 2008
Python for software design: how to think like a computer scientist
Downey A., Cambridge University Press, New York, NY, 2009.  272, Type: Book (9780521725965), Reviews: (1 of 2)
Jun 18 2009
more...

E-Mail This Printer-Friendly
Send Your Comments
Contact Us
Reproduction in whole or in part without permission is prohibited.   Copyright 1999-2024 ThinkLoud®
Terms of Use
| Privacy Policy