Interview Prep: What is a Mutex?

Learn about this critical tool for multithreaded programming

  • 7 Videos
  • 0 hours 29 minutes
  • 42 Happy Students

About the course

Description

You’ve used a mutex before, but have you wondered how it works? In this class, we look inside to discover what lock and unlock do. We’ll discuss how a program coordinates with the operating system, to allow multiple threads to synchronize their work.

Aside from satisfying your curiosity, this knowledge improves your understanding of concurrent processing. Anybody working with parallel computing should know what’s happening. It helps you spot defects, unravel performance problems, and avoid the evil data races.

I might gloss over a few details in the class, but at the end you’ll understand how a mutex works.

Project

How would you like to write a mutex?

That may sound harder than it really is. I’ve created a small app, with some skeleton interface for the mutex. You need to complete the mutex to get the simulation working correctly.

This exercise helps you internalize a part of how the mutex works.

The code is at: https://github.com/mortoray/interview.codes

Check it out and open the `demo.html` file in your browser. You need to complete the `mutex.js` file.

  • 7 Videos
  • 0 hours 29 minutes
  • 42 Happy Students

Courses Outline

Lesson 1: What is Mutex?
Free
Introduction
1:03
What does it do?
4:15
How does it work?
8:30
Waiting with the OS
3:34
User and Kernelspace
5:19
An experiment with JavaScript
4:55
Conclusion
2:01
  • 7 Videos
  • 0 hours 29 minutes
  • 42 Happy Students