Skip to content

Latest commit

 

History

History
59 lines (48 loc) · 1.88 KB

concurrent-coding-questions.md

File metadata and controls

59 lines (48 loc) · 1.88 KB

Print N Numbers Using Different Even-Odd Threads

The goal is to print the numbers in order, while one thread only prints the even numbers and the other thread only prints the odd numbers.

Thread Safety in Singleton

Design a thread-safe singleton class in Java, ensuring that only a single instance is created even in a multi-threaded environment.

Parallel Matrix Multiplication

Implement a program that performs matrix multiplication using multiple threads to achieve parallel processing and improve performance.

Concurrent data structures

  • Linked list
  • Queue
  • Stack

Bathroom

  • Fairness/starvation free
  • Caste variation
  • Multi bathroom variation
  • Priority

Hit Counter

Rate Limiter

Implement a rate limiter that can control the rate of job execution, ensuring that jobs are not executed more frequently than a specified limit.

Thread-safe LRU Cache

Implement a thread-safe LRU (Least Recently Used) cache with support for concurrent read and write operations, considering efficiency and thread safety.

Web crawler

Deque

  • Exit when disk is full.

Concurrent Task Scheduler

Implement a concurrent task scheduler that can execute multiple tasks concurrently while limiting the maximum number of parallel executions.

  • void return type
  • with some return value
  • task delay support
  • shutdown support
  • cancel support
  • cache support
  • dont accept new tasks if some currently running task fails
  • tasks with dependencies

Thread-Safe Job Queue

Implement a thread-safe job queue in Java that supports adding jobs, removing jobs, and retrieving the next job to execute efficiently.

Priority Job Scheduler

Implement a job scheduler that supports job priorities and allows for dynamically changing the priority of running jobs.

Distributed Lock Manager

Design a distributed lock manager that can coordinate job execution across multiple nodes to prevent concurrent execution of conflicting jobs.