All fields

“Concurrency (asyncio/threading/multiprocessing)” in Information Technology

44 questions across 3 technologies.

Information Technology

44 questions in 3 technologies

#QuestionTechnologyTopicLevel
1What is the fundamental difference between concurrency and parallelism, and how does this map to Python's threading versus multiprocessing modules? Python › Concurrency (asyncio/threading/multiprocessing)PythonConcurrency (asyncio/threading/multiprocessing)Beginner
2How do you create and run a basic thread using the threading module? Python › Concurrency (asyncio/threading/multiprocessing)PythonConcurrency (asyncio/threading/multiprocessing)Beginner
3What is the basic pattern for running an async function using asyncio.run()? Python › Concurrency (asyncio/threading/multiprocessing)PythonConcurrency (asyncio/threading/multiprocessing)Beginner
4How does the Global Interpreter Lock (GIL) affect CPU-bound versus I/O-bound multithreaded programs differently? Python › Concurrency (asyncio/threading/multiprocessing)PythonConcurrency (asyncio/threading/multiprocessing)Intermediate
5How do you run multiple coroutines concurrently using asyncio.gather()? Python › Concurrency (asyncio/threading/multiprocessing)PythonConcurrency (asyncio/threading/multiprocessing)Intermediate
6How do you protect shared mutable state from race conditions when using multiple threads, using threading.Lock? Python › Concurrency (asyncio/threading/multiprocessing)PythonConcurrency (asyncio/threading/multiprocessing)Intermediate
7How does multiprocessing.Pool let you parallelize a CPU-bound function across multiple worker processes? Python › Concurrency (asyncio/threading/multiprocessing)PythonConcurrency (asyncio/threading/multiprocessing)Intermediate
8What is a race condition, and how does it differ from a deadlock? Python › Concurrency (asyncio/threading/multiprocessing)PythonConcurrency (asyncio/threading/multiprocessing)Intermediate
9How does asyncio's event loop schedule and switch between multiple coroutines, and what makes this cooperative rather than preemptive? Python › Concurrency (asyncio/threading/multiprocessing)PythonConcurrency (asyncio/threading/multiprocessing)Advanced
10How do you safely run a blocking, synchronous function from within an asyncio coroutine without freezing the event loop? Python › Concurrency (asyncio/threading/multiprocessing)PythonConcurrency (asyncio/threading/multiprocessing)Advanced
11How do you share data between processes using multiprocessing, given that separate processes don't share memory the way threads do? Python › Concurrency (asyncio/threading/multiprocessing)PythonConcurrency (asyncio/threading/multiprocessing)Advanced
12How would you implement a producer-consumer pattern combining a thread-safe queue.Queue with multiple worker threads? Python › Concurrency (asyncio/threading/multiprocessing)PythonConcurrency (asyncio/threading/multiprocessing)Advanced
13How do you correctly cancel a running asyncio task, and how should the task itself handle the resulting CancelledError? Python › Concurrency (asyncio/threading/multiprocessing)PythonConcurrency (asyncio/threading/multiprocessing)Advanced
14How would you use concurrent.futures.ProcessPoolExecutor together with asyncio to run CPU-bound work without blocking the event loop? Python › Concurrency (asyncio/threading/multiprocessing)PythonConcurrency (asyncio/threading/multiprocessing)Advanced
15How would you design a robust worker pool that handles both graceful shutdown (finishing in-flight work) and immediate cancellation (dropping everything), using asyncio? Python › Concurrency (asyncio/threading/multiprocessing)PythonConcurrency (asyncio/threading/multiprocessing)Advanced
16What is an async generator, and how does it differ from a regular generator? Python › Async Generators & Async Context ManagersPythonAsync Generators & Async Context ManagersBeginner
17How do you consume an async generator using 'async for'? Python › Async Generators & Async Context ManagersPythonAsync Generators & Async Context ManagersBeginner
18What is an async context manager, and which two dunder methods does it require? Python › Async Generators & Async Context ManagersPythonAsync Generators & Async Context ManagersBeginner
19What does it mean that Python has 'automatic' memory management, and what's the trade-off compared to manual memory management in languages like C? Python › Memory Management & Garbage CollectionPythonMemory Management & Garbage CollectionBeginner
20What is a DbContext, and why should it generally not be shared across multiple concurrent operations? .NET › Entity Framework Core & Data Access.NETEntity Framework Core & Data AccessBeginner
21What is the purpose of the ServerCallContext parameter present in every gRPC server method, and what information does it expose? .NET › gRPC Services.NETgRPC ServicesBeginner
22How do you include structured context (like a request ID) in every log message using LoggerAdapter or extra? Python › LoggingPythonLoggingIntermediate
23How does Python's generational garbage collector work, and why generations? Python › Memory Management & Garbage CollectionPythonMemory Management & Garbage CollectionIntermediate
24What is the difference between SaveChanges() and SaveChangesAsync(), and why does it matter for a web application's scalability? .NET › Entity Framework Core & Data Access.NETEntity Framework Core & Data AccessIntermediate
25How do you implement server-streaming gRPC using C#'s IAsyncEnumerable<T> or IServerStreamWriter<T>? .NET › gRPC Services.NETgRPC ServicesIntermediate
26How do you handle backpressure when an async generator produces items faster than the consumer can process them? Python › Async Generators & Async Context ManagersPythonAsync Generators & Async Context ManagersAdvanced
27How do async generators interact with asyncio.Queue to implement a producer-consumer pattern across separate tasks? Python › Async Generators & Async Context ManagersPythonAsync Generators & Async Context ManagersAdvanced
28How would you implement a 'fan-out, fan-in' pattern using multiple async generators consumed concurrently and merged into one stream? Python › Async Generators & Async Context ManagersPythonAsync Generators & Async Context ManagersAdvanced
29How would you implement a coroutine-style generator-based pipeline (the classic pre-async/await pattern) using multiple chained 'send()'-driven generators? Python › Comprehensions & GeneratorsPythonComprehensions & GeneratorsAdvanced
30How would you implement a thread-safe caching decorator that correctly handles concurrent calls from multiple threads? Python › DecoratorsPythonDecoratorsAdvanced
31How does Python 3.11's exception groups (ExceptionGroup) and the 'except*' syntax let you handle MULTIPLE unrelated exceptions raised together? Python › Exception HandlingPythonException HandlingAdvanced
32How would you implement a circuit breaker pattern using exception handling, to stop repeatedly calling a service that's consistently failing? Python › Exception HandlingPythonException HandlingAdvanced
33How would you implement a context manager for managing a lock (like threading.Lock) while ALSO adding a timeout, raising an error if the lock can't be acquired quickly enough? Python › File I/O & Context ManagersPythonFile I/O & Context ManagersAdvanced
34How would you implement a lazy, chainable iterator pipeline (like filter-then-map) from scratch? Python › Iterators & the Iterator ProtocolPythonIterators & the Iterator ProtocolAdvanced
35Why is logging generally considered thread-safe, and what should you still be careful about in multiprocessing? Python › LoggingPythonLoggingAdvanced
36What are common patterns for implementing a producer-consumer background processing pipeline using Channel<T> with a BackgroundService? .NET › Background Services.NETBackground ServicesAdvanced
37What is the 'cache stampede' (thundering herd) problem, and how can you mitigate it? .NET › Caching (In-Memory, Distributed & Redis).NETCaching (In-Memory, Distributed & Redis)Advanced
38How would you diagnose a thread pool starvation issue in a production ASP.NET Core application? .NET › Diagnostics & Performance.NETDiagnostics & PerformanceAdvanced
39How does async/await performance compare to synchronous code, and what overhead does the async state machine introduce? .NET › Diagnostics & Performance.NETDiagnostics & PerformanceAdvanced
40What are the four types of gRPC service methods (unary, server streaming, client streaming, bidirectional streaming), and when is each appropriate? .NET › gRPC Services.NETgRPC ServicesAdvanced
41How would you implement a producer-consumer background processing pipeline using System.Threading.Channels alongside a BackgroundService? ASP.NET Core › Background Tasks & Hosted ServicesASP.NET CoreBackground Tasks & Hosted ServicesAdvanced
42How would you implement a background task queue accepting ad-hoc work items dynamically at runtime, rather than a fixed polling loop? ASP.NET Core › Background Tasks & Hosted ServicesASP.NET CoreBackground Tasks & Hosted ServicesAdvanced
43What is the 'cache stampede' (thundering herd) problem, and how would you mitigate it in an ASP.NET Core application? ASP.NET Core › CachingASP.NET CoreCachingAdvanced
44How does an IAsyncActionFilter differ from the synchronous IActionFilter, and why is the async version generally preferred for filters doing I/O work? ASP.NET Core › FiltersASP.NET CoreFiltersAdvanced