Wednesday, December 3, 2014

process vs thread [OS]

Process vs Thread
A problem with processes
1. expensive to create a new process.
construct new data structure in the kernel
copy memory
2. expensive to switch between
processes (context switch)  
3. cache must be flushed
4. registers reloaded
5. kernel scheduler and dispatcher is always involved
Threads in the same process share
1. process instructions most data
2. open files (descriptors)
3. signals and signal handlers

Each thread has a unique
1. Thread ID
2. set of registers, stack pointer
3. stack for local variables, return addresses

No comments:

Post a Comment

Please add your valuable feedback and suggestion...

Note: Only a member of this blog may post a comment.