• 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

Threads/Concurrency is my weakness. Help very much appreciated.

 
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have been searching for tips and techniques on answering Threads and Concurrency related questions here at JavaRanch. But I couldn't find any. Google search neither returns nice articles about tips on answering such kind of questions.

In the mocks if I encounter the word Thread I would often skip and then answer them last. It pretty scares me. I always get failing scores on Threads part on Mocks. I get low scores from other topics too but I guess this topic is where I'm least confident.

Do you know any articles about techniques on answering Threads and Synchronization?

For example, I found Corey's post about Garbage Collection very helpful. I thought pictures are for kids only so I refused to draw before and tried to picture what is happening only in my mind. When I read that post, I found out that what I was doing was very wrong. So I started drawing (and writing).

For Threads, usually I write the threads being started in columns and then write their corresponding outputs. After that I try to analyze the combination possibilities. However at some point my flow of thoughts just suddenly becomes unorganized.

I hope you can share your insights on how you answer Threads/Concurrency questions. Thank you!
[ September 02, 2008: Message edited by: Denise Saulon ]
 
Ranch Hand
Posts: 433
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, I consider my concurrency part quite strong, Because I had developed one whole module of a big software alone which was completely based on threads..I found it quite difficult to explain threads using words, as it will stretch to quite long.
I prefer if you can make some small application using threads.
If will clear your concepts.
 
Denise Advincula
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you. I agree with you. It's quite difficult to trace/explain Threads by words or drawing. It usually gets messed up somewhere in the middle.

I agree too, that developing an application purely based on threads would help me. But do you have any suggestions for a kind of application I can develop that will widely use various concepts covered in the exam - synchronized, wait, notify, notifyAll, sleep, yield, etc...

Thanks again for your reply
 
Deepak Chopra
Ranch Hand
Posts: 433
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have one blur Idea, this is a part of project one of my friend was involved in.
Support you have four text files,
1.txt,2.txt,3.txt,4.txt --> you have to merge all these four files into one file.
but remember when one file is being written, no other file can be written.
Order of file doesn't matters.
but when you want to retrieve you just need to pass the file name.
you can make a hash-map : key --> file name and value --> location in merge.txt
Can create:
four thread corresponding to each text file, actually these number of threads should be flexible depending upon the number of files in the directory.
can create one listener thread, which will listen to directory as soon as file comes to directory it will shoot one thread which will write it content in the merge txt.

I hope you get an Idea.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic