Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Threads vs Process  RSS feed

 
Rhea Camille
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
  I am reading about threads and I am confused could you please enlighten me with this.

  According to what I read "process" is consist of a multiple threads. Can we call a single threaded as a process? I saw this while reading a book.
"A process is a group of associated threads that execute in the same, shared environment. It follows, then, that a single-threaded process is one that contains exactly one thread, whereas a multi-threaded process is one that contains one or more threads."

Could you please also explain to me the difference of thread vs process, I read about that but it doesn't seem to sync in my brain.

Thank you.
 
Andrea Binello
Ranch Hand
Posts: 61
5
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rhea Camille wrote:Could you please also explain to me the difference of thread vs process

A process is an instance of a computer program (which is an application installed somewhere on your machine). If you have e.g. Ms Win, locate the shortcut to the "Notepad". Notepad is an application. If you launch Notepad you have a process, an instance of Notepad. Launch again Notepad and you have *another* process.

A thread is a "flow of execution". It is the sequential execution of some code using a single processing unit (on modern CPUs a certain "core").

A process has at least one thread but may have more. All threads share the same memory address space of the process. Threads are normally scheduled by the Operating System.

Hope I have cleared your doubts. ;)
 
Rhea Camille
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Andrea for clearing that out

Cheers!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!