mutex
A lock that lets only one piece of code at a time run a critical section or do a particular piece of work.
In more detail
Code acquires the lock before the critical section and releases it after, and other callers wait. Mutexes prevent two tasks from corrupting shared data or doing the same expensive work.
Examples
LOCK = threading.Lock() # VIII: scale means more threads in hereA mutex lets one request rebuild an expired cache entry while others wait.mu.Lock()
defer mu.Unlock()Go: mu.Lock(); defer mu.Unlock()A malware family's mutex name is often fixed, which makes it a useful string in YARA rules and a host indicator to sweep for.Related terms
- thread — A path of execution inside a process that the operating system schedules on a processor; one process can have many.
- global variable — A variable defined at the top level of a program or module, shared by all the code in that process.
- concurrency — Having several pieces of work in progress during overlapping periods of time, such as requests being handled at once.
- singleflight — A technique that merges many simultaneous identical requests into one, so only one does the work and they all share its result.
- thundering herd — A flood of requests that arrives at once when many clients react to the same event, such as all retrying after an outage.
- data race — A bug where two goroutines access the same memory at the same time and at least one of them writes, without any synchronization.
- sync.WaitGroup — A counter from Go's sync package that lets one goroutine wait until a group of other goroutines have all finished.
- channel — A typed pipe in Go that one goroutine sends values into and another receives them from, safely handing data between them.
- race condition — A bug whose outcome depends on the timing of two things happening at once.
- Atomics — A JavaScript object of functions that read and change shared memory in steps that cannot be interrupted by another thread.
- YARA string — A named pattern in a YARA rule's strings section, written as text or hexadecimal bytes, with modifiers that change how it matches.
- malware — Software written to cause harm, such as stealing data, encrypting files for ransom or mining cryptocurrency.
Taught in
- Build, Release, Run And Processes — DevOps & Site Reliability Engineering
- Port Binding And Concurrency — DevOps & Site Reliability Engineering
- Disposability, Dev Prod Parity And Logs — DevOps & Site Reliability Engineering
- Distributed Cache Invalidation: Redis & Tagged Purging — Production Full-Stack Engineering
- Goroutines and Concurrent Execution — Concurrent Systems Programming with Go
- Worker Threads: worker_threads & SharedArrayBuffer — Node.js Internals & Backend Services
- YARA Rule Authoring & File Signature Matching — Security Operations & Threat Hunting (SOC)
- Malware Triage: Hashes, Strings & Sandboxing — Security Operations & Threat Hunting (SOC)