• Post Reply Bookmark Topic Watch Topic
  • New Topic

What to create to learn Threads in java?

 
Volodymyr Lysenko
Ranch Hand
Posts: 512
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have already created program that simulates traffic lights.

What to create next to learn java threads?


P.S. I don't want conway's game of life.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35719
412
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you heard of the producer/consumer problem? That might be a good next problem.
 
Volodymyr Lysenko
Ranch Hand
Posts: 512
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for reply!

I have done this already and other basic tasks!

I need smth more interesting, but not very difficult.
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You want to do those examples to understand concurrency? If yes, then I recommend reading "Java Concurrency in Practice". Although I haven't read it yet, it's a very highly regarded book when it comes to Java concurrency. The reviews are here
 
Chan Ag
Rancher
Posts: 1089
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I reckon you must have already solved the producer consumer problem using multiple techniques.
I know that blocking queues is the way to go for it, but the other ways teach you the basics that are critical.
But I'm sure you must be past that stage.

I reckon you must have already written programs that use Locks, Conditions etc.

If yes, you might want to write programs that make use of thread pools, executors, and schedulers.
Have you used types like AtomicInteger etc already? If not, just knowing how they work might help.
You could also look at the techniques to minimize synchronization.




 
Chan Ag
Rancher
Posts: 1089
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By the way, in the book 'Java Threads'- Edition 3, the authors have demonstrated simple concepts in the very first chapter by the means of a simple game. With every chapter
the authors add something more advanced to that same game.
This way they are able to explain to their readers the subtle differences
amongst various approaches.

That same game ... all through till chapter 14.
It's awesome. And when there is a need to explain something more, something different,
you will see a different example. There are several examples in that book and they are examples that
will teach you how to write that kind of code in real applications.






 
Arun Giridhar
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
books are boring imo
 
Abhay Agarwal
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Certain exercies can be
a. program to create a deadlock . if possible link it with Out of memory error .. take dump and solve the deadlock
b. program to use cyclic barrrier, semaphores, Locks, CountdownLatch etc
OR
we can write a sample Online Bidding web application [ kind of ebay] .. where multiple threads try to bid for same product(s)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!