• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 313
  • Last Modified:

threads question

Threads are lightweight processes that appear to run in parallel with your main program. Unlike a process a thread shares memory and data with the rest of the program. The word thread is a contraction of "thread of execution", you might like to imagine a rope from which you have frayed the end and taken one thread. It is still part of the main rope, but it can be separated from the main and manipulated on its own. Note that a program that runs with multiple threads is different from simply starting multiple instances of the same program, because a Threaded program will have access tot he same data within the program.

I was reading above staemtent. I have not understood the statement, concept behind clearly.
Please advise. Any ideas, sugestions, sample code, links, resources highly appreciated. thanks in advance
0
gudii9
Asked:
gudii9
  • 2
2 Solutions
 
for_yanCommented:
I'm sure, you know that threads is Java way to implement simultaneous execution of several
processes. Java has extensive and convenient methods which allow to launch several threads of execution
and manage those threads - stop and resume them, kill them, make interaction and communication
between the threads and allow them to access the same variables.
In some situations it is convenient to have long job - say delaing with files or databases in
one thread in background, and at the same time user could inteeract with application
through another thread.

With all that - it brings additional level of complexity to write programs
taking advantage of threads. So if it does not bring a real benefit in a sense of user interactions
and efficiency you will probably  prefer to stick to normal one-threaded application.

If you ask more specific question, you'll probably get better answers from the folks here.

0
 
gudii9Author Commented:
>>.you might like to imagine a rope from which you have frayed the end and taken one thread. It is still part of the main rope, but it can be separated from the main and manipulated on its own.

I was not clear on this statement in particular. please advise
0
 
for_yanCommented:
This is kind of figurative speech which emphasizes that threads in java can interact share
the dats spawn one another and so on...
0
 
objectsCommented:
A program can be made up of multiple threads (of execution)
Each thread can access the application data independently

http://en.wikipedia.org/wiki/Thread_(computer_science)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now