HNHacker News
TopNewBestAskShowJobs

gens

503 karma · joined April 2, 2016

submissionscomments
gens··on My Kid Will Never Hack Linux
Rust has hype because it is mozilla, servo, and mozilla blog posts about it.

But that is not the point i was making. There are a lot of languages that "have safety". Ada is a prime example as it "has" more "safety" and is really old. And yet nobody talked about Ada before rust came with "safety".

With static analyzers and valgrind even C has enough of memory "safety". (note that Ada has more "safety" then just memory access)

gens··on My Kid Will Never Hack Linux
I feel that without the unreasonable hype behind rust nobody would even mention safety.
gens··on My Kid Will Never Hack Linux
You can help them understand by writing and submitting documentation. Let's be honest, the linux kernel documentation mostly sucks and (more commonly) doesn't exist.

PS Don't underestimate children. Some will learn C.

gens··on Nvidia Is Building Its Own TensorFlow Processor Unit
Yea.. it's not a "deep learning processing unit", but a "tensorflow processing unit". And it certainly is not just a normal modern graphics card (GPGPU) that can do other-then-32bit-float computations without dying (as AMD's could do for a while now).

* Written using a FFPU (firefox processing unit).

gens··on Don't tell people to turn off Windows Update
Wow i feel stupid. Didn't even think to try the standard things.

Thx.

Time to msconfig this laptop to "usable" state.

edit:

Parent comment flagged ? Are we on "Anti-hacker Non-news" ?

Anyway; Start-> type "services" (or "msiconfig" for more options, basically the same as winXP) and you can turn off "windows Update" there. Don't forget to turn it on every once in a while, especially if you use public networks.

update: There's also a thing called "Background Intelligent Something", that is the thing doing the actual downloads. Seems it continued downloading even without the update service running. Said service looks mildly important, but still it had to die.

gens··on Don't tell people to turn off Windows Update
I wish I could disable updates. Dumb ass win10 thinks it's ok to download 2 GIGABYTES of data. How is it reasonable to have gigabytes of updates ? For security ? I have gigabytes of binaries here ? And then 15 days later, 1.5GB of updates. (note: my win10 laptop is usually used with mobile internet)

Win10 is a shame.

They could have at least separated security updates from random crap updates. A button would be nice as well.

If anyone knows how to disable updates on non-professional win10, please let me know.

edit: I do know about security and the importance of updates. You few downvoting me can go shove it up your arse. It's crap behavior from win10, period.

gens··on Computer Games That Teach Assembly Language
it's really a simple language

i can help you start (amd64), if you want. TIS-100 is a decent start as well

gens··on CPU Utilization is Wrong
>A) it can run another hyperthread with those cycles, and,

I don't see hyperthreading useful. Neither do the benchmarks, that usually put hypterthreading off ahead of hypterthreading on.

Reasoning is simple. When a cache miss happens the (intel) cpu runs another thread. The question is does that happen often enough to justify the overhead of that "hyper"threading. Remember that hyperthreading does not magically make a new cpu core, so there has to be overhead (and the benchmarks prove so). Even if there is no overhead, there is still the other thread filling the L1 (and L2) cache (programs that don't often read from nor write to memory are very rare). Apparently Agner Fog wrote a post about it [0].

Even without taking into account what i wrote above, hypterthreading would not be a big enough of influence on the sampling (i can draw a hypothetical timeline, if you don't get it).

>B) even without hyperthreads, it misleads the developers as to where to tune.

No, no it doesn't. How would it ? It shows you exactly what instruction is taking up time. If it is a MOV then your data is not in cache, if it is a divss then.. well you have a division in your code, if it is about evenly spread in a pattern then you should look if your code is serial (not that there is usually much help for that), if it is a branch then.. etc. How the F is that less helpful then a blanket "your code is not executing many instructions per tick" statement ? Instructions per tick only tells you if another process is f-ing with yours (probably by hogging memory bandwidth).

>C) also, "busy waiting" sounds like an oxymoron. DRAM is busy. The CPU is waiting. Yes, the OS doesn't differentiate and calls it %CPU.

Normally it is, but we are not writing poems here. Remember how old cpu's had a busy loop, that ran when idling ? AFAIK even today's cpus have it.

>It provides a clue as to whether %CPU is instruction bound or stall bound.

If i read a byte from a random place in a gigabyte array then do some shifts on it and store it back, it will still show a (relatively) high number of instructions but the bottleneck will be memory. On the other side if i load a float from a small array then do some math on it (notably division), it will result in a low number of instructions per tick but the memory will not be the bottleneck.

So all in all, instructions per tick doesn't tell you much. Maybe if the program suddenly starts to go slow, to more easily check what other program is hogging the memory access. Or a general rule of thumb that makes you think "this code should execute instructions much faster, hmm".

