* Talks Slides and example code from two technical presentations given in 2020. Slides use [[https://orgmode.org/][org-mode,]] and were presented in Emacs with [[https://github.com/rlister/org-present][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: #+begin_src shell # 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 . #+end_src ** 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 ~exit~ system 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 ~.data~ section to stdout with the ~write~ system call. - safety: out-of-bounds memory overwrite across adjacent ~.data~ buffers. - stack: pushing bytes onto the stack and printing from ~%rsp~. - func: function call, stack frame setup (~%rbp~ / ~%rsp~), and return. To run the examples: #+begin_src shell as exit.s -o exit.o ld exit.o -o exit ./exit echo $? #+end_src