HNHacker News
TopNewBestAskShowJobs

ryao

4,481 karma · joined August 18, 2014

submissionscomments
ryao··on Object-oriented design patterns in C and kernel development
“this” is a reserved keyword in C++, so you do not need to worry about it being a global variable.

That said, I like having a this pointer explicitly passed as it is in C with ADTs. The functions that do not need a this pointer never accidentally have it passed from the developer forgetting to mark the function static or not wanting to rewrite all of the function accesses to use the :: operator.

ryao··on Object-oriented design patterns in C and kernel development
My point is that this pattern is not object oriented programming. As for a default behavior with it, you usually would do that by either always adding the default pointer when creating the structure or calling the default whenever the pointer is NULL.

In the Linux VFS for example, there are optimized functions for reading and writing, but if those are not implemented, a fallback to unoptimized functions is done at the call sites. Both sets are function pointers and you only need to implement one if I recall correctly.

ryao··on Object-oriented design patterns in C and kernel development
Compiler design does predate object oriented programming. The first compiler was made by John Backus et al at IBM in April 1957.

As for abstract data types, they originated in Lisp, which also predates object oriented programming.

ryao··on Object-oriented design patterns in C and kernel development
> The article describes how the Linux kernel, despite being written in C, embraces object-oriented principles by using function pointers in structures to achieve polymorphism.

This technique predates object oriented programming. It is called an abstract data type or data abstraction. A key difference between data abstraction and object oriented programming is that you can leave functions unimplemented in your abstract data type while OOP requires that the functions always be implemented.

The sanest way to have optional functions in object oriented programming that occurs to me would be to have an additional class for each optional function and inherit each one you implement alongside your base class via multiple inheritance. Then you would need to check at runtime whether the object is an instance of the additional class before using an optional function. With an abstract data type, you would just be do a simple NULL check to see if the function pointer is present before using it.

ryao··on China's Share in Global Display Capacity to Reach 75% in 2028
I have never seen bad text rendering on an OLED. Which ones have you seen that have bad text rendering? I recently replaced a Sony X900E with a LG C4. Text is crisp and power usage dropped going to the OLED.

Permanent burn-in will happen with static images, but it happened on CRTs too and those once dominated the world. As long as it is infrequent, it is probably not much of an issue. Newer OLEDs, such as Apple’s tandem OLEDs, minimize the issue.

I am not sure what you think your point about black levels contributes to the discussion. Higher black levels would only favor OLEDs thanks to their inky blacks.

ryao··on China's Share in Global Display Capacity to Reach 75% in 2028
How? OLED is still the gold standard while MiniLED is a rebrand of full array local dimming LCDs where the zone count is somewhat higher than past models. MicroLED is the true replacement for both. I do not see how MiniLED is on track to outpace anything.
ryao··on Ask HN: Why hasn't x86 caught up with Apple M series?
Apple has an architectural license that lets them build their own ARM cores:

https://www.electronicsweekly.com/news/business/finance/arm-...

It is very unlikely Apple uses anything from ARM’s core designs, since that would require paying an additional license fee and Apple was able to design superior cores using its architectural license.

ryao··on Ask HN: Why hasn't x86 caught up with Apple M series?
That could be because crowdstrike is not inside the XNU kernel anymore:

https://www.crowdstrike.com/en-us/blog/crowdstrike-supports-...

They happily implement a userland version on macOS, but then claimed that being in the kernel is absolutely necessary on Windows after they disabled all Windows machines using it.

ryao··on Ask HN: Why hasn't x86 caught up with Apple M series?
Chrome has been very conservative about enabling hardware acceleration features on Linux. Look under about://gpu to see a list. It is possible to force them via command line flags. That said, this is only part of the story.

There are different kinds of transistors that can be used when making chips. There are slow, but efficient transistors and fast, but leaky transistors. Getting an efficient design is a balancing act where you limit use of the fast transistors to only the most performance critical areas. AMD historically has more liberally used these high performance leaky transistors, which enabled it to reach some of the highest clock frequencies in the industry. Apple on the other hand designed for power efficiency first, so its use of such transistors was far more conservative. Rather than use faster transistors, Apple would restrict itself to the slower transistors, but use more of them, resulting in wider core designs that have higher IPC and matched the performance of some of the best AMD designs while using less power. AMD recently adopted some of Apple’s restraint when designing the Zen 5c variant of its architecture, but it is just a modification of a design that was designed for significant use of leaky transistors for high clock speeds:

