Ôn luyện pv 2026

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/10

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 4:37 AM on 9/1/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

11 Terms

1
New cards

What is async / await in Python?


An asynchronous programming paradigm in Python powered by the asyncio module. It enables single-threaded concurrency by using an event loop to execute tasks, allowing program execution to pause during slow operations rather than freezing the entire process.

2
New cards

How do async and await work mechanically in Python?


  • async def: Declares a coroutine function. Calling this function does not run its body immediately; instead, it returns a coroutine object.

  • await: Yields control back to the event loop. It pauses execution of the current coroutine until the awaited asynchronous operation completes, allowing the event loop to run other scheduled tasks in the meantime.


3
New cards

When should you use async / await vs. when to avoid it?


  • When to use: I/O-bound workloads with long waiting periods, such as handling web scraping, executing database queries, making network API calls, or running web servers (e.g., FastAPI).

  • When to avoid: CPU-bound operations (heavy mathematical calculations, video/image processing, ML inference). Because Python runs on a single thread due to the GIL (Global Interpreter Lock), CPU-heavy async code will block the event loop entirely. Use multiprocessing instead.


4
New cards

What is the role of the asyncio Event Loop?

The central manager that tracks and executes all asynchronous tasks. It maintains a queue of coroutines, monitors active I/O operations, pauses coroutines that are waiting for responses (await), and switches execution to other ready tasks to maximize efficiency.

5
New cards

What is the core structural difference between JS and Python event loops?


  • JavaScript: Operates on an Event Queue + Callback Queue pattern (handling Microtasks like Promises and Macrotasks like setTimeout). Operations run to completion, pushing callbacks into queues for the loop to process sequentially.

  • Python: Operates on a Coroutine/Generator-based State Machine mechanism. Functions explicitly yield control using the await keyword, pausing their internal execution state and allowing the event loop to switch to other active coroutines.


6
New cards

How does Go approach concurrency differently compared to Python/JS event loops?


  • Goroutines over Coroutines: Go uses lightweight green threads called Goroutines (go func()) instead of single-threaded event loops or async/await keywords.

  • Synchronous-Style Code: Programmers write code in a natural, blocking synchronous style, but the runtime transparently pauses and resumes execution under the hood using non-blocking OS primitives (epoll/kqueue).


7
New cards

What is Harness Engineering in modern software development?

The engineering discipline of building the operational environment, constraints, feedback loops, and validation gates around an AI agent. Summarized as Agent = Model + Harness, harness engineering shifts human focus from writing code manually to designing deterministic structures that ensure AI outputs are reliable, repeatable, and safe.

8
New cards

When should you choose @classmethod vs. @staticmethod?


  • Use @classmethod when: You need alternative constructors (e.g., from_dict(), from_json()) or need to access/modify shared class variables.

  • Use @staticmethod when: You need self-contained helper/utility methods that logically belong inside the class namespace but do not read or modify class/instance state.


9
New cards

NestJS - Providers ?

  • services, repositories, factories, and helpers … is offered as dependencies to be injected

  • instantiated by the Nest injector


10
New cards

NestJS - imports in module?


  • The declarations of modules which have providers required to be used


11
New cards