Becoming good at multi-threading - Java

New / Eng
runfast

New Eng

BIO
6 years - full stack web development.
runfastmore
Mar 23 16 Comments

I have been writing code in Java for 5 years and never got a chance to write any threading apps. I would like to become good at that. Any course work or small project that would help me ??

Another reason why I want to do is, companies like Netflix and others test a lot in multi-threading (checked Glassdoor). So for that just reading threading topics is enough or should have coded in threading ?

comments

Want to comment? LOG IN or SIGN UP
TOP 16 Comments
  • Cisco abbaba
    Learn golang, use channels, not worry about threading. Or use actor library in java. Threading is not something you do out of box, you end up using threadpools, the only hard part is shared state. Just buy concurrency in java book if you need help with shared state.
    Mar 23 0
  • Sina.com / Eng
    WLB

    Sina.com Eng

    PRE
    Facebook, Apple, Amazon, Netflix, Google
    BIO
    Software Engineer and former phd candidate in biophysics
    WLBmore
    use sophisticated frameworks and don't try to diy it
    Mar 23 3
    • Dropbox systest
      Some interviewers will ask you to explain and drill down to fundamentals (condvar, lock, semaphore)
      Mar 23
    • Google camelCase
      For interviews this is wrong advice.
      There is an old book “Concurrent programming in Java” by Doug Lea which is decent.
      Mar 23
    • Sina.com / Eng
      WLB

      Sina.com Eng

      PRE
      Facebook, Apple, Amazon, Netflix, Google
      BIO
      Software Engineer and former phd candidate in biophysics
      WLBmore
      oh certainly, you should learn a bit for interview, but dont try that in live production.
      Mar 23
  • Yelp datamango
    Here is a small list that I think could help:
    1. Take a bunch of files and try uploading them to S3 in bulk in parallel. Profile, optimize and repeat. Bonus if you learn about Zero copy
    2. Write a hashmap from scratch and simulate simultaneous reads and writes. Profile, optimize, repeat. Think of sharding it internally, think of map resizing etc.
    3. Write a web server from scratch that supports simple get operations. Try to use what you built in step 1 to overwhelm it. Now use thread pools etc to figure out how to speed it up.

    Try to use as much raw java features as possible. Good luck.
    Mar 23 1
    • Yelp datamango
      I totally forgot: read about and solve the dining philosophers problem. Perhaps start with that first
      Mar 23
    • Adobe
      fros

      Adobe

      PRE
      Intuit, Autodesk
      BIO
      Keep a left Sucker
      frosmore
      Do you have a Python equivalent?
      Mar 23
    • Adobe xbid57
      Sorry, no...experience with python is limited to a few textbook ML/DS projects
      Mar 23
    • Tutanota randodata
      Anybody have opinions on this? I’m tempted to do this.
      Mar 23
    • Yelp / Eng sJJv80
      Python’s threading interface is practically stolen from Java. You shouldn’t have many issues translating.
      Mar 23
  • New / Eng
    errfileno

    New Eng

    PRE
    Microsoft
    BIO
    Senior Software Engineer. 15yoe. Seattle. $205k TC
    errfilenomore
    There is a game on Steam called "Human Resource Machine", that effectively teaches you how to write Assembly (in a fun way). The sequel "Seven Billion Humans" is all about concurrency and is an excellent way to start thinking about the problems you encounter in concurrent execution situations.
    Mar 23 0
  • Uber thoi qua
    Just say “I haven’t done much multi-threaded programming”, and they should ask you something else.
    Mar 23 2
    • Amazon amazoning
      😂😂I’m going to senior software engineer interview at Netflix next week. Can I tell them I haven’t done much coding so ask me something else?
      Mar 23
    • New / Eng
      runfast

      New Eng

      BIO
      6 years - full stack web development.
      runfastmore
      OP
      I think some teams are ok with it. Let us know how it goes. Also, tell us how was the phone interview ??
      Mar 23

Salary
Comparison

    Real time salary information from verified employees