What is the difference between a process and a thread?

Sponsored Links

Filed under: introduction 

process-vs-threadProcess is defined as the virtual address space and the control information necessary for the execution of a program while Threads are a way for a program to split itself into two or more simultaneously running tasks. In general, a thread is contained inside a process and different threads in the same process share some resources while different processes do not.

Source

In terms of Loadrunner, when we run Vuser as a process, LoadRunner creates 1 process called mmdrv.exe per Vuser. So if we have 10 Vusers, we will have 10 mmdrv.exe processes on our machines.

while when we run Vuser as a thread, LoadRunner creates 1 thread per Vuser. So if we have 10 Vusers, then we will have 1 process with 10 threads running inside it if the limit is 10 threads per process.

Running Vuser as a thread is more memory efficient that running Vuser as a process for obvious reasons that less memory resources are utilized when we run them as thread. I read somewhere that running as a process has an advantage that system becomes more stable. Now how is that         stability achieved? I am not sure…Can someone clarify this point to me?

Note that while running Java Virtual User, JVM’s are loaded per process and will follow the same principle above.

Related: What is RAM, Memory Usage, CPU Usage, Paging in terms of LoadRunner?

Comments

2 Comments on What is the difference between a process and a thread?

  1. Hydrolyze on Fri, 16th Oct 2009 6:55 am
  2. Just wanted to say hello all. This is my first post.

    I would like to learn alot here.

  3. Ivo Plamenov on Wed, 4th Nov 2009 3:57 pm
  4. The decision whether to run Vusers as separate processes rather than threads in a process is connected with the concept of thread safety. When a multi-threaded application (in our case the Vuser script) is executed, all threads execute simultaneously in a shared address space and each thread has access to nearly all the memory of every other thread. Thus, when a large number of Vusers is run, side effects can appear if non thread-safe procedures are used in the Vuser code. In this case Vusers have to be run as separate processes.

    Further information regarding the Vuser thread safety can be found in the LoadRunner documentation. I myself have seen functions in the Function Reference that are explicitly marked as not thread-safe under certain circumstances. For example, under Unix, strftime is not thread-safe.

Tell me what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!





  • Subscribe to this blog

    Enter your email address:

    Delivered by FeedBurner