Sunday, 8 March 2026

Python Concepts

 

Synchronous and ASynchronous:


Core Differences
  • Synchronous (Sync): Tasks are executed sequentially, one after another. If a task involves waiting (like a network request), the entire program "blocks" and stays idle until that task finishes.
  • Asynchronous (Async): Tasks can run concurrently. When an async task hits a waiting period, it "yields" control back to the system, allowing other tasks to run in the meantime.

FeatureSynchronousAsynchronous
ExecutionSequential (one at a time)Concurrent (overlapping)
BlockingBlocking architectureNon-blocking architecture
ComplexitySimple to write and debugMore complex; requires async/await
Best ForCPU-bound tasks (heavy math)I/O-bound tasks (web requests)

No comments:

Post a Comment

Building a ReAct Agent with LangGraph & LangSmith

In this post, I walk through building a ReAct (Reasoning + Acting) agent using LangGraph and Groq's openai/gpt-oss-120b model, where the...