8

Oftentimes, "dirty" is used to represent unsaved code, memory, or files. For example, a file can be "dirty", meaning it's unsaved, memory can be "dirty", meaning it's been modified but hasn't been written to RAM, and Git reports its working tree as "clean" when there are no uncommitted changes.

I understand why you would use the term, but where did it originate?

  • 1
    I believe this term comes from the paper world. A dirty copy was something written quickly, often with ink stains and spelling mistakes. It wasn't reliable for those reasons. A clean copy took more time, no blotches, and no spelling mistakes. – Kain0_0 May 18 at 1:39
  • 2
    I also agree that this most likely comes from paper (i.e. that it predates the computer era), but in the sense that a "clean copy" is a paper record consisting of the essential data only, whereas a "dirty copy" consists of accumulated evidence of modifications, corrections, and so on. The general idea of records possessing "cleanliness", and that good administration involves hygiene behaviours, almost certainly dates from time immemorial. – Steve May 18 at 11:41
10

Taking a careful look back, it seems that dirty has been used for quite a long time now.

Check, for example, the book: Inside Windows 2000 Server, page 800).

Also, in (1999) Encyclopedia of Computer Science and Technology: Volume 41 - Supplement 26, page 22, Dirty has a clear definition.

In Volume I of the IEEE Proceedings of the Twenty-Seventh Hawaii International Conference on System Sciences, page 166, an excerpt contrasts FRESH vs. DIRTY as definitions.

From this 1975 Encyclopedia of Computer Science and Technology, page 261 informs us (among other things) that:

The ''dirty bit'' is set by the processor whenever a write operation is performed on the associated page.

Here is another occurrence from 1977:

Pages which have been altered since being loaded into the PBS are called "dirty" pages and must be cleaned by having their contents written back to the main memory [...]

Looking "into" this book by trying to slightly "bend" Google Books' quite restricted search functionality (it only shows a couple of lines so you have to be very inventive with your searching), page 48 reveals the paper with the definition:

Design of a Microprogrammed Controller for a Paged Hierarchical Memory System by D. Cronshaw, W. Turner and J. Shener - Xerox Corporation, El Segundo, California.

Here is where it gets more interesting. The common theme from all those sources is that "dirty" seems to be a term originating from processor design, micro-controllers, all things cache, etc, i.e. and has caught up being a general-purpose programming design pattern.

Hold your breath, we're not there yet! A slightly more careful and microcontroller-oriented search through Google got me to the earliest occurrence I could uncover of the term. It's this expired patent from 1973 (pdf for the hardcore investigators):

System for improving the reliability of systems using dirty memories

Upon visiting the main page, the first line of the abstract eloquently explains the intended meaning:

Enables any ''''dirty'''' hardware portion of main memory (i.e. ''''dirty'''' means causing correctable errors) in a computer system to be used for operations which read its contained data or program, as long as the content of the portion is not changed and an I/O copy of the identical content exists.

Reading through the patent text, the intent is clear:

The memory portions which are functionally useable are actually either 'clean' (i.e., they do not cause any errors), or 'dirty' (i.e., one or more correctable errors have been caused which have used up, but have not exceeded, the error-correcting capability of any unit in the memory portion). Memory portions not functionally useable are 'bad' (i.e., causes errors exceeding the error correction capability of the memory portion).

For completeness, I also take the liberty of quoting the Summary of the invention:

This invention provides an automatic hardware controlled process for use in a computer machine to ensure that changed data is always stored in highly reliable, or clean memory portions, thus improving the overall reliability and economics of the computer machines use, while making use of lesser reliable, or dirty memory portions for unchanged data or instructions without detracting from the reliability of using the computing machine.

The invention detects a dirty condition for any page frame during its fetch operations, and once detected thereafter indicates the dirty condition for a respective page frame. Also, before any change is permitted to any data in its main memory, e.g., any page frame, the invention moves the data existing in the dirty page frame to a clean page frame, and then commences the write operation.

So, to attempt to answer the original question, dirty refers to pieces of memory that, somehow, contain correctable errors. As far as I can gather from the patent descriptions, dirty refers to places in memory, which have problems, which are, nevertheless, manageable, i.e. the system can infer the proper structure of the contained data through error-correction techniques. Therefore, dirty in this sense refers to flawed/problematic, but not yet in a mangled state.

