trunk
Talks
Slides and example code from two technical presentations given in 2020.
Slides use org-mode, and were presented in Emacs with org-present.
Concurrency (June 2020)
Introduction to concurrency.
Slides
- Sequential vs. concurrent execution, I/O latency, interrupts, and cooperative vs. preemptive scheduling
- Concurrency vs. parallelism, processes vs. threads, and language runtimes (C, JavaScript event loop, Go scheduler)
- Shared memory synchronization vs. message passing, backpressure, and distributed data races
Examples
- temperatures: concurrent HTTP requests fetching city temperatures from OpenWeatherMap.
- mutex: data race demonstration and mutual exclusion on a shared bank account balance (
go run -race ./main.go). - csp: pipeline of goroutines and channels reading a CSV of zip codes, querying weather data with a concurrency limiter, and displaying a live top-ten leaderboard.
To run the examples:
# Mutex example (with and without race detector):
cd concurrency/cmd/mutex
go run ./main.go
go run -race ./main.go
# Weather examples (require an OpenWeatherMap API key):
export OPEN_WEATHER_MAP_API_KEY="..."
cd concurrency/cmd/temperatures && go run .
cd concurrency/cmd/csp && go run .
x86-64 Assembly (November 2020)
A brief tour of x86-64 assembly on Linux.
Slides
- Compilation pipeline, ISAs, CPU registers, and Linux system calls
- Instructions, addressing modes, control flow, and memory safety
- Virtual memory, the stack, function prologues/epilogues, and the System V AMD64 ABI calling convention
Examples
- exit: minimal program invoking the
exitsystem call. - math: basic arithmetic instructions (
mov,add,sub,mul,div), inspected via exit status. - control-flow: loops, comparisons (
cmp), and conditional/unconditional jumps (je,jmp). - hello-world: writing a string from the
.datasection to stdout with thewritesystem call. - safety: out-of-bounds memory overwrite across adjacent
.databuffers. - stack: pushing bytes onto the stack and printing from
%rsp. - func: function call, stack frame setup (
%rbp/%rsp), and return.
To run the examples:
as exit.s -o exit.o
ld exit.o -o exit
./exit
echo $?
Languages
Go
55.7%
Assembly
41.6%
Shell
2%
C
0.7%