Solved

threads question

Posted on 2011-04-26
4
290 Views
Last Modified: 2012-05-11
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
Comment
Question by:gudii9
  • 2
4 Comments
 
LVL 47

Expert Comment

by:for_yan
ID: 35469067
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
 
LVL 7

Author Comment

by:gudii9
ID: 35471157
>>.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
 
LVL 47

Accepted Solution

by:
for_yan earned 250 total points
ID: 35471420
This is kind of figurative speech which emphasizes that threads in java can interact share
the dats spawn one another and so on...
0
 
LVL 92

Assisted Solution

by:objects
objects earned 250 total points
ID: 35471651
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
bunnyEars2 challenge 6 70
Updating Java 9 87
Books that can get me started on JAVA 2 56
word0 challenge 3 58
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now