Synchronous multithreading in Java (Apache HTTPClient) -


i wondering how go doing this. load list of 1,000 words , each word thread created , google search on each word. problem here obvious. can't have 1k threads, can i. keep in mind extremely new threads , synchronization. wondering how go using less threads. assume have set thread amount fixed number , synchronize threads. wondering how apache httpclient using getthread , run it. in run i'm getting data webpage , turning string , checking if contains word.

maybe can @ problem way.

you have 1000 words , each word going carry out search. in other words there 1000 tasks executed , not related each other, there no need synchronization in case of problem per following definition wiki.

"in computer science, synchronization refers 1 of 2 distinct related concepts: synchronization of processes, , synchronization of data. process synchronization refers idea multiple processes join or handshake @ point, in order reach agreement or commit sequence of action. data synchronization refers idea of keeping multiple copies of dataset in coherence 1 another, or maintain data integrity"

so in problem not have synchronize 1000 processes execute word searches since can run independently , dont need join forces. not process synchronization.

it not data synchronization either since data of each search independent of other 999 searches.

hence when joshua says synchronization when blocking you, there no need of blocking in case.

yes tasks can concurrently executed in different threads. of course system may not have resources run 1000 threads concurrently ( read same time ). need concepts pools pool has no of threads...say if has 10 threads...then 10 start 10 independent searches on 10 words list. if of them done task take next word search task available , process goes on....


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -