h a l f b a k e r yAssume a hemispherical cow.
add, search, annotate, link, view, overview, recent, by name, random
news, help, about, links, report a problem
browse anonymously,
or get an account
and write.
register,
|
|
|
Please log in.
Before you can vote, you need to register.
Please log in or create an account.
|
Parallel while/whilst statement
Wouldn't it be more efficient to download while installing? Or processing calculations while reading files? I'm using the word "while" to mean "whilst" | |
The computer should work out the rate and buffer sizes for each task.
Otherwise you need to write complicated error prone threaded code to handle this stuff and shift between buffers.
it could work by automatically doubling all the buffers and flipping between them quickly as they are emptied and
used up, a bit like TCP window sizes.
parallel whilst {
parallel while {
char buf[1024];
os.read("/bigfile", 1024, buf);
}
parallel while {
lines = split(buf, "\n");
}
parallel while {
do_expensive_calculation(lines);
}
}
Python, Thread-based parallelism
https://docs.python...rary/threading.html [a1, Jul 30 2022]
[link]
|
|
Are you asking for a low level capability or just a new syntax? Threading and multiprocessing are WKTE in Python and other languages, arent they? |
|
|
Threading is hard to get right. The threading should be hidden behind the easiness of the syntax. |
|
|
The problem with threading is data races and synchronization. |
|
|
Essentially with the proposed syntax, one of the two automatically created buffers shall be passed to the next thread in the thread pool, for its parallel processing and onto the next. |
|
|
The buffer shall be reloaded with content and then flipped to the next. |
|
| |