Which of the following best describes how resources are allocated between a process and a thread?
Think about how multitasking works in your computer and how programs run independently.
Processes are independent execution units with their own memory and resources. Threads are smaller units within a process that share the same memory space, allowing them to communicate easily but requiring careful synchronization.
What is the main difference in execution context between a process and a thread?
Consider what allows a thread or process to run independently.
Both processes and threads have their own execution context such as program counter and stack. However, threads within the same process share memory space but have separate stacks and registers.
What typically happens when a thread fails compared to when a process fails?
Think about isolation and how errors propagate in multitasking systems.
Threads share the same memory space, so a failure in one thread can affect the process but usually only that thread crashes. A process failure is isolated and does not affect other processes or the system.
Which statement correctly compares the overhead of creating a process versus creating a thread?
Consider what resources need to be allocated when starting a new process or thread.
Creating a process requires allocating separate memory and resources, which is more expensive. Threads share the process's resources, so creating a thread is faster and uses less overhead.
A web server needs to handle many simultaneous client requests efficiently. Which approach is generally better and why?
Think about performance and resource sharing in handling many tasks at once.
Threads share memory and resources within a process, allowing faster communication and less overhead than multiple processes. This makes threads more efficient for handling many simultaneous requests in a web server.