This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Resources on Threads  RSS feed

 
Pankaj Kumarkk
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to prepare for multithreading conepts. I would like to know if I can get a list of problems (with or without solutions) which could be solved by applying threading concepts. I looked into forum for same but could not find. Can somebody guide me to any related resources.
Currently I am googling to search for possible problems/exercises but it is very tedious.

My intent is to solve a lot of problems using threading concepts.
 
Stephan van Hulst
Saloon Keeper
Posts: 6980
110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A great way to increase understanding about threads is to start making graphical user interfaces. Threads are used a lot to keep interfaces responsive, while certain tasks are performed in the background.
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can understand why google is not helping. Proper use of threads and/or independent processes is critical for any complex operation. GUI interfaces is the most obvious, but there are lots more. Operating systems and advanced applications have been using "daemon" to handle things for at least 50 years.

Here is a simple example from code I've written recently:

You are having the user enter a person's name, address, phone number, etc. You want to display the information not only in a table/spreadsheet, but also on a map. This means you have to use a "geocoding" service to convert the address to a lat/long pair. Google, Yahoo! and others offer web-based services to do this. You don't want to make your user wait for the response from Google/Yahoo!, and more importantly from a design standpoint, you don't even care how long it takes for the geocoding to happen, as long as its done before someone wants to see the map. This is a perfect use case for a daemon process, aka thread. You spawn off a thread to talk to Google, your application sends a message with the new address, and you let the daemon thread talk to Google, get the results and update your database.
 
Rohan Dhapodkar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Implement your own ThreadPool with fix number of threads. User will create an instance of ThreadPool using constructor/static method.
when user wants to execute any job it will pass instance of Runnable to thread pool, any free thread will pick that Runnable, else queue all such Runnable and when any thread is free, it will pick from that queue.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!