multi-threading


In Linux, an instance we call it as a process. And The process might have multiple threads(0 or 1 or more). by default a process is a single threaded. 
q).process vs threads ?
*.all threads are part of process. the main process is main thread. 
eg: if we have multiple threads, all threads are child's for an associated process.
q).how we can create thread?
*. pthread_create() call helps developer to create thread in programmatic way.
q)why we are bringing multi-threaded?
*.in case for a certain reason any one of thread of an associated process is halted/waited for some other reason, the other threads can continue it's own execution rather than dependent on halted/waited thread state. this way the multi threaded program always busy in utilization of cpu resource and ready to give more throughput.
Multi-threaded program get benefited in multi core/processor system. where multiple threads have a chance to run on multiple cores/processor
q)what if Threads runs on single core/processor system?
*. Ideally we don't have any benefit when we run multi-threaded program on single core/processor device.
q).How thread is different to process?
*.a process instructions might be executed on single processor/core.
*.a thread instructions(suppose we have multi-threaded) might be executed on one or more processor/core's.