These are the best articles ever authored by Ciro Santilli, most of them in the format of Stack Overflow answers.
Ciro posts update about new articles on his Twitter accounts.
A chronological list of all articles is also kept at: Section "Updates".
Some random generally less technical in-tree essays will be present at: Section "Essays by Ciro Santilli".
- Trended on Hacker News:
- CIA 2010 covert communication websites on 2023-06-11. 190 points, a mild success.
- x86 Bare Metal Examples on 2019-03-19. 513 points. The third time something related to that repo trends. Hacker news people really like that repo!
- again 2020-06-27 (archive). 200 points, repository traffic jumped from 25 daily unique visitors to 4.6k unique visitors on the day
- How to run a program without an operating system? on 2018-11-26 (archive). 394 points. Covers x86 and ARM
- ELF Hello World Tutorial on 2017-05-17 (archive). 334 points.
- x86 Paging Tutorial on 2017-03-02. Number 1 Google search result for "x86 Paging" in 2017-08. 142 points.
- x86 assembly
- What does "multicore" assembly language look like?
- What is the function of the push / pop instructions used on registers in x86 assembly? Going down to memory spills, register allocation and graph coloring.
- Linux kernel
- What do the flags in /proc/cpuinfo mean?
- How does kernel get an executable binary file running under linux?
- How to debug the Linux kernel with GDB and QEMU?
- Can the sys_execve() system call in the Linux kernel receive both absolute or relative paths?
- What is the difference between the kernel space and the user space?
- Is there any API for determining the physical address from virtual address in Linux?
- Why do people write the
#!/usr/bin/env
python shebang on the first line of a Python script? - How to solve "Kernel Panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)"?
Figure 2. Path from init/main.c until bzImage in the Linux kernel 4.19. Source. From: What is the difference between the following kernel Makefile terms: vmLinux, vmlinuz, vmlinux.bin, zimage & bzimage?- Single program Linux distro
- QEMU
- gcc and Binutils:
- How do linkers and address relocation works?
- What is incremental linking or partial linking?
- GOLD (
-fuse-ld=gold
) linker vs the traditional GNU ld and LLVM ldd - What is the -fPIE option for position-independent executables in GCC and ld? Concrete examples by running program through GDB twice, and an assembly hello world with absolute vs PC relative load.
- How many GCC optimization levels are there?
- Why does GCC create a shared object instead of an executable binary according to file?
- C/C++: almost all of those fall into "disassemble all the things" category. Ciro also does "standards dissection" and "a new version of the standard is out" answers, but those are boring:
- What does "static" mean in a C program?
- In C++ source, what is the effect of
extern "C"
? - Char array vs Char Pointer in C
- How to compile glibc from source and use it?
- When should
static_cast
,dynamic_cast
,const_cast
andreinterpret_cast
be used? - What exactly is
std::atomic
in C++?. This answer was originally more appropriately entitled "Let's disassemble some stuff", and got three downvotes, so Ciro changed it to a more professional title, and it started getting upvotes. People judge books by their covers. notmain.o 0000000000000000 0000000000000017 W MyTemplate<int>::f(int) main.o 0000000000000000 0000000000000017 W MyTemplate<int>::f(int)
Code 1.. From: What is explicit template instantiation in C++ and when to use it?nm
outputs showing that objects are redefined multiple times across files if you don't use template instantiation properly
- IEEE 754
- What is difference between quiet NaN and signaling NaN?
- In Java, what does NaN mean?
Without subnormals: +---+---+-------+---------------+-------------------------------+ exponent | ? | 0 | 1 | 2 | 3 | +---+---+-------+---------------+-------------------------------+ | | | | | | v v v v v v ----------------------------------------------------------------- floats * **** * * * * * * * * * * * * ----------------------------------------------------------------- ^ ^ ^ ^ ^ ^ | | | | | | 0 | 2^-126 2^-125 2^-124 2^-123 | 2^-127 With subnormals: +-------+-------+---------------+-------------------------------+ exponent | 0 | 1 | 2 | 3 | +-------+-------+---------------+-------------------------------+ | | | | | v v v v v ----------------------------------------------------------------- floats * * * * * * * * * * * * * * * * * ----------------------------------------------------------------- ^ ^ ^ ^ ^ ^ | | | | | | 0 | 2^-126 2^-125 2^-124 2^-123 | 2^-127
Code 2.Visualization of subnormal floating point numbers vs what IEEE 754 would look like without them. From: What is a subnormal floating point number?
- Computer science
- Algorithms
- Is it necessary for NP problems to be decision problems?
- Polynomial time and exponential time. Answered focusing on the definition of "exponential time".
- What is the smallest Turing machine where it is unknown if it halts or not?. Answer focusing on "blank tape" initial condition only. Large parts of it are summarizing the Busy Beaver Challenge, but some additions were made.
- Algorithms
- Git
| 0 | 4 | 8 | C | |-------------|--------------|-------------|----------------| 0 | DIRC | Version | File count | ctime ...| 0 | ... | mtime | device | 2 | inode | mode | UID | GID | 2 | File size | Entry SHA-1 ...| 4 | ... | Flags | Index SHA-1 ...| 4 | ... |
tree {tree_sha} {parents} author {author_name} <{author_email}> {author_date_seconds} {author_date_timezone} committer {committer_name} <{committer_email}> {committer_date_seconds} {committer_date_timezone} {commit message}
Code 4.Description of the Git commit object binary data structure. From: What is the file format of a git commit object data structure?- How do I clone a subdirectory only of a Git repository?
- Python
- Web technology
- OpenGL
Figure 8. Example of a texture atlas containing glyphs. Source.Image by Nicolas P. Rougier, author of Freetype GL.Used on Ciro Santilli's answer: How to draw text using only OpenGL methods?- What are shaders in OpenGL?
- Why do we use 4x4 matrices to transform things in 3D?
Figure 10. . Source. - Image Processing with GLSL shaders? Compared the CPU and GPU for a simple blur algorithm.
- Node.js
- Ruby on Rails
- POSIX
- What is POSIX? Huge classified overview of the most important things that POSIX specifies.
- Systems programming
- What do the terms "CPU bound" and "I/O bound" mean?
Figure 12. Plot of "real", "user" and "sys" mean times of the output of time for CPU-bound workload with 8 threads. Source. From: What do 'real', 'user' and 'sys' mean in the output of time?+--------+ +------------+ +------+ | device |>---------------->| function 0 |>----->| BAR0 | | | | | +------+ | |>------------+ | | | | | | | +------+ ... ... | | |>----->| BAR1 | | | | | | +------+ | |>--------+ | | | +--------+ | | ... ... ... | | | | | | | | +------+ | | | |>----->| BAR5 | | | +------------+ +------+ | | | | | | +------------+ +------+ | +--->| function 1 |>----->| BAR0 | | | | +------+ | | | | | | +------+ | | |>----->| BAR1 | | | | +------+ | | | | ... ... ... | | | | | | +------+ | | |>----->| BAR5 | | +------------+ +------+ | | | ... | | | +------------+ +------+ +------->| function 7 |>----->| BAR0 | | | +------+ | | | | +------+ | |>----->| BAR1 | | | +------+ | | ... ... ... | | | | +------+ | |>----->| BAR5 | +------------+ +------+
Code 5.Logical struture PCIe device, functions and BARs. From: What is the Base Address Register (BAR) in PCIe?
- Electronics
- Raspberry Pi
Figure 13. . Image from answer to: How to hook up a Raspberry Pi via Ethernet to a laptop without a router? Figure 14. . Image from answer to: How to hook up a Raspberry Pi via Ethernet to a laptop without a router? Figure 15. . Image from answer to: How to emulate the Raspberry Pi 2 on QEMU? Figure 16. Bare metal LED blinker program running on a Raspberry Pi 2. Image from answer to: How to run a C program with no OS on the Raspberry Pi?
- Raspberry Pi
- Computer security
- Media
Video 2. Canon in D in C. Source.The original question was deleted, lol...: How to programmatically synthesize music?- How to resize a picture using ffmpeg's sws_scale()?
- Is there any decent speech recognition software for Linux? ran a few examples manually on
vosk-api
and compared to ground truth.
- Eclipse
- Computer hardware
- Scientific visualization software
Figure 17. VisIt zoom in 10 million straight line plot with some manually marked points. Source. From: Section "Survey of open source interactive plotting software with a 10 million point scatter plot benchmark by Ciro Santilli"
- Numerical analysis
Video 3. Real-time heat equation OpenGL visualization with interactive mouse cursor using relaxation method by Ciro Santilli (2016)Source.
- Computational physics
Figure 18. gnuplot plot of the y position of a sphere bouncing on a plane simulated in Bullet Physics. Source. From: What is the simplest collision example possible in a Bullet Physics simulation?
- Register transfer level languages like Verilog and VHDL
- Verilog:
Figure 19. . See also: Section "Verilator interactive example"
- Verilog:
- Android
Video 4. Android screen showing live on an Ubuntu laptop through ADB. Source. From: How to see the Android screen live on an Ubuntu desktop through ADB?
- Debugging
- Program optimization
- What is tail call optimization?
Figure 21. gprof2dot image generated from the gprof data of a simple test program. Source.The answer compares gprof, valgrind callgrind, perf and gperftools on a single simple executable.
- Data
Figure 22. Mathematics dump of Wikipedia CatTree. Source.
- Mathematics
Figure 23. Diagram of the fundamental theorem on homomorphisms by Ciro Santilli (2020)Shows the relationship between group homomorphisms and normal subgroups.- Section "Formalization of mathematics": some early thoughts that could be expanded. Ciro almost had a stroke when he understood this stuff in his teens.
Figure 24. Simple example of the Discrete Fourier transform. Source. That was missing from Wikipedia page: en.wikipedia.org/wiki/Discrete_Fourier_transform!
- Network programming
- Physics
- What is the difference between plutonium and uranium?
Figure 25. Spacetime diagram illustrating how faster-than-light travel implies time travel. From: Does faster than light travel imply travelling back in time?
- Biology
Figure 27. Mass fractions in a minimal growth medium vs an amino acid cut in a simulation of the E. Coli Whole Cell Model by Covert Lab. Source. From: Section "E. Coli Whole Cell Model by Covert Lab"
- Quantum computing
- Section "Quantum computing is just matrix multiplication"
Figure 28. Visualization of the continuous deformation of states as we walk around the Bloch sphere represented as photon polarization arrows. From: Understanding the Bloch sphere.
- Bitcoin
- GIMP
Figure 29. GIMP screenshot part of how to combine two images side-by-side in GIMP?.
- Home DIY
Figure 30. Total_Blackout_Cassette_Roller_Blind_With_Curtains.Source. From: Section "How to blackout your window without drilling"
- China
A more photon-specific version of the Bloch sphere.
In it, each of the six sides has a clear and simple to understand photon polarization state, either of:
- left/right
- diagonal up/diagonal down
- rotation clockwise/counterclockwise
The sphere clearly suggests for example that a rotational or diagonal polarizations are the combination of left/right with the correct phase. This is clearly explained at: Video "Quantum Mechanics 9b - Photon Spin and Schrodinger's Cat II by ViaScience (2013)".
This section discusses the pre-photon understanding of the polarization of light. For the photon one see: photon polarization.
polarization.com/history/history.html is a good page.
People were a bit confused when experiments started to show that light might be polarized. How could a wave that propages through a 3D homgenous material like luminiferous aether have polarization?? Light would presumably be understood to be analogous to a sound wave in 3D medium, which cannot have polarization. This was before Maxwell's equations, in the early 19th century, so there was no way to know.
A device that modifies photon polarization.
As mentioned at Video "Quantum Mechanics 9b - Photon Spin and Schrodinger's Cat II by ViaScience (2013)", it can be modelled as a bra.
Quantum entanglement is often called spooky/surprising/unintuitive, but they key question is to understand why.
To understand that, you have to understand why it is fundamentally impossible for the entangled particle pair be in a predefined state according to experiments done e.g. where one is deterministically yes and the other deterministically down.
In other words, why local hidden-variable theory is not valid.
How to generate entangled particles:
- particle decay, notably pair production
- for photons, notably: spontaneous parametric down-conversion, e.g.: www.youtube.com/watch?v=tn1sEaw1K2k "Shanni Prutchi Construction of an Entangled Photon Source" by HACKADAY (2015). Estimatd price: 5000 USD.
Bell's Theorem: The Quantum Venn Diagram Paradox by minutephysics (2017)
Source. Contains the clearest Bell test experiment description seen so far.
It clearly describes the photon-based 22.5, 45 degree/85%/15% probability photon polarization experiment and its result conceptually.
It does not mention spontaneous parametric down-conversion but that's what they likely hint at.
Done in Collaboration with 3Blue1Brown.
Question asking further clarification on why the 100/85/50 thing is surprising: physics.stackexchange.com/questions/357039/why-is-the-quantum-venn-diagram-paradox-considered-a-paradox/597982#597982
Bell's Inequality I by ViaScience (2014)
Source. Quantum Entanglement & Spooky Action at a Distance by Veritasium (2015)
Source. Gives a clear explanation of a thought Bell test experiments with electron spin of electron pairs from photon decay with three 120-degree separated slits. The downside is that he does not clearly describe an experimental setup, it is quite generic.Quantum Mechanics: Animation explaining quantum physics by Physics Videos by Eugene Khutoryansky (2013)
Source. Usual Eugene, good animations, and not too precise explanations :-) youtu.be/iVpXrbZ4bnU?t=922 describes a conceptual spin entangled electron-positron pair production Stern-Gerlach experiment as a Bell test experiments. The 85% is mentioned, but not explained at all.Quantum Entanglement: Spooky Action at a Distance by Don Lincoln (2020)
Source. This only has two merits compared to Video 3. "Quantum Entanglement & Spooky Action at a Distance by Veritasium (2015)": it mentions the Aspect et al. (1982) Bell test experiment, and it shows the continuous curve similar to en.wikipedia.org/wiki/File:Bell.svg. But it just does not clearly explain the bell test.Quantum Entanglement Lab by Scientific American (2013)
Source. The hosts interview Professor Enrique Galvez of Colgate University who shows briefly the optical table setup without great details, and then moves to a whiteboard explanation. Treats the audience as stupid, doesn't say the keywords spontaneous parametric down-conversion and Bell's theorem which they clearly allude to. You can even them showing a two second footage of the professor explaining the rotation experiments and the data for it, but that's all you get. Richard Feynman Quantum Electrodynamics Lecture at University of Auckland (1979) Updated 2025-02-22 +Created 1970-01-01
Talk title shown on intro: "Today's Answers to Newton's Queries about Light".
6 hour lecture, where he tries to explain it to an audience that does not know any modern physics. This is a noble effort.
Part of The Douglas Robb Memorial Lectures lecture series.
Feynman apparently also made a book adaptation: QED: The Strange Theory of Light and Matter. That book is basically word by word the same as the presentation, including the diagrams.
According to www.feynman.com/science/qed-lectures-in-new-zealand/ the official upload is at www.vega.org.uk/video/subseries/8 and Vega does show up as a watermark on the video (though it is too pixilated to guess without knowing it), a project that has been discontinued and has has a non-permissive license. Newbs.
4 parts:This talk has the merit of being very experiment oriented on part 2, big kudos: how to teach and learn physics
- Part 1: is saying "photons exist"
- Part 2: is amazing, and describes how photons move as a sum of all possible paths, not sure if it is relativistic at all though, and suggests that something is minimized in that calculation (the action)
- Part 3: is where he hopelessly tries to explain the crucial part of how electrons join the picture in a similar manner to how photons do.He does make the link to light, saying that there is a function which gives the amplitude for a photon going from A to B, where A and B are spacetime events.And then he mentions that there is a similar function for an electron to go from A to B, but says that that function is too complicated, and gives no intuition unlike the photon one.He does not mention it, but P and E are the so called propagators.This is likely the path integral formulation of QED.On Quantum Mechanical View of Reality by Richard Feynman (1983) he mentions that is a Bessel function, without giving further detail.And also mentions that:where
m
is basically a scale factor.
such that both are very similar. And that something similar holds for many other particles.And then, when you draw a Feynman diagram, e.g. electron emits photon and both are detected at given positions, you sum over all the possibilities, each amplitude is given by:summed over all possible Spacetime points.This is basically well said at: youtu.be/rZvgGekvHes?t=3349 from Quantum Mechanical View of Reality by Richard Feynman (1983).TODO: how do electron velocities affect where they are likely to end up? suggests the probability only depends on the spacetime points.Also, this clarifies why computations in QED are so insane: you have to sum over every possible point in space!!! TODO but then how do we calculate anything at all in practice? - Part 4: known problems with QED and thoughts on QCD. Boring.
Richard Feynman Quantum Electrodynamics Lecture at University of Auckland (1979) uploaded by Trev M (2015)
Source. Single upload version. Let's use this one for the timestamps I guess.- youtu.be/Alj6q4Y0TNE?t=2217: photomultiplier tube
- youtu.be/Alj6q4Y0TNE?t=2410: local hidden-variable theory
- youtu.be/Alj6q4Y0TNE?t=6444: mirror experiment shown at en.wikipedia.org/w/index.php?title=Quantum_electrodynamics&oldid=991301352#Probability_amplitudes
- youtu.be/Alj6q4Y0TNE?t=7309: mirror experiment with a diffraction grating pattern painted black leads to reflection at a weird angle
- youtu.be/Alj6q4Y0TNE?t=7627: detector under water to explain refraction
- youtu.be/Alj6q4Y0TNE?t=8050: explains biconvex spherical lens in terms of minimal times
- youtu.be/Alj6q4Y0TNE?t=8402: mentions that for events in a series, you multiply the complex number of each step
- youtu.be/Alj6q4Y0TNE?t=9270: mentions that the up to this point, ignored:but it should not be too hard to add those
- amplitude shrinks down with distance
- photon polarization
- youtu.be/Alj6q4Y0TNE?t=11697: finally starts electron interaction. First point is to add time of event detection.
- youtu.be/Alj6q4Y0TNE?t=13704: electron between plates, and mentions the word action, without giving a clear enough idea of what it is unfortunately
- youtu.be/Alj6q4Y0TNE?t=14467: mentions positrons going back in time, but does not clarify it well enough
- youtu.be/Alj6q4Y0TNE?t=16614: on the fourth part, half is about frontiers in quantum electrodynamics, and half full blown theory of everything. The QED part goes into renormalization and the large number of parameters of the Standard Model
Photon hits excited electron, makes that electron go down, and generates a new identical photon in the process, with the exact same:This is the basis of lasers.
- frequency
- polarization
- direction
Bibliography:
Discrete quantum system model that can model both spin in the Stern-Gerlach experiment or photon polarization in polarizer.
Also known in quantum computing as a qubit :-)
Split in the spectral line when a magnetic field is applied.
Non-anomalous: number of splits matches predictions of the Schrödinger equation about the number of possible states with a given angular momentum. TODO does it make numerical predictions?
www.pas.rochester.edu/~blackman/ast104/zeeman-split.html contains the hello world that everyone should know: 2p splits into 3 energy levels, so you see 3 spectral lines from 1s to 2p rather than just one.
p splits into 3, d into 5, f into 7 and so on, i.e. one for each possible azimuthal quantum number.
It also mentions that polarization effects become visible from this: each line is polarized in a different way. TODO more details as in an experiment to observe this.
Well explained at: Video "Quantum Mechanics 7a - Angular Momentum I by ViaScience (2013)".
Experimental physics - IV: 22 - Zeeman effect by Lehrportal Uni Gottingen (2020)
Source. This one is decent. Uses a cadmium lamp and an etalon on an optical table. They see a more or less clear 3-split in a circular interference pattern,
They filter out all but the transition of interest.
- youtu.be/ZmObNFAqkBE?t=165 passes the lines through a polarizer, which shows how orbital angular momentum is carried by photon polarization
- youtu.be/ZmObNFAqkBE?t=370 says they are looking at 1D2 to 1P1 changes.
Zeeman Effect - Control light with magnetic fields by Applied Science (2018)
Source. Does not appear to achieve a crystal clear split unfortunately.