Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sample Concurrency projects in Java

I finished reading the first seven chapters of Java Concurrency in Practice. Can you give me any ideas of sample projects so that my ideas will become solidified ?

like image 319
user2434 Avatar asked Nov 20 '25 01:11

user2434


2 Answers

How about implementing your own 'thread safe' list and then making multiple threads add, get, and remove elements from it? Liberal use of System.out would show you just how interesting it can get when multiple threads work on the same data structure.

like image 197
claymore1977 Avatar answered Nov 22 '25 15:11

claymore1977


This guy has a great set of tutorials on concurrency. jenkov tutorials

One interesting exercise try to create a "fair" lock using nothing but the simplest java language constructs. It allows you to become intimately familiar with all the paranoia inducing aspects of threads(race conditions, missed signals, etc.) and helps us come to terms with why the prospect of writing multi-threaded applications keep me up at night.

like image 30
nsfyn55 Avatar answered Nov 22 '25 16:11

nsfyn55