https://www.tomshardware.com/pc-components/cpus/amd-dishes-m...

The resulting clock speeds of the M4 and the Ryzen AI 340 are surprisingly similar, with the M4 at 4.4GHz and the Ryzen AI 340 at 4.8GHz. That said, the same chip is used in the Ryzen AI 350 that reaches 5.0GHz.

There is also the memory used. Apple uses LPDDR5X on the M4, which runs at lower voltages and has tweaks that sacrifice latency to an extent for a big savings in power. It also is soldered on/close to the CPU/SoC for a reduction needed in power to transmit data to/from the CPU. AMD uses either LPDDR5X or DDR5. I have not kept track of the difference in power usage between DDR versions and their LP variants, but expect the memory to use at least half the power if not less. Memory in many machines can use 5W or more just at idle, so cutting memory power usage can make a big impact.

Additionally, x86 has a decode penalty compared to other architectures. It is often stated that this is negligible, but those statements began during the P4 era when a single core used ~100W where a ~1W power draw for the decoder really was negligible. Fast forward to today where x86 is more complex than ever and people want cores to use 1W or less, the decode penalty is more relevant. ARM, using fixed length instructions and having a fraction of the instructions, uses less power to decode its instructions, since its decoder is simpler. To those who feel compelled to reply to repeat the mantra that this is negligible, please reread what I wrote about it being negligible when cores use 100W each and how the instruction set is more complex now. Let’s say that the instruction decoder uses 250mW for x86 and 50mW for ARM. That 200mW difference is not negligible when you want sub-1W core energy usage. It is at least 20% of the power available to the core. It does become negligible when your cores are each drawing 10W like in AMD’s desktops.

Apple also has taken the design choice of designing its own NAND flash controller and integrating it into its SoC, which provides further power savings by eliminating some of the power overhead associated with an external NAND flash controller. Being integrated into the SoC means that there is no need to waste power on enabling the signals to travel very far, which gives energy savings, versus more standard designs that assume a long distance over a PCB needs to be supported.

Finally, Apple implemented an innovation for timer coalescing in Mavericks that made a fairly big impact:

https://www.imore.com/mavericks-preview-timer-coalescing

On Linux, coalescing is achieved by adding a default 50ms slack to traditional Unix timers. This can be changed, but I have never seen anyone actually do that:

https://man7.org/linux/man-pages/man2/pr_set_timerslack.2con...

That was done to retroactively support coalescing in UNIX/Linux APIs that did not support it (which were all of them). However, Apple made its own new API for event handling called grand central dispatch that exposed coalescing in a very obvious way via the leeway parameter while leaving the UNIX/BSD APIs untouched, and this is now the preferred way of doing event handling on MacOS:

https://developer.apple.com/documentation/dispatch/1385606-d...

Thus, a developer of a background service on MacOS that can tolerate long delays could easily set the slack to multiple seconds, which would essentially guarantee it would be coalesced with some other timer, while a developer of a similar service on Linux, could, but probably will not, since the scheduler slack is something that the developer would need to go out of his way to modify, rather than something in his face like the leeway parameter is with Apple’s API. I did check how this works on Windows. Windows supports a similar per timer delay via SetCoalescableTimer(), but the developer would need to opt into this by using it in place of SetTimer() and it is not clear there is much incentive to use it. To circle back not Chrome, it uses libevent, which uses the BSD kqueue on MacOS. As far as I know, kqueue does not take advantage of timer coalescing on macOS, so the mavericks changes would not benefit chrome very much and the improvements that do benefit chrome are elsewhere. However, I thought that the timer coalescing stuff was worthwhile to mention given that it applies to many other things on MacOS.

ryao··on An argument for increasing TCP's initial congestion window (2024)
Do you have links to information on what DPDK and VPP are doing in the area of bufferbloat? I have not kept up with them since I cannot use them in my day to day life, but I would love to update myself on the subject.

By the way, when I wrote in another comment that bufferbloat was solved, I meant it in the same way that IPv4 exhaustion is solved by IPv6. We have the ability to deploy solutions that largely fix things, but whether we do is another matter. You are right to say that the past 10-15 years have started to make a dent in the problem. I had not meant to suggest otherwise.

ryao··on An argument for increasing TCP's initial congestion window (2024)
Multiple people have tried to explain buffer bloat to you and you have repeatedly denied it affects people in reality. The discussion with you has been little different from people saying that a number of things are explained by the Earth being round only to be told, by you in this analogy, that we have failed to consider many other things and thus cannot really know that the earth is round.