The important distinction/difference I may point to with respect to the already given comments/answer, is that, according to the original intention, dirty appears to be a property of the medium and not of the stored data, as the comments may appear to imply by referring to dirty copy and clean copy. In the sense implied by the patent, a dirty copy is a copy written on dirty memory, i.e. on memory that you know is flawed, but still have the capacity to correct, or perfectly infer the correct data despite the errors. A bit like writing on dusty, half-torn water-soaked thinned paper increases the chances of losing your scriptures, although you don't, generally, and if you do lose a couple of words, you can probably infer them from the ambient context. But the longer you use the paper, cumulative damage makes it more and more unreliable and then an entire sentence is scrambled and you have no way to recover it.

In that sense, the term may well have originated from the paper world but in a slightly different meaning: a dirty copy is a copy written on dirty (damaged) paper, whereas a clean copy is written on clean paper. You risk more when you write on dirty paper than when writing on clean paper.

Storing modifications and knowing whether part of the data has changed or not, and other connotations attached to the current meaning of dirty (bits, flags, etc.) does not seem to (at least not directly) have been part of the original purpose of the term dirty. I can see how this may have quickly caught on soon afterwards though, as some specific types (or simply distinct designated parts) of memory are, generally, considered volatile and more unstable than other, more consistent parts of memory (such as permanent storage). The analogy becomes obvious then, it is simply an abstraction of reliability and duration (or durability, if you prefer). Durable memory is clean and sturdy, and volatile memory is dirty and unreliable (power goes off and you suddenly can't recover a thing) and has to be marked as such.

That's about as far as we can probably go, at least that was as deep as I could dive, if someone else has more information or input, I would be much interested to know. From that point on, only parallels can be drawn and other analogues imagined. A more definitive insight could probably only come from the owner of the (now expired) patent, Francis Daniel Lawlor, and the patent assignee, the International Business Machines Corporation.

EDIT/UPDATE

To make the technical world meet the non-technical world, this reference has an interesting excerpt from a 1887 Library Journal publication:

We find, however, that as a rule the public prefer a dirty copy of a book they want rather than to go without. It is the lesser of two evils, and need overcomes fastidiousness.

This talks, to my understanding, about the costs and implications of replacing all dirty books in a library with new ones. The term dirty copy is used here in much the same sense as the technical meaning implied by the patent referenced above. A dirty copy is a copy that is worn out but still usable nonetheless (i.e. the medium is worn out). Therefore, I think the origin of the term is simply literal and dirty means closer to "unusability". The subsequent connotations and adoption from the technical world I assume stem from the fact that this is actually rather a rather useful abstract definition in the context of reliability.

| improve this answer | |
  • This is quite the writeup! Although I believe it originally orignally came from "dirty copy" from the publishing world (see Google Ngrams), this answer clearly explains the tech-centric origin of the word, so I'll be accepting it. – Michael Kolber May 19 at 19:09
  • @MichaelKolber Definitely! I have updated the answer with a small (quite old) reference, to make an additional point. It seems that the term is simply used in the literal sense. A dirty copy is stained, damaged and unreliable. In the technical world, it practically emphasizes the good idea of making a clean copy as soon as possible. – Vector Zita May 20 at 12:20
2

As stated in the comments below the question, the term appears to have originated in the paper world.

A dirty copy was something written quickly, often with ink stains and spelling mistakes. It wasn't reliable for those reasons.

In addition,

a "dirty copy" consists of accumulated evidence of modifications, corrections, and so on. The general idea of records possessing "cleanliness", and that good administration involves hygiene behaviours, almost certainly dates from time immemorial.

| improve this answer | |
0

There is a Wikipedia page on this matter. This details the meaning yet not the origin. We can easily deduct the origin from the meaning though.

So it is originally a hardware related qualification. While the memory page is not touched it will remain clean. Obviously anyone who touches it will stain it and ruin its pristine state (or virgin quality if you like). This is bad (note the negative connotation of dirty) because this will cause us some work (we need to write it back to background memory).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.