Interview Question

What is multithreading?

Threads share process memory and are often useful for I/O concurrency.

💡 Concept ✅ Quick Revision 🐍 Python

Answer

Multithreading runs multiple threads within one process and shared memory space. • Threads are useful for many I/O-bound tasks. • Shared mutable data needs synchronization. • In GIL-enabled CPython, threads do not normally execute Python bytecode in parallel for CPU-bound work.

💡 Simple Example

from threading import Thread def work(): print('worker') thread = Thread(target=work) thread.start() thread.join()

Output

worker

⚡ Quick Revision

Threads share process memory and are often useful for I/O concurrency.