+ 7

what threads are needed for?

For what purposes are the threads

18th Feb 2019, 6:05 AM
Ilya R
Ilya R - avatar
3 Answers
+ 2
Threads are used to speed up your program and to make it more responsive. As a beginning programmer, and with the high single thread speeds of modern machines, you may not see a need for multiple threads for a while. Let's say you have a huge 14 magapixel image and you are writing an image editor, the user wants to rotate the image by 17 degrees and shrink it with out losing and pixel data. If you do not put this operation into it's own 'thread' and create another thread to respond to the user mouse clicks and keyboard, then it will seem like the device has frozen up and is doing nothing, where as actually it is working very hard on the tasks that you gave it. You may have heard of 8 core or 16 core processors, well, a core is sort of like a mini computer sitting right inside of your main processor, and it marries well with 'threads'. Your operating system will hand the job (code) that you put into a thread off to a different core on the processor.
23rd Apr 2019, 2:23 AM
James McLain
James McLain - avatar
+ 7
Lo and behold! The sacred texts! https://www.sololearn.com/learn/Java/2185/?ref=app Actually in all of seriousness, it is an instance of a process in the CPU (correct me if I am wrong)
18th Feb 2019, 6:14 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 5
Thanks
23rd Apr 2019, 8:17 AM
Ilya R
Ilya R - avatar