Processes and threads
Operating systems create, schedule, and terminate processes. Threads can share data efficiently but must coordinate access. Context switching saves enough execution state to resume another task, and excessive switching has overhead.
View key idea and practice
A process is a running program with its own address space and resources. A thread is an execution path within a process that shares some process state.
Worked exampleA browser may use separate processes for isolation and threads inside a process to perform work concurrently.
Try itGive one benefit and one coordination risk of moving two tasks into threads within one process.
Suggested checkThreads share memory and can communicate quickly. They can race while updating shared state, so synchronization or ownership design is needed.