This is the most bizarre choice of “hill to die on” that I have ever seen.

ryao··on An argument for increasing TCP's initial congestion window (2024)
I do not think mental illness is the cause of people posting wrong remarks, but when they post remarks that strike me as particularly bizarre, as yours have here, I think consideration of mental illness itself is worthwhile, productive and interesting. I have been very kind from the start, when I informed you that you were making yourself look bad. Being curious about what causes you to persist in such behavior is also a form of kindness, especially when such curiosity leads to a recommendation of professional help, although those who need help are not always willing to get it.

I will point out that you were not interested in debating in good faith, as your sole purpose is to make the point that people should treat buffer bloat as a theoretical issue that does not actually affect people, with the explanation for every incident of buffer bloat always being something else. Everything you wrote has been consistent with that. You even applied a pattern of overanalysis to the discussion that can be used to claim the contrary to anything. Your apparent need to deny the existence of a well known issue is bizarre. You would be much happier right now if you had dropped the subject.

By the way, peering links between the greater China area and the rest of the world are notoriously bad due to limited capacity. China in particular has three tier 1 networks that all refuse to upgrade peering links between each other in a timely manner, and the peering links between them and the rest of the world are often just as bad as the peering links inside of China. In order to get a decent connection there in 2016, I had to forcibly do my own routing through VMs in data centers in Shanghai, Tokyo and others to control the links used, after much trial and error, yet there were still periods where the links were horrendous and surprisingly, the issue was not always exclusive to China according to my testing between VMs on various data centers. I was visiting family for a month, yet needed a decent connection to work remotely, so I spent an entire week non-stop studying the connectivity and experimenting with ways of improving my VPN connectivity. I also had proof that the GFW was not where problems occurred, since my tcpdump pcap files taken at VMs in Shanghai and Tokyo showed the packets traversing the GFW. I also had reproduced similar performance issues using VMs in other countries, such as Japan and Singapore, where there is no GFW, as part of attempts to identify paths over which I could forcibly route my traffic via iptables rules. It is obvious to me that you will continue to deny bufferbloat was a problem and instead blame something else, yet as others have already explained to you, bufferbloat makes problems worse. After a delay of a few hundred ms, my VoIP session did not care if the packets were delivered or not, since at that point, the packets were useless, yet enormous buffers would delay them and other traffic well past a sane expiry instead of dropping it, to the detriment of all trying to use the peering links.

ryao··on An argument for increasing TCP's initial congestion window (2024)
The problem of buffer bloat is one of many issues that affect internet users. When I visited China and pings to my VPN in the US jumped from 200ms to 30 seconds depending on the time of day, bufferbloat was severely affecting me. That could only be described as bufferbloat, since the packets were suffering from store and forward overhead to an excessive degree and my pings were able to measure it across times of day.

Historically and likely still in the present day (but not in my household as we use AQM now), whenever one person in a household does a large download, internet latencies shoot up for everyone in the household, which is also bufferbloat. Having to wait hundreds of ms per round trip brings us back to the 56k dialup days and the performance impact on interactive traffic is horrific. It is enough to make VoIP unusable. As others have told you, there can be other issues at the same time, but bufferbloat makes the issues worse. I cannot speak for others on the extent to which they are afflicted by buffer bloat, but adopting AQM had a night and day difference in performance of the internet connection in my house, since I often do big data transfers that previously would slow down basic web browsing for everyone in my house, myself included.

As for your conjecture that extant problems are visible in recent journal publications, journals have a selection bias. The idea that a problem’s existence is indicated by the degree to which people are publishing papers on it in journals is fallacious since the papers need to not just provide something new, but also be interesting to those running the journal (i.e. make them think that the papers would elevate the status if their journal and help them get increased readership, provided that they are not a junk journal that will publish literally anything). On top of that, the work needs to be funded. Bufferbloat, which is largely considered a solved problem and which predominantly affects the less affluent these days, is not something that will get much attention in journals since nobody in academia seeks funding for something that they do not think they can improve or publish.

Finally, I did not use any ad hominem remarks toward you, as my remarks had focused entirely on what you wrote. I did write that any further replies would likely be done to get you to keep talking so I can play my old game of “figure out what is wrong with someone posting bizarre things on the internet”. About 30% of the population is mentally ill and thus when someone is posting bizarre things online, it is often the result of mental illness. Figuring out which mental illness is often the only reason responding to bizarre posts is worthwhile (as it is both an intellectual challenge and a public service). This contradicts your remarks suggesting that there is no point to my replies, to use my words rather than yours. It is not an ad hominem remark to say that I am likely to do this analysis. Posting the results of the analysis would be, but it would be grounded in fact and would likely be done to suggest professional help for X condition, if my amateur analysis identifies a condition that could benefit from professional help. Honestly, I think the world would be a better place if more people who studied psychology (even 1 class like I did) played armchair psychologist when others persist in a pattern of bizarre remarks and refer those who need professional help to trained professionals.

ryao··on An argument for increasing TCP's initial congestion window (2024)
Overanalysis for the sake of denying the existence of whatever you want is cliche. It does not matter how complete the information on a subject is, since you will just post more pointless questions, whose relevance is specious, for the sake of claiming there are non-existent issues in understanding. The last time I saw this used involved a very loquacious guy who denied Darwin’s theory of evolution. It can also be used to claim the world is flat.

I was being generous by advising you to stop posting, since the more you post asinine things, the worse you look. In the past, I have taken the liberty to do amateur psychoanalysis of people who post bizarre things online based on a psychology class I took in college. If I keep responding, it will only be to get you to post more so that I can work out what is wrong with you for my own curiosity. I am probably not the only one thinking this.

ryao··on Good multipliers for congruential pseudorandom number generators
I am under the impression that George Marsaglia‘s work showed that there are no good values for this class of PRNGs. That is why he devised so many other classes of PRNGs.
ryao··on An argument for increasing TCP's initial congestion window (2024)
You don’t need a speed test website to see this problem. Just run a ping on your own while doing a big download that saturates your connection and bufferbloat will happen unless there is some active queue management to prevent the ping packets from waiting in the queue behind the download packets. This happens anytime that there is a fast/slow transition in the internet and the slow connection cannot keep up. To prevent packet loss, the packets will be buffered, which works well for short spikes, but prolonged activity will result in a noticeable backlog and if buffers are allowed to be sufficiently big, you can get arbitrarily long delays, which are visible in ping times.

The worst that I have ever seen was about 30 seconds when visiting a foreign country where bufferbloat was occurring at peering links. The bufferbloat in peering links is likely visible from western countries if you ping residential IPs in developing countries and monitor the ping times over days. Some parts of the day will have very high ping times while others will not. The high ping times will be the buffer bloat.

In most western countries, the bufferbloat typically occurs at people’s home internet connections. As is the case in all cases of buffer bloat, the solution is to be willing to drop packets when the connection is saturated. If you limit the bandwidth just below what the connection can handle, you can do active queue management to solve the problem.

That said, I suggest you stop posting replies. Your crusade against the idea of buffer bloat makes you look bad to anyone with enough networking knowledge to understand what bufferbloat is. I also strongly suspect I wrote an explanation that you will take zero time to understand and rather than take my advice, you will post another reply to continue your crusade. :/

ryao··on ARM adds neural accelerators to GPUs
Nvidia has the Tegra line, but the market is not interested in it outside of game consoles.
ryao··on Using AI to secure AI
The quotation is more impactful in the original Latin: Quis custodiet ipsos custodes?
ryao··on Kodak says it might have to cease operations [updated]
They did do more than just chemicals for film, but then decided to spin off the business so that they could focus on the film business:

https://en.wikipedia.org/wiki/Eastman_Chemical_Company

One really must admire their determination to throw all of the life boats overboard to go down with the film ship. Every time they have a chance to save themselves if they move away from a single minded focus on film, they discard the opportunity. They just needed to mimic Nikon and Canon to stay in business, but refused to do even that.

The only way I see Kodak having a happy ending would be if Eastman Chemical purchases their former parent company to put it under sane management.

ryao··on This website is for humans
If you want a good example of a site with a theme switcher:

https://www.csszengarden.com/pages/alldesigns/

ryao··on Claude says “You're absolutely right!” about everything
It sounds like you are used to short conversations with few turns. In conversations with dozens/hundreds/thousands of turns, prompting to avoid bad output entering the context is generally better than prompting to try to correct output after the fact. This is due to how in-context learning works, where the LLM will tend to regurgitate things from context.

That said, every LLM has its quirks. For example, Gemini 1.5 Pro and related LLMs have a quirk where if you tolerate a single ellipsis in the output, the output will progressively gain ellipses until every few words is followed by an ellipsis and responses to prompts asking it to stop outputting ellipses includes ellipses anyway. :/

