ZZomato·BehavioralL3DSA Round

Difference Between a Process and a Thread

viaGlassdoor

Question: What is the difference between a process and a thread? Give a real-world example of an application of threads.

Answer framing: A process is an independent execution unit with its own memory space, file handles, and resources, isolated from other processes. A thread is a lightweight unit of execution within a process, sharing the process's memory space and resources with other threads in the same process, making context switching between threads cheaper than between processes but requiring careful synchronization to avoid race conditions. Real-time example: a web browser using separate threads to render the UI, fetch network resources, and run JavaScript concurrently, all within the same process.

Add a follow-up question they asked
No follow-ups yet. Be the first to add one.
asked …
LeaderboardSalary
Language
Account