Live data from Hacker News

Did anybody solve this?

1.61803398874.com

21–26 of 26 posts

Re: Did anybody solve this?

#21
Does anyone here have any idea what they mean about naive C and python solutions? Normally I take 'naive' to mean 'bad but not wrong', but their question seems to imply that one or the other of the 'naive' solutions they have in mind is wrong, and I'm not sure what obvious way there is to write it wrongly in one of the languages and produce different results.

Re: Did anybody solve this?

#25
post #5

Also, did anyone solve their "canine challenge"? It seems to me that what they're asking for is "tee FILE... > /dev/null", but maybe I'm missing something?

I submitted the tee solution as a joke and I got a smiley in response. I was pretty pleased with myself.

Re: Did anybody solve this?

#26
post #16
post #15

Earlier quoted context omitted.

I did read the problem statement, but I thought tee was writing to all files in parallel. It's surprising that there seems to be no way to achieve that.

Tee writes in one-thread-per-file level of parallelism; simple experiment: $ tee foo.bin bar.bin baz.bin writes to all three files `at once' (in small time-slices, actually). Used GNU tee from coreutils-8.10. Perhaps OP meant several-threads-per-file level of parallelism, where number_threads > number_files?

tee has a simple main loop:

  while not EOF: 
    (synchrounously) read up to BUFSIZE bytes from stdin into buf 
    for each output file: 
      (synchrounously) write buf to file
(source code here: http://git.savannah.gnu.org/cgit/coreutils.git/tree/src/tee....)

All of the reads and writes are done through synchronous file apis. I don't see where you are getting one-thread-per-file (or any other kind of parallelism) there.

Post reply on HN