Multithreading in C++, First Steps in Probability Theory
Today we covered two radically different topics. At first we did a couple graph theory problems, including the Ingress problem, and then talked about how graph theory can be used to detect deadlock in a system. Students asked to learn how to do parallel processing, so I demoed it on the server using the thread library in C++ (remember to compile with -pthread) and then using the mutex library to allow only a single thread into a block of code at a time. I also briefly showed how to use atomics to do the same thing, but the best approach was to just give threads their own memory to work on so they could keep communication to a minimum.
We then moved on to the first steps to understanding probability theory, and defined a few terms like event (which is when a random thingy happens like flipping a coin or rolling a die) and the outcome of the event (like getting heads or rolling a 2). We talked about how to describe the probability of an event, either as a fraction ("There is a 1/6 chance of rolling a 1 on a d6") or as an odds ratio ("There are 5:1 odds against rolling a 1 on a d6"). When doing odds ratios, you're describing the odds of success against the odds of failure (or vice versa, depending on if you describe it as "odds for" or "odds against").