233 karma · joined March 14, 2016
I would be happy to spend time mentoring URM, etc. But it'd work a lot better if others managed such a program, thought about how to attract them, etc. Specialization is good.
https://chatgpt.com/share/67759723-f008-800e-b0f3-9c81e656d6...
One might argue that it's impossible to compress air using known engineering, but that would be a different kind of answer.
// Examples of dereference operator.
int i, *ip = ..., **ipp = ...;
i = *ip; // Assuming ip has been correctly initialized.
i = **ipp; // Likewise.
// The address-of operator is the opposite.
ip = &i;
ipp = &&i;
I actually talk through the last line. Almost no one ever questions it. I then ask students to look at that last line again, and ask them if an address has an address, and if so, what does that mean, could it ever be useful?FWIW, without -O, with -O, and with -O4, I get 2500ms, 1500ms, and 550ms respectively. I didn't bother to look at the .S to see the code improvements. (Of course, I edited the code to output the results, otherwise, it just optimized out everything.)
I am not sure how to handle the continuous case, however.
Opening a bottle: https://www.youtube.com/watch?v=CPLrGfAbhnw
Also, I couldn't find a video, but at least in my Asian family, we will sometimes cut food like, say, an eggroll by using the chopsticks as a scissors.
Lastly, a chopsticks hack is that they are great way to eat food like buttered popcorn without getting your fingers greasy. :-)
We do require architecture, and still even do Karnaugh maps. I do believe that every CS person should have a fundamental understanding of cache, instruction fetch, decode, MESI, etc., but probably don't need a semester's worth of architecture. If I had my druthers, I would consolidate a number of separate courses into maybe a 2-semester sequence that would basically be: "What every computer scientist should know", and basically cover the coolest and most seminal topics from different areas of CS.
But the reality is that you can only cram so much into a 4-year degree and wire-wrapping a 68000 seems like it would take many hours. I already feel like there is so much that we are leaving out. For example, our undergrads don't implement a compiler as part of their degree.
*EDIT: Also, it's arguably more computer engineering than computer science, but the my main point is that the undergrad CS curriculum is already super-crowded.
If you are talking 100 years out, though, who knows?
$ ./a.out 1000000 2000 | cat >/dev/null
buffer size: 1000000, num syscalls: 2000, perf:1578.779593 MiB/s
$ ./a.out 1 2000000 | cat >/dev/null
buffer size: 1, num syscalls: 2000000, perf:0.832587 MiB/s
Code is: #include <cstddef>
#include <random>
#include <chrono>
#include <cassert>
#include <array>
#include <cstdio>
#include <unistd.h>
#include <cstring>
#include <cstdlib>
int main(int argc, char **argv) {
int rv;
assert(argc == 3);
const unsigned int n = std::atoi(argv[1]);
char *buf = new char[n];
std::memset(buf, '1', n);
const unsigned int k = std::atoi(argv[2]);
auto start = std::chrono::high_resolution_clock::now();
for (size_t i = 0; i < k; i++) {
rv = write(1, buf, n);
assert(rv == int(n));
}
auto stop = std::chrono::high_resolution_clock::now();
auto duration = stop - start;
std::chrono::duration<double> secs = duration;
std::fprintf(stderr, "buffer size: %d, num syscalls: %d, perf:%f MiB/s\n", n, k, (double(n)*k)/(1024*1024)/secs.count());
}
EDIT: Also note that a big write to a pipe (bigger than PIPE_BUF) may require multiple syscalls on the read side.EDIT 2: Also, it appears that the kernel is smart enough to not copy anything when it's clear that there is no need. When I don't go through cat, I get rates that are well above memory bandwidth, implying that it's not doing any actual work:
$ ./a.out 1000000 1000 >/dev/null
buffer size: 1000000, num syscalls: 1000, perf: 1827368.373827 MiB/s