Comments (1)
I've been thinking about the mutexes part of this, and I think we want to roughly cover:
- A simple memory model (the idea we have registers, L1/L2 caches, and main memory), their rough speeds costs and limits, why we have these, and the fact that several of these are unsynchronised per-core, but without either teaching or assuming "here's all the parts of a CPU and how a whole OS works".
- At a very high level, the concept of a memory barrier and a happens-before relationship.
- Simple single-variable examples of thread unsafety (e.g. increment a counter from 100 goroutines, see it doesn't reliably end at 100). The idea that a mutex can fix this.
- Multi-variable examples of thread unsafety - actually having to think about what the critical section is for a multi-statement operation, where atomics aren't sufficient (e.g. keeping a slice and a separate counter in sync or something to always have consistent views).
- WaitGroup as a useful abstraction.
- Channels as a useful way of signalling done-ness across goroutines (and passing data, I suppose).
I'm not sure which of these topics we care enough about to include (cc @sre-is-laura @Radha13 @nahratzah) :
- Atomics, CompareAndSwap
- Semaphores
- RWMutex
I think the concurrency chapter of golangbot is a sufficient introduction to how to do most of these things in Go (i.e. the single-variable example, WaitGroups, Channels), and has sufficient examples for the single-variable stuff.
I have yet to find a good resource for explaining the ideas of tiered memory, barriers, and happens-before relationships that isn't either super vague and overly "here's how you write the code without knowing why", or super deep into much wider CPU and/or OS design. I'd be interested if anyone else can find one, otherwise we may need to put one together (@nahratzah @sre-is-laura do you know of any, or could you be tempted to write one? If not, I can try to put one together).
I can come up with an example exercise for thinking about the critical section when dealing with multiple variables.
from immersive-go-course.
Related Issues (20)
- Typo in the Sentence HOT 1
- Broken images
- Scrolling is really slow and jerky/jittery in Chrome on macOS HOT 1
- Intro transaction concept
- Replace "just run Postgres" with a more meaningful MySQL set-up in multiple-servers
- Prep: Make clear learning objectives and expected knowledge outcomes from How Computers Really Work reading
- Introduce preparing a post-incident review as part of troubleshooting HOT 1
- Add some reference material on golang Context HOT 2
- Write up example of a protobuf migration HOT 1
- Consider grouping workbooks by topic rather than style of work HOT 4
- Mark up projects with metadata HOT 1
- Mark up primers with metadata
- kafka-cron part 2 - put in a diagram of intended architecture
- Migrate projects, primers, and paths into the curriculum repo
- Put together an "intro to Rust" equivalent to our "intro to Go" in the prep HOT 1
- Evaluate intro projects for Rust
- Write up sample solutions to intro projects in Rust
- Write up build systems primer
- Write up intro to nix
- Write up "navigating Kubernetes" project
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from immersive-go-course.