Nixers Book Club - Book #5: Computer Science from the Bottom Up - Community & Forums Related Discussions

Users browsing this thread: 1 Guest(s)
Long time nixers
As proposed by Venam, the next book of the Nixer's Book Club is gonna be «Computer Science from the Bottom Up».

Quoting from its introduction:
Quote:In a nutshell, what you are reading is intended to be a shop class for computer science. Young computer science students are taught to "drive" the computer; but where do you go to learn what is under the hood? Trying to understand the operating system is unfortunately not as easy as just opening the bonnet. The current Linux kernel runs into the millions of lines of code, add to that the other critical parts of a modern operating system (the compiler, assembler and system libraries) and your code base becomes unimaginable. Further still, add a University level operating systems course (or four), some good reference manuals, two or three years of C experience and, just maybe, you might be able to figure out where to start looking to make sense of it all.

To keep with the car analogy, the prospective student is starting out trying to work on a Formula One engine without ever knowing how a two stroke motor operates. During their shop class the student should pull apart, twist, turn and put back together that two stroke motor, and consequentially have a pretty good framework for understanding just how the Formula One engine works. Nobody will expect them to be a Formula One engineer, but they are well on their way!

Chapters are short, so we can do 2 chapters per week.
Our first session will be Aug, 21 (next Saturday), when we will discuss the first two chapters.
See you then!
Alright, been a long time since I posted on the forums.
The book so far is pretty classic basic CS stuff so I don't have much to say.

Chapter 1: General Unix and Advanced C

Introduction to the concept of file and input/output. The abstraction facilitates the manipulation different things by giving them the same interface.
This is done through a typical OOP-style pattern that is often used in C: defining methods in a struct that are implemented depending on the scenario.

Chapter 2: Binary and Number Representation

This is a chapter about the bottom representation of what it stored in the computer and questions about how to create useful types around that and how to represent them, size, sign, decimals, fractions, etc..
Basic CS stuff, yes, and presented briskly like a refresher. It's good to go back and revisit these things now and then, to fill in any gaps in our understanding.

I really liked its beginning with the concept of abstraction, which is a much deeper topic than it might seem at first glance.

It reminded me, for example, that our abstractions can sometimes drift out of contact with the underlying reality, as this Usenix talk discusses:

TLDW: our programming model of the computer doesn't reflect the prevalence of SOC's and thus the presence of more processors -- and their firmware -- than found in the classic CPU. This can result in vulnerabilities. Fast forward the video to 19:29 for an example.

People have also often pointed to von Neumann architecture as another example of a limiting abstraction.

And functional programming polemics often describes OOP's emphasis on objects as the "wrong" abstraction.
Long time nixers
The book club is back!

First chapter introduces the UNIX operating system and some of its principles, like the standard input/output, “everything is a file” and “tools that do one thing and do it well” mantras. The chapter also introduces abstraction and how it is achieved via APIs.

Second chapter is about binary representation of data. How it is stored as zeroes and ones, what operations are performed on them and how they combine into compound data.
Time for the book club!

Chapter 3 and 4 were kind of long but because they went over things that aren't new it was quick to read.

Chapter 3: Computer Architecture

A chapter about the generic architecture of computers. From the CPU
pipelines, to memory hierarchies, caches, algorithms for eviction,
buses and peripherals.
Nothing really special here, but a good refresher.

Chapter 4: The Operating System

We finally dive into an overview of what operating systems are
about: a standard layer of abstraction over the hardware that allows
for the sharing of resources.

We're presented with the different kernel types: monolithic vs
microkernel, separation with user space, and how to achieve that with
privileges, be it hardware rings or virtual memory.

NB: I noticed there are a lot of typos in that book. But the content is
still great.
Long time nixers
Chapters 3 and 4 made me remember of my uni classes:
Pretty much everything the chapters cover I have already studied or am studying right now.
But it was nice to review that stuff.

Chapter 3 is about computer architecture and organization.
Everything I know about this topic is because of a final project I did some time ago: I had to implement a simple ARM CPU.
The ALU, the datapath, the pipeline, the instruction cycle... everything I implemented in Verilog.
I have never implemented the CPU on a FPGA, I only simulated it using iverilog(1).
It was a fun project and one of the most challenging I have ever done.

Chapter 4 is about Operating Systems.
The reading of that chapter coincided with the reading of Tanenbaum's book on Operating System at my OS class.
I'm reading about processes and process scheduling right now, but I think those topics will be covered on the next chapter.
Chapter 5 and 6 were, again, classic CS stuff.
I can't help but feel that everything is scratching the surface but
I guess that it would be a great overview of a lot of things for CS

Chapter 5: The Process

We're presented with the process as the element of multi-tasking.

This page is missing:

Quote:UNIX systems assign each process a nice value. The scheduler looks at the
nice value and can give priority to those processes that have a higher

I think that's a typo and that they meant lower niceness.

Chapter 6: Virtual Memory

We get a good overview of what is virtual memory, why it's useful. The
definitions of page, offsets, frames, swapping, etc.. Along with hardware
related help like TLB, protection bits, and more.
Long time nixers
Chapter 5 is about processes.
It introduces the structure of the memory and its sections, such as the stack and the heap.
It also introduces the resources of a process, such as open files and process states; and the process hierarchy on UNIX systems.

Chapter 6 is about the virtual memory.
It introduces the concepts of pages and frames, how virtual memory addresses are translated to physical memory, etc.

The book is really a introduction to computer science for the novice.
A lot of the stuff there I have already seen in my CS course or I'm seeing right now.
It's good to review those stuff though.
I don't have much to say about the chapters this week.

Chapter 7: The Toolchain

It was a simple explanation of the compilation process, difference between compiled and interpreted, and the steps to resolve symbols and the likes.

Chapter 8: Behind the process

This chapter went more into what the word "executable" means. I think it's a good thing to read for beginners because often we don't really think about these things. What's an executable really?
The explanation isn't so bad, focusing mainly on the formatting aspect, how an executable is all about packing the required info in a bunch of bytes to be able to be loaded and executed by the OS.

The chapter goes over some of the specificity of ELF in particular and its linking process.
Long time nixers
Also not much to say about the chapters.
I had so much online exams this week that I could barely do anything else, so I just skimmed over the chapters.

Chapter 7 is about the compilation and linkage toolchain.
The reading of the chapter coincided with a online exam I had about linkage and symbol resolution lol.

Chapter 8 explores an ELF executable file. It immediately reminded me of corkami's poster on ELF structure.

Some sections are still incomplete. And the last commit on repo of the book is from last year.
Alright, last chapter of the book.

This was probably the most insightful.
It has a good summary of the linking mechanism and mentions a lot of things I wasn't aware of. Especially the versioning and the search mechanism using DT_NEEDED and the name hierarchy.
It's also my first time learning about weak symbols, but I probably won't be using them because of the standards conflicting on it.
Long time nixers
Last chapter.

The chapter is about libraries, dynamic linking, relocation, etc. It also covers the problem of library versioning.
The chapter has some examples on disassembling some code and exploring the ELF to check what library is needed, etc.
This chapter also had some XXX: TODO marks, but less than some previous ones.
We can use this thread to post about new ideas for book club readings. So if anyone wants to propose a specific book, go for it!
Long time nixers
There are three books I want to read, in especial the Plan 9 one:
Introduction to Operating Systems Abstractions Using Plan 9.
The Design of the UNIX Operating System.
UNIX: A History and a Memoir (this one is not free).
Quote:Introduction to Operating Systems Abstractions Using Plan 9.
I'm voting for this one, even though I've already read it.