Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Threads based proj.

 
Waez Ali
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

I have studied threads but I want to develop one small project to really get clear picture of apis and how it works.

If you know any sources/links/ or you would propose any small proj that I can develop in multithreads.. it would be really helpful.

Thank You
 
Emanuel Kadziela
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Incrementing a counter is always a good multithreaded problem. You can try something like this: Have a global counter and n threads which increment it in a thread safe way. Each of the n threads should increment the counter x number of times with x>1. Whenever the counter is incremented, the thread doing the increment should print out its name, the value before and the value after.

If you want bonus difficulty, ensure that no thread increments the counter more than once more than any other thread - in other words, every thread gets to increment before any other thread goes again.
 
Waez Ali
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks I will try this out... please let me know any other interesting assignments.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic