Threads vs Processes, Concurrency vs Parallelism, and Multicore Multithreading
Company: Arista Networks
Role: Software Engineer
Category: Software Engineering Fundamentals
Difficulty: medium
Interview Round: Technical Screen
A virtual interview round for a software engineering role opened with concept questions about multithreading and the operating-system ideas behind it, before any coding. Answer each part as you would aloud, with concrete examples from code you know. Examples in any language are fine.
### Clarifying Questions
- Should the answers describe operating systems in general, or a specific one such as Linux, where threads and processes are created through the same system call?
- For the multicore question, is the interest in hardware effects on a running multithreaded program (caches, memory ordering), or in how to structure software to use many cores, or both?
- For the project discussion, should the focus be the design of the concurrency or the problems found and fixed?
### Part 1 — A multithreaded project
Describe a project of yours that used multiple threads: why it needed them, how the work was divided among threads, how shared state was protected, and a concurrency problem you hit and how you fixed it.
```hint Lead with the shared state
Interviewers probe which data more than one thread could touch and what guaranteed correctness there. Choose a project where you can name that data and the exact mechanism that protected it.
```
#### What This Part Should Cover
- Why concurrency was needed and how the work was split among threads
- The shared state and the synchronization that protected it, with the reason for that choice
- A concrete concurrency bug or bottleneck: symptom, diagnosis, fix and how it was verified
### Part 2 — Thread versus process
Explain the difference between a thread and a process.
```hint Start from what is shared
List what the threads of one process share and what each thread has to itself, then derive the consequences for cost, isolation and communication.
```
#### What This Part Should Cover
- What a process owns versus what each thread owns
- Creation and context-switch cost, isolation and the impact of a crash
- How each communicates, and when to choose one over the other
### Part 3 — Concurrency versus parallelism
Explain the difference between concurrency and parallelism, with an example of each.
```hint Count the cores
Ask which of the two can happen on a machine with a single core and which cannot.
```
#### What This Part Should Cover
- Precise definitions of both terms
- An example of concurrency without parallelism and an example of parallelism
- Why the distinction matters for performance and for correctness
### Part 4 — Multicore processors and multithreading
How do multicore processors affect the behavior and performance of multithreaded programs today?
```hint Threads really overlap
Consider what changes when two threads of the same program run at the same instant on different cores that share memory through their caches.
```
#### What This Part Should Cover
- Truly parallel execution and the limits on the speedup it gives
- Caches, cache coherence, false sharing and memory ordering
- Choosing thread counts, and scheduling and placement in practice
### What a Strong Answer Covers
- Precise definitions tied to concrete mechanics: address spaces, stacks, the scheduler, cores and caches
- Correct synchronization vocabulary (data race, mutex, atomic, deadlock) and when each applies
- Performance reasoning: context-switch cost, contention, the serial fraction of the work, cache effects
- A real project story with a specific concurrency problem, its diagnosis and its fix
- Awareness that runtimes differ, for example a global interpreter lock
### Follow-up Questions
- Two threads each increment a shared counter one million times without a lock. What final values are possible and why? Fix it with a mutex, and then with an atomic.
- When would you build a network service from multiple processes rather than multiple threads?
- A CPU-bound job on an 8-core machine stops getting faster beyond 8 threads and is slower at 32. Explain why.
- What is false sharing, and how would you detect and fix it?
Overview: A concept interview question set on multithreading: walk through a multithreaded project, then explain threads versus processes, concurrency versus parallelism, and how multicore processors affect multithreaded programs. It tests operating-system fundamentals, synchronization choices and performance reasoning.
Read the full Arista Networks Software Engineer interview experience this question came from