HNHacker News
TopNewBestAskShowJobs

pmjordan

7,982 karma · joined January 21, 2008

British-Austrian software developer, happiest when on a travel adventure.

While looking for the next big thing, I do contract/consulting work; I prefer lower-level stuff, such as device drivers/kernel hacking, real-time graphics and game tech.).

You're welcome to email me about anything, and I promise to reply if you stick to one topic or question and it isn't too open ended. Specifically:

I get a lot of email with technical questions that would require me to download and read the documentation for libraries X, Y and Z to answer - please don't do that; instead, put the code that doesn't work (or pseudo-code that you'd like to turn into real code) in the email, and quote the prototypes for any used APIs, ideally deep-linking to their documentation just in case I do need to look at it.

Obviously, if you're planning to pay me for my help and advice as a consultant you may ignore the above. :-)

website: http://philjordan.eu/

email: phil+hn at philjordan dot eu

fedi/mastodon: @pmdj@mstdn.social https://mstdn.social/@pmdj

github: https://github.com/pmj

submissionscomments
pmjordan··on Show HN: Libconcurrent – Coroutines in C
GCD is purely callback-based. It works neatly with Apple's "blocks" (inline capturing functions) extension to C, which make dealing with callbacks slightly nicer, but it's still just a sequence of callbacks.

Fully fledged coroutines let you save and resume execution in place. The main advantage is readability of conditional/looping control flow, which tends to quickly devolve into a mess in callback style code.

pmjordan··on Nvidia GPUs can break Chrome's incognito mode
Indeed, depending on the drivers used, the VRAM contents can even survive across reboots. I saw this with some drivers on Linux some years ago, not sure if they still don't clear VRAM on boot.
pmjordan··on What is the performance impact of using int64_t on 32-bit systems?
I seem to remember Agner Fog mentioning that the `adc` x86 instruction (add with carry) was considerably slower on many CPUs than `add` (regular addition) because it essentially had 3 dependencies (2 operand registers and carry flag), and had to be decomposed into 2 instructions with 2 inputs each for register renaming purposes. Adding 2 64-bit values on x86 is an `add` followed by a dependent `adc`, so that's considerably worse than 2 regular, independent 32-bit additions.
pmjordan··on 802.11ah Wi-Fi Standard Approved
I can confirm similar local measurements with MacBook Pros and a D-Link DAP-2950 across a room with a wood partition blocking line of sight. If the AP is advertised as 600Mbit/s, chances are it only supports 1 or 2 streams (MIMO antennas) per band. Most laptops only have 2, but even so the signal quality will be much better wih a 3- or 4- way MIMO setup on the AP end. (The D-Link has 6 antennas, so 3-way MIMO for both 5GHz and 2.4.) In addition to number of antennas, orientation also makes a big difference.

Finally, wireless access points seem to be one of those things where quality varies a lot. I hated wifi for its unreliability until I bought a decent (professional/small-to-medium-business grade) AP 8 months ago. Not a single connection problem since, even with the notoriously affected Mac hardware and OSX software versions.

pmjordan··on Boringcc: Proposal for a C compiler for secure software
There is a difference, in the standard, between undefined and implementation-defined (unspecified) behaviour though.
pmjordan··on Telegram probably isn't as secure as ISIS thinks
Considering the source is available - https://github.com/WhisperSystems/ - it should be reasonably straightforward to take the piece of code out that accesses your contact list? (On iOS, and by the sound of it, latest Android OS, you can also just disallow contact access via the system UI.)
pmjordan··on Rocket Fiber Launches 100GB/s Internet Service in Downtown Detroit
"Western" seems like an odd term to distinguish Europe/North America from Africa, but I assume that's what you meant.

I don't have any data to back up or refute such a claim, but it makes sense: Europe & North America have economies of scale for internet infrastructure, including hosting, so hosting there is presumably cheaper than in SA or other African countries. Which drives the domestic demand for hosting abroad, causing that money to not be reinvested in the local infrastructure. I don't know what the solution to that is. Maybe global CDNs building (more) datacentres in Africa will bring some of that money back and have a positive impact on the local ecosystem? (Taking their hosting money abroad is presumably the rational choice for most African companies, so it's difficult to fault them for not "helping themselves")

pmjordan··on Rocket Fiber Launches 100GB/s Internet Service in Downtown Detroit
Doesn't South Africa have a backhaul problem though? Overpriced internet in North America tends to be artificial scarcity at the last mile. I'm not sure that's the case in SA?

I've visited quite a few times and yeah, your internet connections truly are painful to use even when I'm on holiday and not really using the net that much. Much worse than rural areas of Europe which typically only get 1-3Mbit/s ADSL. Some of it is the latency to faraway CDNs and EU/US-centric servers and saturated intercontinental cables, but even South African sites seem to be awfully slow, with high latency, which to me suggests overloading on the core infrastructure. Is that the case? (I know you see microwave comms towers all over the place - if those are being used as the main cross-country internet links then that could be it.)

pmjordan··on f.lux for iOS is no longer available
Isn't their OSX app signed with a Developer ID certificate? If a relevant person at Apple has their feelings sufficiently hurt by f.lux for iOS, they could revoke said certificate.
pmjordan··on Assembly Language: Still Relevant Today
I can't comment on £1500 specifically but there's plenty of (IMO) well-paying demand for low-level dev work out there in the tech industry in general. (Whether you consider the tech industry parasitic is of course another matter entirely…; I've never worked in finance and I do alright.) I don't know about predominantly writing assembly code, but that probably exists, too (SIMD…). Personally, I read a lot more (dis-)assembly than I write.

General advice for deeply technical consulting: you need to have a lot of deep practical experience in a few specific areas and you'll generally need to hit the ground running no matter what project you're dropped into and rapidly start generating corresponding value for the client. And expect to be continuously fighting off offers of permanent employment once you start picking up work.

pmjordan··on The Most Common Job in Each State 1978-2014
As interesting and insightful as this is, I'm very curious about how much the chosen level of categorisation affects the final result. For example, I notice that "registered nurse" and "nursing aide" are considered separate professions. That may well be valid (I assume it's to do with level of training and responsibility? I just picked the example because the jobs sound like they're similar, I'm not picking on nursing in particular.) but if you were to combine them, would they suddenly become the most common job in additional states? And presumably every job could be further subdivided (There are few "secretaries" remaining in part because of technological advances but also because that job has been somewhat rebranded into a bunch of more specific titles.), so where you draw that line might have a big impact on the ranking. Without visualising actual percentages (and/or maybe showing multiple jobs that rank highly), they're really limiting how much this map is telling us.
pmjordan··on Write like you talk
Agreed, it seems a really poor example used to make a fair point. I've never spoken to Neil Oliver personally, but on TV programmes he presents (Coast, etc.) he certainly uses flowery, poetic language. I don't think it's an act, it seems to come naturally to him, and it doesn't even clash with the presenters of other segments using a much more conversational tone.
pmjordan··on The magic kernel
I'll need to try this as an OpenGL (ES) shader in an app I work on regularly. I've been meaning to replace the default bilinear filtering with something a bit nicer-looking for ages, and this seems like it fits the bill nicely, as it avoids the usual ringing and moiré issues. (I don't need to worry about perspective correction as the app is 2D only)
pmjordan··on Fast Algorithms for Exact String Matching
I'm going by the abstract here, but:

You'd build the suffix tree from the haystack, whereas their algorithm preprocesses the needle.

So I guess it mostly depends if you're going to be repeatedly searching different strings in the same document, or if you're searching for the same string in many different documents. Plus, space requirements might be relevant too, as a preprocessed haystack is probably bigger than a preprocessed needle.

pmjordan··on World map of the difference between solar and clock time
Having lived in all 3 countries, I can tell you that Austrians (roughly centred on solar time, and Vienna, 1/4 of the country's population in one city, almost half an hour ahead of solar) are very much early risers compared to Spaniards. (the eastern part of Spain is almost 1 hour behind solar, most of the country even more so) Opening times of shops reflect that; it's not unusual for supermarkets in Spain to open at 9:00, while in Austria 7:30 is probably the most common. The evening meal is generally also consumed much later (clock time) in Spain. The UK is somewhere in between, which again fits with the solar time offset.

Drawing any conclusions beyond that is frought with the peril of confounding factors…

pmjordan··on Losing a credit card due to automatic user behavior
Only if using the magnetic stripe. If the transaction is authorised using the smartcard chip on the card, the PIN is (AFAIK) used to unlock the authorisation on the chip and thus needs to be entered while the card is in the machine.
pmjordan··on Asynchronous IO in Rust
They certainly look useful at first glance.

The first's library implementation is based on boost.coroutine which as far as I'm aware uses stack-switching, so this is more of a syntax demo than a demo of the final implementation details. The fact that you can apply sizeof() to the resumable type is important for the kernel-typical pool allocators.

The second seems to have preview support in VS2015's compiler. Too bad I'm not much of a Windows programmer these days… It's not quite clear what ther memory-allocation story is from that article.

Of course the downside is it's yet another graft onto the C++ language. After ~15 years of using it, my point of view is mainly that C++'s type system and unsafe-by-default behaviour inherited from C are a mistake…

pmjordan··on Asynchronous IO in Rust
Most of my work involves kernel programming (device drivers for hardware or virtualisation companies etc.); almost all of the rest of it is writing networking code (custom protocol implementations). So my reasons for evaluating[1] Rust are that I think C and C++ are pretty awful languages for writing code that's as security and reliability critical as the code I touch on a day to day basis, while memory-managed languages aren't even on the menu for me - kernel hacking is a fairly unpopular niche, and I'm used to it being ignored in terms of programming language and library design. My opinions/statements below are primarily centred around this set of use cases:

* There is little practical difference between regular threads and green threads in an OS kernel. Most OSes can't handle it if you manually mess with the stack in a kernel context anyway. (thread records are typically accessed by rounding the current stack pointer) So if you want to do synchronous-style I/O with real stacks, you'll need an OS thread for each task.

* Kernel thread stacks are fairly small; 8-16KiB are typical. The reason for this is of course that kernel stacks must use wired (non-pageable) memory, or interrupts will irrecoverably page fault. 8-16KiB is much too small for buffers of course, but also enormous compared to the actual amount of non-buffer state for most I/O tasks. In any case, you never ever want to get too close to utilising the theoretical maximum as you risk crashing the system. So for every kernel thread you create, you know you're wasting precious wired memory. Obviously, this is true for threads created from userspace too, but in the kernel, people usually don't have a choice about running your code, so you try to be as good a citizen as possible, and not fire off hundreds of threads.

* In many contexts, dynamic memory allocations are not reliable, and allocation failure must not impede progress. (I.e. I can't wait for the system to page some memory out to disk if my code is on the critical path for disk I/O.) So typically, it is desirable to pre-allocate enough memory to keep all the state required for a sequence of operations from start to finish. It's even less likely you can just spin up a new thread; so the threaded approach implies keeping a pool of threads around which is guaranteed to be big enough. A.k.a. a waste of resources.

* The chain-of-callbacks approach to I/O is even more awful in languages and environments with manually managed memory and resources.

* If I'm going to pick a fancy new language to write my drivers in, I'm still going to have to use the custom alloc/free functions for each type of kernel object (network packet, etc.) that the OS I'm writing against happens to use.

So typically, you end up either splitting your code into a bunch of callbacks, or you create a complicated explicit state machine with a giant dispatch switch() statement. In both cases all state tracked in a giant struct. Keeping track of control flow is tricky. Maintaining invariants is tricky. Making sure you don't leak (or over-free, or use-after-free) any of the resources you touch is tricky.

It'd be really, really nice if the language could help you out with this. Write it as synchronous code, and the compiler turns each location where execution can be suspended into a callback function. The locals that are used across suspension points are stored in an automatically generated struct (bonus points: unions for state which is guaranteed to not have overlapping lifetimes) which can be preallocated before firing off the "task" in question. As far as I'm aware, such a code transformation would effectively be a CPS-transform, (continuation passing style) which has at least been researched quite a bit in theory, if not so much in non-GC-language practice.

I haven't been able to invest large amounts of time into really learning Rust and applying it to my use case in earnest. It's tough without a remotely compliant standard C library around, and I've struggled a bit with trying to pick and choose bits out of Rust's 'core' library without bringing on an avalanche of dependencies. (any kernel module code is kept in wired memory, so unused code is a waste of resources in the kernel) I'm determined to overcome that though and use Rust for something other than a toy kernel module, and see if and how it improves things over C. If Rust does start supporting some kind of advanced I/O pattern that works in that sort of constrained environment, that seems like a significant competitive advantage.

[1] https://github.com/pmj/rustykext

pmjordan··on Finland considers basic income to reform welfare system
That's the case in many European countries with sophisticated welfare systems. In Austria, we can pay extra (I think ~1.5% of income) as self-employed to get unemployment benefits but I don't know how popular that option is in practice.

Personally (as a highly employable, fairly senior software developer, so I'm unlikely to be out of a job as long as I can work) what's worse than lack of unemployment benefit is dealing with times of sickness. I suffered from Lyme disease for about 2 1/2 years until it was diagnosed properly and treated, and in addition to the reduced income due to being unable to work at times, and the extra cost of healthcare (despite the insurance it's not exactly free) in Austria, they still expect you to pre-pay taxes and pension & health insurance contributions based on your earnings 1-2 years ago. In theory you can claim some money for a few weeks if you get sick, but (a) you have to completely shut down any business activity for that time and (b) you have to be declared unable to work by a doctor. (Unlikely, considering the doctors were all telling me there was nothing wrong with me and it was "stress"…)

A basic income would at least help deal with the reduced income due to sickness & extra costs due to healthcare. The pre-payment aspect is probably peculiar to Austria and apparently frequently bankrupts profitable small businesses.

pmjordan··on Three Wise Men in a Bed: Bedsharing and Sexuality in Medieval Europe (2014)
That seems a likely explanation. It seems unlikely that there were actually only 3 magi, considering the bible's obsession with numbers even in places where it's unlikely that the number is accurate. It seems to me the authors would have leapt at the opportunity of putting a 3 in there, had they seen fit.
pmjordan··on Every freelancer starts out undervaluing their work
HN has some form of "no numbers in titles" policy. I'm not even sure list articles are allowed at all.
pmjordan··on Retina Macbook 2015 Teardown
Leaving aside upgrades and repairs, it makes disassembly for recycling purposes overly difficult, i.e. expensive, when everything is glued. This reduces the profitability and therefore likelihood of recycling each individual component to the maximum of its potential.
pmjordan··on Unfunny April Fool's Joke from the Magic Lantern Developers
You need SOME code to display debug info or at least a message when the processor encounters an unrecoverable exception. Otherwise all crashes would just freeze the system.
pmjordan··on NVMe, the fast future for SSDs
Most current PCIe SSDs behave to the PCI bus & operating system like an AHCI controller with a SATA SSD attached to it. Advantage of this is that it's well supported by firmware (BIOS/EFI) and operating systems (stock drivers). Such SSDs inherit the limitations of that architecture, which was designed for spinning platters. NVMe is a fresh start in that regard.
pmjordan··on The Book of Shaders
UK & Ireland: Yes, and still do, although it's apparently a corruption of "hatch" (as in cross-hatch).

http://en.wikipedia.org/wiki/Number_sign#Usage_in_the_United...

pmjordan··on Thomas Edison's 146 question interview for prospective employees
The practice of medicine by human Doctors probably can't be much further optimized from what it is right now.

Maybe this is true for the 95-99% most common of conditions. Doctors can be shockingly bad at diagnosing anything they don't see on a daily basis. (rare-ish conditions, unusual presentations, or anything discovered since they studied medicine)

Google search is probably very inefficient for this kind of thing, but specialised search engines based on bayesian networks or similar might get you some leads on what to test for a lot faster than going from doctor to doctor in the hope that one of them might have an idea that pans out.

pmjordan··on Who Can Save the Grand Canyon?
Yes, the Great wall of China, that strange natural phenomenon, formed by tectonic forces over millions of years.
pmjordan··on MacBook Pro Repair Extension Program for Video Issues
Nvidia and AMD GPUs probably generate more heat than Intel chips and so have likely been more badly affected. Has there been some breakthrough in the alloy used for solder that makes this less of an issue now? Also interesting that I've never heard of this issue with desktop GPUs, which get insanely hot. My guess is the solder pads are bigger and more widely spaced?
pmjordan··on The Psychological Difference Between $12.00 and $11.67
VAT is state global

Nit pick: this isn't strictly true - Spain's various islands (Balearic islands, etc.) have a different VAT rate to mainland Spain. And there are 2 towns in Austria with the same VAT rate as Germany's, not the rest of Austria's - one is an enclave in Germany, the other is only reachable by road via Germany. There are probably other weird VAT exceptions, but in any case, consumer prices must always be quoted including VAT.

pmjordan··on Linus Torvalds on HFS+
I don't know to what extent this affects HFS+, but case insensitivity in general is locale dependent. The classic example is the Turkish distinction between dotted and dotless I - http://en.m.wikipedia.org/wiki/Dotted_and_dotless_I.

Quote:

The dotless I, I ı, denotes the close back unrounded vowel sound (/ɯ/). Neither the upper nor the lower case version has a dot.

The dotted I, İ i, denotes the close front unrounded vowel sound (/i/). Both the upper and lower case versions have a dot.

End quote.

I can imagine that being a nightmare, particularly if one user uses a Turkish locale and another on the same machine uses English. And all of that complexity in the kernel? Ouch. (Or HFS+ just behaves incorrectly for Turkish file names, not sure that's really better?)

← PreviousPage 5 of 34Next →