Description
Concurrency in Ruby is one of the most complicated and advanced topics discussed in senior engineering interviews. Interviewees who understand concurrency and multithreading will have a significant advantage. This course lays the groundwork for advanced concurrency and multithreading by delving into concepts like Monitors and Deferred Callbacks. It also creates simple and complete solutions to common concurrency problems such as the Reader-Writer Problem and the Dining Philosopher Problem, which can be asked about in interviews. While prior knowledge of concurrency is not required to complete this course, familiarity with the fundamentals of Ruby would be beneficial.
Syllabus :
1. The Basics
- Program vs Process vs Thread
- Concurrency vs Parallelism
- Cooperative Multitasking vs Preemptive Multitasking
- Synchronous vs Asynchronous
- I/O Bound vs CPU Bound
- Throughput vs Latency
- Critical Sections & Race Conditions
- Deadlocks, Liveness & Reentrant Locks
- Mutex vs Semaphore
- Mutex vs Monitor
- Hoare vs Mesa Monitors
- Semaphore vs Monitor
- Amdahl's Law
- Moore’s Law
2. API Overview
- Creating Threads
- Sleeping and Terminating Threads
- Exception Handling in Threads
- Thread Variables
- Mutex
- Condition Variables
- Monitor
- Global Interpreter Lock
3. Brief Intro to Asynchronous Programming
- Fiber
4. Interview Practice Problems
- Implementing Semaphore
- Blocking Queue | Bounded Buffer | Consumer Producer
- Rate Limiting Using Token Bucket Filter
- Thread Safe Deferred Callback
- ReadWrite Lock
- Unisex Bathroom Problem
- Implementing a Barrier
- Uber Ride Problem
- Dining Philosophers
- Barber Shop
- Asynchronous to Synchronous Problem
- Multithreaded Merge Sort
- Thread-safe Singleton