Malloc Geiger Counter
github.com
github.com
If you have the resources, have you considered getting a source of radiation and putting it by the RAM? In a plane for example, background radiation can be 30x or so. It might also reduce the time to see a flip...
Other considerations:
1. The act of checking the RAM (I believe) refreshes the memory cells.
2. I suspect the act of regularly changing the RAM bits to have an effect on the data stored. I think when the bit transitions from a 0 to 1 or vice versa, some inconvenient piece of solar radiation could bias it to a different state. That said, you would have to separate that from accidental row-hammer events.
3. You would think that higher temperature RAM was more likely to bit flip (the Scientific term is more wiggly electrons).
4. RAM clock speed. The higher it is, the less time it has to stabilize at the transistor level.
5. Memory cell size. The smaller it is, the more likely it will be affected.
There are probably tonnes of variables, but these are the ones I can think of for now.
Temperatures and clock speed would be very interesting. Not sure I want to even google for radiation sources though :D
So while rows are refreshed very often, a specific row is only refreshed ten times per second or so.
I make a desktop program with a sizeable installation base and it uses a form paged on-disk storage for larger data sets. The code has a fair amount of asserts in it and one specific assert would keep failing in a very tiny percentage of the cases. I kept reviewing the code and scratching my head before finally adding some extra logging for this case.
Lo and behold, in all failed cases an argument passed to a function had one of the bits set for no apparent reason. I.e. the offsets of pages in the cache would be:
00000000000000 ...
00000000100000 ...
00000000200000 ...
00000000300000 ...
But the args would come in as 80000000100000
00040000200000
01000000300000
...
Followed up with the people who reported these, asked to run an overnight RAM test and ALL of them found issues with their RAM. That was quite an eye-opener.Like, say, dacebook.com or facebooo.com
Spin up a web server, and you'll get traffic, but typically only one of the requests from a specific client.
https://media.blackhat.com/bh-us-11/Dinaburg/BH_US_11_Dinabu...
I only purchased RAM with heatsinks since then, and I didn't have such problems anymore (also my latest case has much better airflow)
This is also how I learned 3ware was using RAM instead of its own memory. What is he point of hardware RAID if main memory can screw it up?
I have also heard of people swapping hardware on a defective machine only to learn that the power supply was bad, sending noise or brown power to the system. Swap in a new power supply and the components start to behave themselves.
I've run enough systems with ECC ram to say the vast majority of ram works and will continue to work, but over time, a small amount will fail, again the vast majority is a single bit in the whole chip, but some will do multiple bits near each other (uncorrectable ecc error usually halts the system), or man single bit errors all over (many machine check errors per second makes the system go so slow, halting would be better).
Wish I could find the article again, I forget the details but it was a fun read.
But yes, there always is an efficiency, precision and identification tradeoff.
For folks who might be interested in more details on this: The _cross section_ allows you to quantify the frequency of a specific event occurring in your chip when bombarded by a specific particle (or class of particles). For example, in a case of an SRAM, you might want to calculate the cross-section for bit flips due to 24-GeV protons. The result that you get will be in units of cm^2; you can also interpret it as the physical surface area of the chip, multiplied by the probability (0..1) that any 1 particle passing through will trigger an event. Let's say you measure a cross section of 0.01 mm^2. Then if you expose that component to a flux of 10^3 particles/cm^2/sec, you will get an average of 1 event every 10 seconds.
The cross-section is only valid for one combination of the (event type, particle, energy) tuple. But often in dosimetry, errors on the order of 20% are acceptable, so we can "abuse" the results a bit. Within one manufacturing lot of chips, the cross-sections should be reasonably consistent. Typically you would estimate the mean and variance by measuring a few samples from the lot.
Then, to accurately measure a radiation field using these findings, you would generally need to measure the flux of every particle-energy combination separately. This is impractical, and for SEE* concerns we generally get away with distinguishing thermal neutrons and high-energy hadrons (which are separated by several orders of magnitude in energy). For this, it is sufficient to have 2 types of SRAM where each has a dominant cross-section for one of the particle classes of interest.
To measure the type of radiation that causes long-term gradual damage (TID) such as X-ray and gamma rays, you would use a different principle of measurement altogether (RadFET, P-i-N diode, floating-gate dosimeter...)
Radiation measurement can be fun!
[*] single-event effects, including bit flips and latch-ups
Apparently it works reasonably well.
https://news.ycombinator.com/item?id=3179852
> So, my mom is a former Maxwell employee who now does her own defense contracting, and makes this same type of part.
> As I understand it, when there is a nuclear event, it generates x-rays followed by the EMP. The goal is to have warheads in flight to be able to continue to their target, so the strategy is to employ an NED. When an event is detected, the warhead shuts down its electronics for the duration of the EMP, and then powers back up.
> With her NED, she uses an ASIC for detection. I might get some details wrong, but the ASIC has a physical array in it, and the x-rays flip bits in the array. When enough bits get flipped, one can infer a nuclear event. Because it is an ASIC it is really small, which has important advantages for space-born avionics.
Jim asked about our "20 queries," his incisive way of learning about an application, as a deceptively simple way to jump-start a dialogue between him (a database expert) and me (an astronomer or any scientist). Jim said, "Give me your 20 most important questions you would like to ask of your data system and I will design the system for you. " It was amazing to watch how well this simple heuristic approach, combined with Jim's imagination, worked to produce quick results.
Jim then came to Baltimore to look over our computer room and within 30 seconds declared, with a grin, we had the wrong database layout. My colleagues and I were stunned. Jim explained later that he listened to the sounds the machines were making as they operated; the disks rattled too much, telling him there was too much random disk access. We began mapping SDSS database hardware requirements, projecting that in order to achieve acceptable performance with a 1TB data set we would need a GB/sec sequential read speed from the disks, translating to about 20 servers at the time. Jim was a firm believer in using "bricks," or the cheapest, simplest building blocks money could buy. We started experimenting with low-level disk IO on our inexpensive Dell servers, and our disks were soon much quieter and performing more efficiently.
[1] https://cacm.acm.org/magazines/2008/11/549-jim-gray-astronom...
Likewise being able to hear if you and the BBS were properly connecting or not. Hearing your modem retry the handshake after dialling 90 times to get into a popular one was heartbreaking.
Later I've found out that piece of code was written by Wozniak himself.
As an aside I get the feeling software is being written more and more to assume SSDs. Starting up visual studio from fresh on my machine will thrash the disk. Disk read is roughly (average) 2MB/sec throughout. Disk queue length will hit 10 several times. It takes 4 mins 50 secs (290 seconds) before the disk will calm down - I just timed it. Total mem for the process when all's finished - 204MB! That's all!
My feeling is the VS code is spawning many threads which are each fighting each other for the disk. It's really, really poor.
Honestly, I'd strongly recommend you get an SSD - prices are really cheap nowadays.
It can do refactoring etc. and has context-sensitive help/completions but honestly I work in emacs because it offers so much more - except the high-level refactoring etc. Omnisharp works, sort of... VS just isn't as good as emacs in many, many basic ways.
Anyway, I'll look at SSDs and stop nattering about editors.
In fact, after working with VS for years and getting more and more annoyed by the lag, I tried JetBrains Rider - I'm a total convert, it's one of my favourite ever pieces of software! The UI takes a bit of getting used to if you've been using VS for a long time, but not that much. Plus there's an excellent dark theme that is quite close to VS's.
Rider is absolutely stuffed with features and config switches - it's close to feature parity with VS, with VS able to do a few things Rider can't, and vice-versa. Rider absolutely flies by comparison to VS, and is more stable too. Oh, and edit-and-continue "just works" in Rider, whereas I've always found it problematic in VS.
After getting an SSD, trying Rider is my next suggestion :)
The thing about "I do think [VS] a great IDE" is you haven't experienced emacs so you don't know what can be. What emacs is bad at: all the things VS is good at, the high-level code 'understanding'. But honestly for writing/modifying/moving around/various other stuff, emacs is just so astonishingly comfortable when you get used to it. It's not "I don't need to use the mouse", more "I barely need to think about it". And then you've got stackable clipboard, registers, macros from heaven, regexps that just work, so much more...
And perhaps best of all, it's written by programmers for programmers. VS feels like management have been involved in featuritis and "UI/UX experts" as they think of themselves but aren't, have been allowed out of their cage too often.
I'll not recommend you try emacs, it's a lot of investment but if you could get emacs to do high-level stuff as well as the low-level... Right, time for me to stop hijacking this thread!
I agree with this observation in general. I don't use VS Code in particular but you've given solid evidence of a seek-heavy/HDD-unfriendly workload.
> My feeling is the VS code is spawning many threads which are each fighting each other for the disk. It's really, really poor.
I agree this is a poor match to your hardware, but if you're saying this is evidence of poor engineering, I disagree. IDEs' most demanding customers are using high-core-count CPUs with SSDs and expect top performance with heavy workloads. So the Visual Studio team needs to make this fast, and I don't think they have much reason to care about HDD-based installations' performance. Most software developers won't have trouble affording SSDs to store their OS files and current project, and the ones that will aren't paying to drive IDE development either.
For my family members that have laptops with those shitty 5400rpm HDDs with 8MB read/write buffers - I can't blame them and just tell them to upgrade to an SSD. I've witnessed Windows update hogging 100% of the disk activity for 30+ minutes after reboot on these machines until they're actually usable...
But for my developer friends who I figure should know better, they never seem to think of looking into disk activity. It's almost always things like applications hanging/blocking on disk due to lots of different processes trying to read/write at the same time on an HDD or "small" RAM size causing constant thrashing on a disk due to memory being paged in and out of swap constantly.
Demonstration: https://www.youtube.com/watch?v=gWJtGZOp3K0
> We created a network monitoring system, Peep, that replaces visual monitoring with a sonic `ecology' of natural sounds, where each kind of sound represents a specific kind of network event.
https://www.usenix.org/legacy/publications/library/proceedin...
I've tried a bunch of the popular linux disk/resource usage monitors but I find none are as flexible/nice to look at as Windows' Task Manager overview graphs and Resource Monitor. Any time I'm using a Windows system I will dedicate a monitor to just having Resource Monitor's disk usage tab open (although it can result in nontrivial CPU usage under certain disk access patterns).
https://github.com/gordol/ld_preload-sounds
Generates WAV output by hooking malloc() and read().
You can totally hear the standard libraries loading in, I started this thing on a whim of silliness...
It started out as just 38 lines of code.
https://github.com/gordol/ld_preload-sounds/commit/2d51b3e7b...
I have used similar tricks with gdb to play a sound when some high-level function is called, can be really useful. However, for malloc I would expect it to be called so often that a human cannot hear the difference. Or the program needs to measure the rate and select the tone according to the rate. Of course it depends on the program, but at least if there is enough allocation to be worried.
Can gdb be configured to somehow “hum” a program by converting a series of operations into sound and we can hear our programs in action? No idea how to go about it though, and how to convert operations happening at the CPU clock rate into the audible regime, but seems like it’s worth exploring.
If you change the pitch by the allocated chunk size (maybe in log scale) or use different sound for free(), someone could be actually detecting memory leaks just by listening to the app.
I like the idea of changing pitch by size and also representing frees, but I’m not sure it would be useful to find memory leaks since there’s no real way of matching them up in any non trivial application.
"Due to copyright limitations on existing natural sound collections, Prof. Couch has spent many hours with a Telinga parabolic nature microphone and Sony DAT or digital minidisc recorder in search of the perfect bird."
Thanks for sharing this paper!
Read it, and I think this is actually a great new idea.
The broader idea here is that there are probably an infinite number of creative ways -- to measure different aspects of what software does, and to instrument that output in different creative ways that can be experienced via human senses (in this case, via sound).
* Any GC'd language really, JS, Java w/generics etc
I think this is literally already a feature in Haskell, except it beeps on GC rather than allocation.
https://downloads.haskell.org/~ghc/latest/docs/html/users_gu...
When I try
ghc -B hello.hs
I get an error Missing file: ./settings
.If I then
touch settings platformConstants
the error changes to Can't parse "./settings"
.What am I supposed to put in this settings file? I'm but a Haskell noob, and this is the first time I've heard of it.
EDIT:
I found it! The correct command is
ghc hello.hs +RTS -B
.I can't seem to get it to beep on macOS, though.
Does print "\a" work in your terminal?