Wednesday, July 1, 2026

Interview

 Q: When to use Parallel vs Async?

✅ Answer:

"Parallel is used for CPU-bound operations where computation is heavy,
whereas async/await is used for I/O-bound operations where the system waits for external resources like APIs or databases."

👉 Bangla:

"CPU heavy কাজ হলে Parallel, আর external wait থাকলে Async/Await ব্যবহার করি।"

FeatureParallelAsync/Await
TypeCPU-boundI/O-bound
ThreadMultiple threadsNon-blocking
PerformanceFast for heavy computationEfficient for waiting
Use CaseData processingAPI/DB/File

 

Scenario 1: Employee Data Processing (CPU-Bound → Parallel)

Business Requirement

HR system-এ 500,000 employee records আছে।

প্রতিটি employee-এর জন্য:

  • Salary calculation
  • Tax calculation
  • Bonus calculation

করতে হবে।



✅ CPU doing work → Parallel

Examples:

  • Salary Calculation
  • Report Generation
  • Image Processing
  • Data Transformation

✅ CPU waiting → Async/Await

Examples:

  • API Call
  • Database Query
  • File Read/Write
  • Azure Blob Storage Access


No comments:

Post a Comment

DataCamp

  If you're using the course platform shown in your screenshots (DataCamp-style learning), the fastest ways to earn more XP are: 🚀 1. ...