What is use of thread | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 14

What is use of thread

18th Feb 2017, 6:17 PM
soumya
soumya - avatar
4 Answers
+ 7
for running a code which does multiple things at once imagine a program with one thread which makes some calculations, while another thread is taking user input or doing something else it makes better usage of your proccessors computation power by running in parallel
18th Feb 2017, 6:24 PM
Burey
Burey - avatar
+ 6
In Android I did this to send a 'periodic action off into a future space/time'. The idea was that the main program works as if it had nothing else to do and then--every so often--the thread would come back, interrupt the main program and make something happen. In addition to @Burey's 'parallel', this is 'asynchronous' (or even on-demand). It's​ useful for API's, file system / critical event monitoring, performance timing, etc.
18th Feb 2017, 6:51 PM
Kirk Schafer
Kirk Schafer - avatar
+ 2
Imagine you have to make many programs to run on parallel tracks.Here comes the use of thread where they helps to minimise the time consumption.For eg A program to display the conversation between two people.
30th Apr 2017, 12:57 PM
yashasvi joshi
yashasvi joshi - avatar
+ 2
dividing a single program into smaller chunks so they can work independently at the same time and the chunk is called thread.also they can be used multiple times in the same program.
1st May 2017, 7:47 AM
Areena Memon