Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: callicoder/java-concurrency-examples
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: Vigneshh25/java-concurrency-examples
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 3 commits
  • 3 files changed
  • 1 contributor

Commits on Apr 29, 2024

  1. Configuration menu
    Copy the full SHA
    7214019 View commit details
    Browse the repository at this point in the history
  2. Create PrintSequenceRunnable.java

    A simple code needs to be written, I want output printed as 1,2,3,4....100. We have to use exactly 3 threads, one for odd number printing, one for even and a comma printing thread. How to achieve this?.
    Vigneshh25 authored Apr 29, 2024
    Configuration menu
    Copy the full SHA
    afcbafe View commit details
    Browse the repository at this point in the history
  3. Create ProducerConsumerExample.java

    Write a Java program that simulates a producer-consumer scenario using two threads: one for producing items and another for consuming them.
    
    The producer thread (Producer) should generate random integers (between 1 and 100) and add them to a shared bounded buffer (Queue or List). If the buffer is full, the producer should wait until there is space available.
    
    The consumer thread (Consumer) should continuously retrieve items from the buffer and print them. If the buffer is empty, the consumer should wait until there are items available.
    
    Use synchronization techniques like wait() and notify() or Lock and Condition to coordinate the behavior of the producer and consumer threads.
    
    Your task is to implement the Producer and Consumer classes according to the described specifications, ensuring proper synchronization and handling of the shared buffer.
    Vigneshh25 authored Apr 29, 2024
    Configuration menu
    Copy the full SHA
    b61d78b View commit details
    Browse the repository at this point in the history
Loading