ryao··on Claude says “You're absolutely right!” about everything
OpenAI’s plan is to make billions of dollars by replacing the people in your Teams chat with these. Management will pay a fraction of the price for the same responses yet that fraction will add to billions of dollars. ;)
ryao··on Claude says “You're absolutely right!” about everything
The idiom “X loves to Y” implies frequency, rather than agency. Would you object to someone saying “It loves to rain in Seattle”?

“Malicious compliance” is the act of following instructions in a way that is contrary to the intent. The word malicious is part of the term. Whether a thing is malicious by exercising malicious compliance is tangential to whether it has exercised malicious compliance.

That said, I have gotten good results with my addendum to my prompts to account for malicious compliance. I wonder if your comment Is due to some psychological need to avoid the appearance of personification of a machine. I further wonder if you are one of the people who are upset if I say “the machine is thinking” about a LLM still in prompt processing, but had no problems with “the machine is thinking” when waiting for a DOS machine to respond to a command in the 90s. This recent outrage over personifying machines since LLMs came onto the scene is several decades late considering that we have been personifying machines in our speech since the first electronic computers in the 1940s.

By the way, if you actually try what you suggested, you will find that the LLM will enter a Laurel and Hardy routine with you, where it will repeatedly make the mistake for you to correct. I have experienced this firsthand so many times that I have learned to preempt the behavior by telling the LLM not to maliciously comply at the beginning when I tell it what not to do.

ryao··on Claude says “You're absolutely right!” about everything
LLMs love to do malicious compliance. If I tell them to not do X, they will then go into a “Look, I followed instructions” moment by talking about how they avoided X. If I add additional instructions saying “do not talk about how you did not do X since merely discussing it is contrary to the goal of avoiding it entirely”, they become somewhat better, but the process of writing such long prompts merely to say not to do something is annoying.
ryao··on RISC-V single-board computer for less than 40 euros
This is speculation on my part, but:

1. It is non-trivial additional work to add since these are high frequency signals.

2. It is non-trivial additional work to validate.

3. The hardware PCI-E support is likely buggy because it is not well tested and few want to volunteer to spend time working with the SoC supplier on the bugs.

ryao··on UK government advises deleting emails to save water
I see a few obvious problems:

1. A closed system cannot exhaust heat via evaporative cooling, which would defeat the purpose.

2. Many datacenters are no where near salt water.

3. There are likely reliability issues that would need to be overcome and it is simply cheaper to use fresh water.

ryao··on UK government advises deleting emails to save water
Storing pictures and emails in a data center does generate heat, but it is negligible. Also, claims of data center water usage are heavily overstated. Some do, but only during summer months. I assume the reason for the UK’s asinine advice is because of they think there is a link between heat generation and water usage at data centers. While a link does exist, it is not straight forward.

I have only ever toured a data center once, but the one I toured had no water usage by the cooling infrastructure as far as I could tell. However, the facility’s APUE was something like 1.7, which is high. I have read that some facilities with impressively low APUE numbers use water during particularly hot summer days, which is presumably for evaporative cooling. Unfortunately, I have yet to see one of these facilities in person to know the details beyond what has been publicly written.

If it counts for anything, I have hundreds of commits in OpenZFS. I know some things about data centers from a mix of professional contacts since my work is used in them (which is how I got the tour in the first place), and personal interest in the subject, but I am far from an expert on all aspects of how data centers work. Speaking of which, I doubt there is any one person who is an expert on all aspects of how data centers work, since the knowledge is spread across multiple types of experts. A physicist would not be my first choice of expert when asking questions about data centers. A data center technician would be a better person to ask.

ryao··on UK government advises deleting emails to save water
> Assuming you're using waste water, which most people won't.

My household (in the US) uses water from cooking rice to water plants, but I cannot imagine many UK households cook rice to be able to do that.

ryao··on UK government advises deleting emails to save water
With the exception of the asinine piece of advice at the end, given that such advice likely has around for decades, I cannot imagine it being very effective anymore as the measures suggested should already be in effect.

I would have speculated that they are imagining savings opportunities that do not exist, but the “delete emails” advice gives clear evidence that they are imagining savings opportunities that do not exist, so there is no need for speculation.

ryao··on Starbucks in Korea asks customers to stop bringing in printers/desktop computers
An AMD Ryzen AI Max+ 395 should do that.
← PreviousPage 4 of 34Next →