JAVAnewbie
asked on
Some question about Thread
I have come across the java tutorial at:
http://java.sun.com/docs/books/tutorial/essential/threads/
and i was confused... and i hope experts here can give me a clear explanation about:
1) Thread
i know what is a thread, but how can we use it?
2) Runnable
what is runnable? how to use it?
3) Timer
how to use? what is does? and most importantly, what is it?
4) TimerTask
how to use? what is does? and most importantly, what is it?
5) i think i've seen
Thread aThread = new Thread(new Runnable(){...});
before..(not quite sure the real code).. what it does?
6) what is synchronization? how to "use" it? or make sth synchronize?
*My English is very bad, so, please make your explanation simple, with example...
Tks
PS: i allocate 50 pts for each answer, totalling to 300.
http://java.sun.com/docs/books/tutorial/essential/threads/
and i was confused... and i hope experts here can give me a clear explanation about:
1) Thread
i know what is a thread, but how can we use it?
2) Runnable
what is runnable? how to use it?
3) Timer
how to use? what is does? and most importantly, what is it?
4) TimerTask
how to use? what is does? and most importantly, what is it?
5) i think i've seen
Thread aThread = new Thread(new Runnable(){...});
before..(not quite sure the real code).. what it does?
6) what is synchronization? how to "use" it? or make sth synchronize?
*My English is very bad, so, please make your explanation simple, with example...
Tks
PS: i allocate 50 pts for each answer, totalling to 300.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
a thread is a process.
it is something like this,
u go to a gas station and ask someone to fill the gas while you go inisde and have a beer.
u do this because filling gas and drinking beer and diffrent process and do not affect each other and can be done in any order.
the act of calling someoneFillGas() is writen in a thread
somefileGas will be in class that extends threads and has a run() method
try this
http://www.ecs.umass.edu/ece/wireless/people/emmanuel/java/java/threads/simple.html
Hope this helps.
Cheers
it is something like this,
u go to a gas station and ask someone to fill the gas while you go inisde and have a beer.
u do this because filling gas and drinking beer and diffrent process and do not affect each other and can be done in any order.
the act of calling someoneFillGas() is writen in a thread
somefileGas will be in class that extends threads and has a run() method
try this
http://www.ecs.umass.edu/ece/wireless/people/emmanuel/java/java/threads/simple.html
Hope this helps.
Cheers
Chck these meanwhile
http://oldlook.experts-exchange.com/questions/10170133/difference-b-w-process-and-a-thread.html?query=threads&searchType=topic
http://oldlook.experts-exchange.com/questions/20547364/threads-locks-and-concurrent-processes.html?query=threads&searchType=topic
DO NOT ACCEPT MY COMMENT AS ANSWER.... good are are sure to come by :) hang on
http://oldlook.experts-exchange.com/questions/10170133/difference-b-w-process-and-a-thread.html?query=threads&searchType=topic
http://oldlook.experts-exchange.com/questions/20547364/threads-locks-and-concurrent-processes.html?query=threads&searchType=topic
DO NOT ACCEPT MY COMMENT AS ANSWER.... good are are sure to come by :) hang on
ASKER
;)
i will definitely wait til all my question being answered then i allocate my pts.. ;)
tks so very much!
i will definitely wait til all my question being answered then i allocate my pts.. ;)
tks so very much!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thx for the points :)
:-)
:) Glad to help . . .
ASKER