Questions tagged [concurrency]

For challenges involving concurrency, which is when different threads of execution interact with each other.

Filter by
Sorted by
Tagged with
13 votes
9 answers
584 views

AoCG2021 Day 16: Interpret Duet

Related to AoC2017 Day 18, Part 2. (Anyone want to add Duet to esolangs?) Duet is an assembly-like language that involves two processes running the same program simultaneously. Each process of Duet ...
user avatar
  • 64.7k
3 votes
4 answers
490 views

Intercommunication between threads [closed]

So glad I found this cool site. Wanted to try sharing a coding challenge a friend gave me, an interview question. Usually it is written in java, but you can use whatever language you want, just have ...
user avatar
  • 55
5 votes
0 answers
159 views

Save humanity from annihilation [closed]

Aliens have arrived, and they aren't friendly. Turns out, they've been in the process of converting all matter in the universe into compute capability so they can have more fun in their VR ...
user avatar
42 votes
25 answers
4k views

Impatiently wait for input

Your task today is to implement a time limit for getting input, a task I've found rather annoying to achieve in most languages. You will create a program function which prompts the user for input. ...
user avatar
  • 8,943
10 votes
4 answers
418 views

Expose nondeterminism resulting from the OS thread scheduler

As we all know, modern operating systems have thread schedulers that can pick different orders to schedule your threads based on internal logic which your code is not privy to. Normally you architect ...
user avatar
78 votes
37 answers
12k views

Wait a minute – in less than ten seconds

Task Using any type of parallelisation, wait multiple periods, for a total sleep time of at least a minute (but less than a minute and a half). The program/function must terminate within 10 seconds ...
user avatar
  • 28k
7 votes
3 answers
398 views

Computationally Calculate Core Count

Almost all operating systems allow you to run multiple programs at the same time. If your system does not have enough processors to run all the programs you want to run, it starts to give each program ...
user avatar
  • 9,960
18 votes
2 answers
607 views

Finding the Deadlock

Finding the Deadlock When programming a multithreading application one must take good care to avoid deadlocking the various threads when accessing shared resources. A deadlock occurs when a thread ...
user avatar
  • 1,461
7 votes
2 answers
326 views

Create a sophisticated livelock

The point of the puzzle is to learn about livelocks: Create a multi-threaded (or a multi-process) program, whose threads (processes) indefinitely try to wait for each other and never finish. Unlike a ...
user avatar
  • 4,342
11 votes
18 answers
3k views

Shortest Code that creates a Deadlock

Write the shortest code to create a deadlock. Code execution must halt, so this doesn't work: ...
user avatar
  • 20.9k
85 votes
39 answers
11k views

Implement Sleep Sort

Sleep Sort is an integer sorting algorithm I found on the Internet. It opens an output stream, and for each input numbers in parallel, delay for the number seconds and output that number. Because of ...
user avatar
  • 5,871