QA - Section 1.04. Synchronization & Shared Resources
QA - Section 1.04. Synchronization & Shared Resources 1. What is a Race Condition? A race condition occurs when the outcome of a program depends on the timing or order of execution between ...
QA - Section 1.04. Synchronization & Shared Resources 1. What is a Race Condition? A race condition occurs when the outcome of a program depends on the timing or order of execution between ...
QA - Section 1.03. Parallel 1. How do you decide what to parallelize? You should parallelize parts of the code that are computationally expensive and independent. Typically, large loops or oper...
QA - Section 1.02. Multithreading & Concurrency 1. Core vs Thread A core is a physical hardware component inside the CPU that executes instructions. A thread is a sequence of instructions t...
QA - Section 1.01. Smart Pointer and API” 1. What are the key differences between std::unique_ptr and std::shared_ptr, and when would you choose one over the other? The main difference is ownersh...
std::async and Thread Pool Prerequisites 1. What are std::async and Thread Pool In C++, there are multiple ways to execute tasks concurrently: std::async → simple, task-based concurrency...
Rule of Five Prerequisites 1. What is Rule of Five The Rule of Five states: If a class manages resources and defines one of these: destructor copy constructor copy assignment opera...
std::atomic and std::mutex Prerequisites 1. Why Do We Need Synchronization In multithreaded programs, multiple threads access the same data ❌ Problem: Data Race int counter = 0; void inc...
lower_bound and upper_bound Prerequisites 1. What are lower_bound and upper_bound? They are STL algorithms used for binary search on sorted ranges. They work in O(log N) time lower_bound...
Smart Pointers Prerequisites 1. What is a Smart Pointers A smart pointer is a wrapper around a raw pointer that automatically manages memory. It prevents: memory leaks double free da...
Regular Expressions Prerequisites 1. What is a Regular Expressions A Regular Expression (Regex) is a pattern used to match, search, or extract text. Instead of writing complex parsing logic,...