5 ms·
Thinking out loud. Instead of imagining applications per processor, I imagine this device could map threads or message handlers to processors. It could work be
by JoeAltmaier 10y ago
Thinking out loud.
Instead of imagining applications per processor, I imagine this device could map threads or message handlers to processors. It could work better with a functional language or at least some language that didn't explicitly manage parallelism in code but rather in the runtime. Offload the app writer to just coding algorithm and not thread synchronization.
E.g. imagine each timer wait being a processor spinning; each I/o loop being a processor that blocked/looped on an I/o pin state. With so many processors to schedule, it wouldn't stall application progress to spin or block an individual strand (until you ran out or processors). To make this efficient, they'd want interrupts and semaphore state to be hardware-supported. Instead of polling a memory location, block on a shared register masked where each bit was a condition. So instead of a 'kernel call' it'd be an opcode or small loop. Latency of wakeup then becomes about 1 machine cycle.
I imagine with the right runtime support this could be a useful device for a large I/o server. It could reduce latency of processing each client message to just the execution time. No time burned in kernel calls, process switching, stack copying, interrupt/event latency.
- endergen 10y agoI'm an ex game engine developer and I bristle anytime anyone thinks any existing functional language is better for multicore. Specifically garbage collection alone will make any language an order of magnitude slower generally per a single core. Also the C/C++ game development community at least has great approaches to multicore which makes C/C++ linearly scale with scores to boot, see for example: http://www.gdcvault.com/play/1022186/Parallelizing-the-Naughty-Dog-Engine http://www.gdcvault.com/play/1022186/Parallelizing-the-Naugh.... I love functional languages, more for thinking in them, prototyping ideas, especially compilers/visualizers, and etc. But for any language that adds garbage collection, immutable data structures (way more operations per write and crazy memory thrashing/alignment issues), unless used sparsely or in a mixed paradigm (ugh, except maybe scala/clojure) are going to pay a magnitude of performance loss. Mind you there are tricks around using more system languages (C/C++/Rust/D etc) for a lot of the heavy lifting with the application core being functional that gets you closer to the best of both worlds.
- geon 10y ago> I bristle anytime anyone thinks any existing functional language is better The parent comment doesn't say that, though. I imagine current functional languages are about as ill suited as current imperative languages for running on a 1000 core machine. Something new might be needed.
- tremon 10y agoI think that the concept of purity, present mostly in functional languages, helps a lot for writing parallellizable (?) code. My naive assumption would be that pure code could be adapted for a 1000-core machine with only changes to the compiler and runtime environment. That said, few things in CS are written with this kind of parallellism in mind: even most algorithms' pseudocode is written in imperative style, and assumes the ratio of data to execution cores is on the same order as the data size itself. We definitely need something new. Both on the algorithmic front and on the architectural front. I suspect that on this scale, you could easily need more than 10% of the computing power simply to feed the right data to the correct cores. A programmable memory management unit might be helpful.
- geon 10y ago> My naive assumption would be that pure code could be adapted for a 1000-core machine with only changes to the compiler and runtime environment. Perhaps for use cases where current, garbage collected languages are suitable. For areas where (today) asm/c/c++/rust is a must, you would need a functional language that can give you guarantees about garbage generation, so you can be sure you won't need to collect garbage, at least in specific areas of the code. Perhaps a stream-oriented language would be suitable? The runtime could spin up more cores as needed depending on back-pressure.
- marcosdumay 10y ago> For areas where (today) asm/c/c++/rust is a must, you would need a functional language that can give you guarantees about garbage generation That's the entire point of the "purity" idea. Pure FP languages give you very strict guarantees about garbage generation. The only question is if everyday code has enough pure code to fill a 1000 cores processor.
- geon 10y ago> So instead of a 'kernel call' it'd be an opcode or small loop. Like a Wait For Interrupt instruction? If all idle processors sleep, I imagine it could save some power as well.
- JoeAltmaier 10y agoYes! And an interrupt is any bit in a large (128bit?) register. Some bits are real hardware interrupts, some are local semaphores, some are global semaphores, and maybe one is a 'my timer register matches the system time counter'. Existing OSs use a kernel call to wait, because they want to manage the (tiny number of) hyperthread(s) closely. But with essentially unlimited hyperthreads, they can manage themselves! And avoid the whole kernel-round-trip latency.