educative.io

Java Multithreading for Senior Engineering Interviews (C. H. Afzal)


Interview Practice Problems - Rate Limiting Using Token Bucket Filter Implementing rate limiting using a naive token bucket filter algorithm. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5657382461898752). Java Memory Model - The happens-before Relationship This lesson continues the in-depth discussion of Java memory model View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5676325415157760). Beyond the Interview - Next Steps Moving from interview mindset to learning mindset. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5701241594183680). Multithreading in Java - Multithreading in Java Part I A brief discussion of Java's basic concurrency constructs such as synchronized, reentrant locks, interrupted exception, etc. that are required to solve multithreading problems asked in interviews. Multithreading in Java - Multithreading in Java Part II This chapter continues the discussion on common java multithreading constructs and patterns including interrupted exception, volatile keyword, reentrant lock and condition variable. Interview Practice Problems - Implementing Semaphore Learn how to design and implement a simple semaphore class in Java. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5693417237512192). Multithreading in Java - Multithreading in Java Part III This chapter continues the discussion on common java multithreading constructs and patterns including semaphores, addressing missed signals, lock fairness, thread-pools and spurious wake-ups. Interview Practice Problems - Epilogue Closing remarks on the interview process. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5643440998055936). Interview Practice Problems - ReadWrite Lock We discuss a common interview question involving synchronization of multiple reader threads and a single writer thread. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5766466041282560). Multithreading in Java - Suprious Wakeups Have questions about Suprious Wakeups? Go for it! View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5751399832879104). Multithreading in Java - Missed Signals Have questions about Missed Signals? Go for it! View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5641826627223552). Revision & Quizzes - Quiz 1 Have questions about Quiz 1? Go for it! View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5671831268753408). Revision & Quizzes - Quiz 3 Questions on how threads can be created View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5199294671880192). The Basics - Semaphore vs Monitor This lesson discusses the differences between a monitor and a semaphore. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5700735861784576). Revision & Quizzes - Quiz 8 Questions on working with ThreadLocal variables View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5677090456207360). Java Thread Basics - ThreadLocal This lesson discusses thread local storage View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5757183006343168). Revision & Quizzes - Quiz 5 Exercise on how to make classes thread-safe View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5629805013762048). Java Thread Basics - Concurrent Collections This lesson gives a brief introduction about Java's concurrent collection classes. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5790215757103104). Multithreading in Java - Interrupting Threads Have questions about Interrupting Threads? Go for it! View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5722383033827328). The Basics - Program vs Process vs Thread This lesson discusses the differences between a program, process and a thread. Also included is an example of a thread-unsafe program. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5741031244955648). Java Thread Basics - An Example: Timer vs ScheduledThreadPool Contrasting Timer and ScheduledThreadPool View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/6009377580384256). Revision & Quizzes - Quiz 4 Question on use of synchronized View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5708007778287616). Java Memory Model - Reordering Effects This lesson discusses the compiler, runtime or hardware optimizations that can cause reordering of program instructions View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5715426797420544). Revision & Quizzes - Quiz 7 Threaded design and thread-safety questions. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5685570869133312). Interview Practice Problems - Superman Problem Correctly implementing a singleton pattern in Java View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5707274949492736). The Basics - Java's Monitor & Hoare vs Mesa Monitors Continues the discussion of the differences between a mutex and a monitor and also looks at Java's implementation of the monitor. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5661458385862656). Multithreading in Java - Thready Safety & Synchronized This lesson explains thread-safety and the use of the synchronized keyword. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5741830645743616). Revision & Quizzes - Quiz 2 Questions on thread-safety and race conditions View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5695586732867584). The Basics - Mutex vs Monitor Learn what a monitor is and how it is different than a mutex. Monitors are advanced concurrency constructs and specific to languages frameworks. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5676830073815040). Multithreading in Java - Volatile Have questions about Volatile? Go for it! View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5683127032741888). Java Memory Model - Java Memory Model This lesson lays out the ground work for understanding the Java Memory Model. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5725202142986240). Multithreading in Java - Reentrant Locks & Condition Variables Have questions about Reentrant Locks & Condition Variables? Go for it! View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5761329797267456). Multithreading in Java - Miscellaneous Topics Have questions about Miscellaneous Topics? Go for it! View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5675052494225408). Interview Practice Problems - Implementing a Barrier This lesson discusses how a barrier can be implemented in Java. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5738600293466112). Interview Practice Problems - Unisex Bathroom Problem A synchronization practice problem requiring us to synchronize the usage of a single bathroom by both the genders. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5673385510043648). Interview Practice Problems - Dining Philosophers This chapter discusses the famous Dijkstra's Dining Philosopher's problem. Two different solutions are explained at length. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5718998062727168). Java Thread Basics - Setting-up Threads This lesson discusses how threads can be created in Java. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5757907245203456). The Basics - Critical Sections & Race Conditions This section exhibits how incorrect synchronization in a critical section can lead to race conditions and buggy code. The concepts of critical section and race condition are explained in depth. Also included is an executable example of a race condition. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5639274879778816). Java Thread Basics - Executor Framework This lesson discusses thread management using executors. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5749781167079424). Java Thread Basics - Executor Implementations Have questions about Executor Implementations? Go for it! View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5700019675987968). Java Thread Basics - Callable Interface This lesson discusses the Callable interface. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5767281011326976). Java Thread Basics - CompletionService Interface This lesson talks about how to batch multiple tasks together View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5644309118320640). Revision & Quizzes - Quiz 6 Questions regarding memory visibility in multithreaded scenarios View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5668906396024832). Java Thread Basics - CyclicBarrier Have questions about CyclicBarrier? Go for it! View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5427204399824896). Java Thread Basics - CountDownLatch Have questions about CountDownLatch? Go for it! View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5465480410169344). The Basics - Amdahl's Law Blindly adding threads to speed up program execution may not always be a good idea. Find out what Amdahl's Law says about parallelizing a program View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5647308616105984). The Basics - Cooperative Multitasking vs Preemptive Multitasking This lesson details the differences between the two common models of multitasking. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5927596409749504). The Basics - Introduction This lesson details the reasons why threads exist and what benefit do they provide. We also discuss the problems that come with threads. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5668600916475904). Java Thread Basics - Basic Thread Handling This lesson shows various thread handling methods with examples. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5716606839685120). The Basics - Concurrency vs Parallelism This lesson clarifies the common misunderstandings and confusions around concurrency and parallelism. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5456847240691712). Interview Practice Problems - Uber Ride Problem This lesson solves the constraints of an imaginary Uber ride problem where Republicans and Democrats can't be seated as a minority in a four passenger car. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5653164804014080). Interview Practice Problems - Multithreaded Merge Sort Merge sort using threads. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5689127638925312). The Basics - Synchronous vs Asynchronous This lesson discusses the differences between asynchronous and synchronous programming which are often talked about in the context of concurrency. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5342081688010752). The Basics - I/O Bound vs CPU Bound We delve into the characteristics of programs with different resource-use profiles and how that can affect program design choices. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5915582497030144). The Basics - Throughput vs Latency This lessons discusses throughput and latency in the context of concurrent systems. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5992431407333376). Multithreading in Java - Semaphore in Java Have questions about Semaphore in Java? Go for it! View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5714772351778816). Multithreading in Java - Wait & Notify Have questions about Wait & Notify? Go for it! View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5649952705347584). Java Thread Basics - Thread Pools This lesson introduces thread pools and their utility in concurrent programming. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5739121058250752). Java Thread Basics - Types of Thread Pools This lesson details the different types of thread pools available in the Java class library. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5719570367119360). Java Thread Basics - Future Interface This lesson discusses the Future interface. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5636026810761216). Interview Practice Problems - ... continued This lesson continues the discussion on implementing the Singleton pattern in Java. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/4942797872300032). Interview Practice Problems - Barber Shop This lesson visits the synchronization issues when programmatically modeling a hypotheetical barber shop and how they are can be solved using Java's concurrency primitives. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5689792285114368). The Basics - Mutex vs Semaphore The concept of and the difference between a mutex and a semaphore will draw befuddled expressions on most developers' faces. We discuss the differences between the two most fundamental concurrency constructs offered by almost all language frameworks. Difference between a mutex and a semaphore makes a pet interview question for senior engineering positions! View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5685265389584384). Interview Practice Problems - Asynchronous to Synchronous Problem A real-life interview question asking to convert asynchronous execution to synchronous execution. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/4588187609464832). The Basics - Deadlocks, Liveness & Reentrant Locks We discuss important concurrency concepts deadlock, liveness, live-lock, starvation and reentrant locks in depth. Also included are executable code examples for illustrating these concepts. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5757334940811264). Interview Practice Problems - Thread Safe Deferred Callback Asynchronous programming involves being able to execute functions at a future occurrence of some event. Designing a thread-safe deferred callback class becomes a challenging interview question. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5733935958982656). Interview Practice Problems - Blocking Queue | Bounded Buffer | Consumer Producer Classical synchronization problem involving a limited size buffer which can have items added to it or removed from it by different producer and consumer threads. This problem is known by different names: consumer producer problem, bounded buffer problem or blocking queue problem. View the lesson [here](https://www.educative.io/collection/page/5307417243942912/5707702298738688/5750085036015616).
About the Java Multithreading for Senior Engineering Interviews (C. H. Afzal) category [Java Multithreading for Senior Engineering Interviews (C. H. Afzal)] (1)
Is multithreaded always faster than single threaded? [The Basics - Introduction] (2)
How to make thread safe? [Multithreading in Java - Thready Safety & Synchronized] (1)
Are cells inside array volatile? [Interview Practice Problems - Asynchronous to Synchronous Problem] (1)
Why can't we simply move synchronization logic to main method? [Interview Practice Problems - Asynchronous to Synchronous Problem] (1)
Could you please evaluate my solution? [Interview Practice Problems - Unisex Bathroom Problem] (1)
Why not to notifyAll? [Interview Practice Problems - Blocking Queue | Bounded Buffer | Consumer Producer] (1)
Why get a non-zero value on Thread Unsafe Class? [The Basics - Program vs Process vs Thread] (3)