As for finding bottlenecks and dealing with them:

If your MOV instruction is a bottleneck, you are either dealing with a huge amount of data that can't be accessed in a predictable manner or you didn't think to make your code/data structures friendly to cache[1] or your code is really complicated or just shit (as 90% of code is).

Perf also shows you cache misses...

Another great thing about perf (actually about objdump) is that it can interweave code and assembly when showing you where your code is slow. So you don't even have to learn assembly.

[0] http://www.agner.org/optimize/blog/read.php?i=6

[1] I have a huge 2D array representing a grid. The grid will be sampled 1-5 points up, down, left, and right. The up and down sampling will, more often then not, result in cache misses (for obvious reasons). Solution ? Cut the grid into squares.

PS Hyperthreading sucks. I always turn it off.

edit: PPS No benchmarks, hypotheticals, deeper research into the causes ?

gens··on CPU Utilization is Wrong
The core waiting for data to be loaded from RAM is busy. Busy waiting for data.

Instructions per cycle can also be misleading. Modern cpu's can do multiple shifts per cycle, but something like division takes a long time.

It all doesn't matter anyway, as instructions per cycle does not tell you anything specific. Use the cpu-builtin performance counters, use perf. It basically works by sampling every once in a while. It (perf, or any other tool that uses performance counters) shows you exactly what instructions are taking up your processes time. (hint: it's usually the ones that read data from memory; so be nice to your caches)

It's not rocket surgery.

gens··on Lumina Desktop
In X11, there is a big difference between a "window manager" and a "desktop environment".
gens··on Spatial Audio in VR
> Also they have to be able to support simulating the head transfer function via speaker ..

Do you mean head related transfer function ? As in https://en.wikipedia.org/wiki/Head-related_transfer_function ? HRTF would be practically impossible to do with speakers in a room.

gens··on Spatial Audio in VR
> I don't think OpenAL simulates some of the more complex phenomena having to do with how sound interacts with your body and ears?

It does. This blog post [0] seems to be a nice reference. What you want is called "head-related transfer function". (There are tons of papers on HRTF)

One can even turn it on for any game that use openal, even old ones. You can go download The Dark Mod now and play it with HRTF [1].

Note: am not an expert

What openal doesn't do, while this google thing does, is reverb (reflection of waves, echo). One way to do reverb is.. well simply raytrace it. Just send out a bunch of rays from the source, probably do some filtering of the results, and apply to the audio. Another way is to take a real room that you are "porting" to digital, ping somewhere in it (play the impulse response of an ideal 20kHz low pass filter, aka the sync function), then measure somewhere else. Then repeat in a.. grid or something. What you get is a bunch of filters (num_points if there is a single static "listener", or num_points^2 if there are more and or moving; as it is source->destination dependent). This can also be done by shooting rays in an arbitrary digital space, but i wanted people to imagine a room and waves going around in it. AFAIK this is how the valve bought software works.

Another thing is diffraction[2]... that idk if either gugl or volvo do. Calculate it with voxel grids then add to refraction ? Any renderers do proper Rayleigh scattering ?

[0]http://www.bitoutsidethebox.com/shabda/hrtf-info/ [1]https://www.youtube.com/watch?v=MVqFbu4gsqs [2]http://hyperphysics.phy-astr.gsu.edu/hbase/Sound/diffrac.htm...

gens··on The Turds Who Voted to Sell Out Your Online Privacy Get Their Faces Plastered
And here i thought that being "mature" is about taking responsibility for your actions, thinking about others instead of only yourself, looking at the bigger picture and maybe even making sacrifices for it, even being the "bigger man" when the situation calls for it. But no, being "mature" is about being politically correct. Fuck that, i'l stay a child kthnxbye.
gens··on Ryzen is for Programmers
I have an fx 8320. 8 cores and much cheaper then ryzen or intel.

4 cores is enough for (almost) any kind of multi-core dillydallying, so any "old" 4 core cpu is fine. (sidenote: firefox has "dillydallying" in its dictionary:)

It's probably the ryzen hype that got this post so high. I like AMD as well, but really.

gens··on x64asm: C++ Library with in-memory assembler, parser, and linker
Seems to be a slightly over-designed (amd64) assembler in the form of a library, plus some (in-library) tools that are slightly cool but nobody will use.
gens··on CoreFreq – CPU monitoring for 64-bit processors
There are generic tools for these stuff on linux like perf, powertop, slabtop, lm-sensors, and probably more that idk about.

This PCM looks like it provides information that the tools above can't, like pcm and memory bandwidths (unless i misunderstood what it does). Sucks that it's intel only, i'd like to watch memory bandwidth usage on my amd. Unrelated: this reminds me of mcelog, that collects hardware errors.

gens··on CoreFreq – CPU monitoring for 64-bit processors
Yes, i read it.

