• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

need a thread

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
i need to know what sort of thread based assignment should ibe doin.as ive only few days to complete it so it shounldnt be tuff!! need an idea ? got one?
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you preparing for a particular certification (SCJP, SCJD, etc.), just doing some self-study, or what type of problem are you looking for?
 
ani khan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi yuri,thanx for taking out your time,infact iam doin bachelors in comp sci,& ive been given an assignment by my teacher to just imlpement multi threading in java,nothing complex though,it should just give a basic idea of multithreading & monitors.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One of the first multi threaded progs I had to write was a threaded version of Conways Game of Life.
Basically what happens is you have a grid of squares, each can be either 'alive' or 'dead'. Based on rules, in the next step squares can either come alive, die, stay alive or stay dead depending on the squares around it. For example, if a square is alive and has 6 or more (immediate) neighbors it dies of crowding, if it has less than 3 neighbors it dies of loneliness. A dead cell with 3-6 alive neighbors will become alive.
You can mess around with the numbers if you want.
Normally the 'game' (it's actually a simple artificial life simulator) has discrete steps where every square gets to check its neightbors before progressing to the next stage.
In the multi-thread version, have each square running as a separate thread and put a simple GUI on it to show the results...
Help at all?
Dave
 
ani khan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanx dave,
but i cant build anything like that at the moment.for instance there is a method calles transactions (banking), weve to make sure that no customer enters it if other customer is utilizing it
& weve to implement this method using threads & monitor i.e
synchronize method.can u plz tell me how am i supposed to build it,as i havent done threading before .
the idea u gave is truly fantastic & ill implement it in my holidays.
thanx once again
 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Anil,
if you know a bit of network progg in java, you can easily implement a server which receives multilple requests from different clients. A simple chat prog. in brief
Cheers
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic