Maximising use of the CPU
Imagine a 2 dimensional diagram where each Y is a separate thread and X is time. You want work to fill the 2 dimensional diagram. Unfortunately most people's for loops look like a sequential row on a table, rather than a column. You want rows and columns to be filled. can we write an algorithm that fills the rows and columns with work and coordinates communication automatically?
I think multithreaded programs can be created by scheduling in advance what needs to go on when and where, the problem is communication - to continue processing on the next step of the algorithm. If you have a 2 dimensional grid, you can place work on one thread at a time. If you need to synchronize, you slow down.
Take the A* algorithm. It can be parallelised. So you have X worker threads take a neighbour and explore it. It doesn't need to be single threaded.
Think of a server that handles 10,000 connections. You want X threads epolling over 100s of connections at all times. You want to fill that 2d diagram with work and not prevent any other connection from progressing. The worst case is that 10,000 connections all have work simultaneously. You could have 1000 thread running that each epoll connections, then write an event to a multiconsumer multiproducer ringbuffer to read/send data to those connections. You could have 1000 threads each waiting for events on their own ringbuffers for handling "read/write/broadcast" events.