Most of the things listed there can be gotten from userspace (through cpu instructions/registers, procfs, sysfs).

Do you know which one of those things can not be gotten in userspace ? Turbo boost state ? Topology ?

gens··on Visualizing Concurrency in Go (2016)
Tony Hoare’s paper is one of the most amazing papers i read (not that i understood all of it).

You can get it at http://www.usingcsp.com/

gens··on CoreFreq – CPU monitoring for 64-bit processors
Maybe for the real-time cache usage display ? Or performance (in the sense of less noise while measuring) ?

I'm tempted to try it out and see for myself, though.

For posterity; Cpu counters for a lot of things can be gotten from userspace. The linux kernel exposes a lot of things in /proc (procfs) and /sys (sysfs). Programs like perf, slabtop (and probably others, that i can't remember now), use these informations to display more-or-less the same data as this program.

gens··on The Boring Company [video]
I'd like to see them try to do that beneath my city.

PS I am ashamed of the current top comment (despite not having anything to do with it).

gens··on CoreFreq – CPU monitoring for 64-bit processors
Why does it need a kernel module ?
gens··on The Safe C Library (2009)
In this whole thread, among all these talks about memory safety, zero mentions of valgrind.
gens··on Fedora dev: “HN feedback on what they want from their Desktop – We got it”
Gnome3 devs never asked for feedback. Gnome3 devs never cared.

But they sure do like to write blog posts about hip stuff.

gens··on An alternative to solid tantalum capacitors
"Solid" in electronics means the former (state), not the latter.
gens··on A Wall Street Informant Who Double-Crossed the FBI
> They bought Gentile a bacon cheeseburger and a Diet Coke ..

I don't even.. Is this normal in the USofA or are they just denying him sugar, while feeding him, to pacify him ?

edit: but the cheeseburger already has plenty of sugar and the coke has caffeine. idk

gens··on How much your computer can do in a second
-M intel
gens··on Performance bugs – the dark matter of programming bugs
Funny thing is that one of the bigger problems with optimizing compilers is register allocation. Not only is it difficult to write a good algorithm for it, but compilers don't always know what variable is most important to keep in a register. Gcc even implemented a weaker allocator [0] as the older one was too complex to decipher problems with it.

Instruction scheduling is not a problem on modern cpu's. Not that it's hard either way, just reorder things around memory access and heavy instructions like division. Agner Fog made a nice table of instruction latencies and throughputs [1].

Instruction encoding length... do you use 16bit integers or do you just int everything ? The compiler has to do what you tell it to do. Sure there are plenty of tricks around that but those are not the ones that give the compiler a remarkable advantage over humans. Tricks like using bitwise operations instead of multiplication and such and shortening equations is the advantage that the compiler has. But even that is not that big of a deal. (again, do you use the restrict keyword ? or static/define for constants ? do you know that C treats every "compile unit"(.c file) as a separate program ?)

[0] https://gcc.gnu.org/wiki/cauldron2012?action=AttachFile&do=g...

[1] http://www.agner.org/optimize/

gens··on Performance bugs – the dark matter of programming bugs
> It's pretty well agreed at this point that a good C compiler will generate faster code than someone writing assembly.

We must be discussing with different people then. Have you ever looked at what a compiler spits out ? My rule is that a compiler is as good as a half-decent assembly coder. I won't even go into the limitations of compilers.

> It's of course possible to write code that's at least as fast in assembly, but in practice, nobody would do it, because the program would be unmaintainable.

You don't write the whole program in assembly. But you can write it with it still being maintainable if you use just a little constraint and forward planing. See the Fresh IDE and libraries that go with it [0].

If you want to write performant C, you should focus on writing simple code. Being smart, especially with needless abstractions, will more often then not result in slower programs. The "hello i am a compiler" crap was never true and won't be in the near future.

[0] https://fresh.flatassembler.net/

gens··on Notes on Programming in C – Rob Pike (1989)
Having looked around, no. LibPNG seems to keep it at a minimum, though.

Guess i'm the only one doing that. (and i have no problems)

gens··on The Cult of DD
The Ignorance Of Err Ignorant People

dd is a tool. dd can do a lot more then cat. dd can count, seek, skip (seek/drop input), and do basic-ish data conversion. dd is standard, even more standard then cat (the GNU breed). I even used it to flip a byte in a binary, a couple of times.

New-ish gnu dd even adds a nice progress display option (standard is sending it sigusr1, since dd is made to be scripted where only the exit code matters).

> Actually, using dd is almost never necessary, and due to its highly nonstandard syntax is usually just an easy way to mess things up.

Personally I never messed it up, nor was confused about it. This sentence also sets the tone of the whole article, a rather subjective tone that is.

edit: Some dd usage examples: http://www.linuxquestions.org/questions/linux-newbie-8/learn...

← PreviousPage 5 of 10Next →