Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

What is a thread inside a computer system


  • Please log in to reply
5 replies to this topic

#1 radhika12

radhika12

  • Members
  • 9 posts
  • OFFLINE
  •  
  • Local time:05:41 PM

Posted 02 January 2015 - 11:33 PM

I have already a lot about the thread and the difference between thread and process ,but still I am not yet clear with the overall visualization and picture of what the thread actually is?

 

Also the term THREAD POOL is quite confusing ,so please can someone make me visualize the picture of thread,is it some signal ,some instruction ,what is it and actually when people talk about the fact that the OS selects a particular thread for execution from the thread pool ,then what is this pool actually and where is it present? 



BC AdBot (Login to Remove)

 


#2 the_patriot11

the_patriot11

    High Tech Redneck


  • BC Advisor
  • 6,763 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Wyoming USA
  • Local time:06:11 AM

Posted 04 January 2015 - 03:43 PM

simple terms, its basically a sequence of instructions that tells the computer what to do. A more detailed description can be found here:

 

 

http://arstechnica.com/business/2011/04/ask-ars-what-is-a-cpu-thread/


picard5.jpg

 

Primary system: Motherboard: ASUS M4A89GTD PRO/USB3, Processor: AMD Phenom II x4 945, Memory: 16 gigs of Patriot G2 DDR3 1600, Video: AMD Sapphire Nitro R9 380, Storage: 1 WD 500 gig HD, 1 Hitachi 500 gig HD, and Power supply: Coolermaster 750 watt, OS: Windows 10 64 bit. 

Media Center: Motherboard: Gigabyte mp61p-S3, Processor: AMD Athlon 64 x2 6000+, Memory: 6 gigs Patriot DDR2 800, Video: Gigabyte GeForce GT730, Storage: 500 gig Hitachi, PSU: Seasonic M1211 620W full modular, OS: Windows 10.

If I don't reply within 24 hours of your reply, feel free to send me a pm.


#3 radhika12

radhika12
  • Topic Starter

  • Members
  • 9 posts
  • OFFLINE
  •  
  • Local time:05:41 PM

Posted 04 January 2015 - 09:12 PM

Sir,can you please once explain the term "THREAD POOL", its still quite confusing.

Also ,when such statements are made like "CPU PICKS UP A THREAD FROM THE THREAD POOL ", this statement is highly confusing ,What is the meaning of this and how actually an instruction can be picked up ,It is usually made in JAVA wherein JVM selects the native threads for execution.



#4 the_patriot11

the_patriot11

    High Tech Redneck


  • BC Advisor
  • 6,763 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Wyoming USA
  • Local time:06:11 AM

Posted 04 January 2015 - 09:19 PM

A thread pool is a group of pre-instantiated, idle threads which stand ready to be given work. These are preferred over instantiating new threads for each task when there is a large number of short tasks to be done rather than a small number of long ones. This prevents having to incur the overhead of creating a thread a large number of times.

Implementation will vary by environment, but in simplified terms, you need the following:

  • A way to create threads and hold them in an idle state. This can be accomplished by having each thread wait at a barrier until the pool hands it work. (This could be done with mutexes as well.)
  • A container to store the created threads, such as a queue or any other structure that has a way to add a thread to the pool and pull one out.
  • A standard interface or abstract class for the threads to use in doing work. This might be an abstract class called Task with an execute() method that does the work and then returns.

When the thread pool is created, it will either instantiate a certain number of threads to make available or create new ones as needed depending on the needs of the implementation.

When the pool is handed a Task, it takes a thread from the container (or waits for one to become available if the container is empty), hands it a Task, and meets the barrier. This causes the idle thread to resume execution, invoking the execute() method of the Task it was given. Once execution is complete, the thread hands itself back to the pool to be put into the container for re-use and then meets its barrier, putting itself to sleep until the cycle repeats.


picard5.jpg

 

Primary system: Motherboard: ASUS M4A89GTD PRO/USB3, Processor: AMD Phenom II x4 945, Memory: 16 gigs of Patriot G2 DDR3 1600, Video: AMD Sapphire Nitro R9 380, Storage: 1 WD 500 gig HD, 1 Hitachi 500 gig HD, and Power supply: Coolermaster 750 watt, OS: Windows 10 64 bit. 

Media Center: Motherboard: Gigabyte mp61p-S3, Processor: AMD Athlon 64 x2 6000+, Memory: 6 gigs Patriot DDR2 800, Video: Gigabyte GeForce GT730, Storage: 500 gig Hitachi, PSU: Seasonic M1211 620W full modular, OS: Windows 10.

If I don't reply within 24 hours of your reply, feel free to send me a pm.


#5 radhika12

radhika12
  • Topic Starter

  • Members
  • 9 posts
  • OFFLINE
  •  
  • Local time:05:41 PM

Posted 04 January 2015 - 09:27 PM

Sir ,I am understanding the things but still one confusion is not getting cleared and that is when we say that a thread is a series of instructions and instructions are generated by the control unit ,then how come these instructions are pre instantiated inside a container.I am still not clear with this term.



#6 the_patriot11

the_patriot11

    High Tech Redneck


  • BC Advisor
  • 6,763 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Wyoming USA
  • Local time:06:11 AM

Posted 05 January 2015 - 12:48 AM

a thread is a series of instructions. a pool, is basically where the computer "stores" a bunch of commonly used threads until it is ready for them. A CPU has 4 threads, a, b c, and d. It will store b, c, and d in a "thread pool" while it is running thread "a". when it is done with "a" it will pull out the next set of instructions.

 

That definition, is as basic as it gets, probably not 100% accurate and ill probably get strangled by some techy for it, but thats the best way I know of describing it.


picard5.jpg

 

Primary system: Motherboard: ASUS M4A89GTD PRO/USB3, Processor: AMD Phenom II x4 945, Memory: 16 gigs of Patriot G2 DDR3 1600, Video: AMD Sapphire Nitro R9 380, Storage: 1 WD 500 gig HD, 1 Hitachi 500 gig HD, and Power supply: Coolermaster 750 watt, OS: Windows 10 64 bit. 

Media Center: Motherboard: Gigabyte mp61p-S3, Processor: AMD Athlon 64 x2 6000+, Memory: 6 gigs Patriot DDR2 800, Video: Gigabyte GeForce GT730, Storage: 500 gig Hitachi, PSU: Seasonic M1211 620W full modular, OS: Windows 10.

If I don't reply within 24 hours of your reply, feel free to send me a pm.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users