Match a job Paths Subjects Questions Quizzes Pricing
Overview Read Practice

Practice — Concurrency vs Parallelism (5 questions)

Beginner Short answer Free

Concurrency vs Parallelism Permalink →

Define concurrency and parallelism precisely, and explain the relationship between them. Give one concrete example where a system is concurrent but not parallel.

Share this question

Intermediate Short answer Free

Threads vs Processes Permalink →

Compare threads and processes across memory, communication cost, and crash isolation. When would you deliberately choose multiple processes over multiple threads?

Share this question

Intermediate Open Free

The GIL and Workload Choice Permalink →

A Python service has two hot paths:

  1. A route that computes SHA-256 hashes over large in-memory buffers in a tight Python loop.
  2. A route that fans out to five external HTTP APIs and aggregates the responses.

For each path, would you use threads, asyncio, or multiprocessing? Justify each answer in terms of the GIL.

Share this question

Advanced Open Free

Sharing One Async Session Permalink →

The following async handler crashes under load with InvalidRequestError: This session is provisioning a new connection; concurrent operations are not permitted:

a, b, c = await asyncio.gather(
    get_top_subjects(db),
    get_top_questions(db),
    get_categories(db),
)

Explain the root cause in terms of concurrency, and give two different correct fixes.

Share this question

Intermediate Short answer Free

How One Thread Serves Many Users Permalink →

If an asyncio web server runs on a single thread with a single event loop, how can it serve thousands of simultaneous users without blocking? What is the eventual bottleneck for database-heavy endpoints?

Share this question

We use cookies for product analytics to improve OmniAtlas. See our Privacy Policy.