What does "map" mean? I have encountered the term many times, in various CS education materials:


L2 CS162 (UC Berkeley):


  Memory-mapped I/O

L4 CS162 (UC Berkeley):


  Memory mapped files

L24 CS61 (UC Berkeley):


  “Memory mapped I/O”:  Device control/data  registers mapped to CPU
  address space

Even, after googling "mapping", I got the article
Map_(higher-order_function), but it wasn't very clear to me.
Even more, tried to understand the meaning in the context of bitmap by
reading the Wikipedia article:


  A bit array is a mapping from some domain (almost always a range of
  integers) to values in the set {0, 1}


I'm not sure, but in the context above it sounds to me about data
conversion.
Later after reading a CS book, I found only
this paragraph but it didn't explain the meaning of "mapping" for
me:


  Memory Mapping Linux (along with other forms of Unix) initializes the
  contents of a virtual memory area by associating it with an object on
  disk, a process known as memory mapping.

I got also MapReduce as a search result: where map is explained as "an idiom in parallel computing
where a simple operation is applied to all elements of a sequence,
potentially in parallel".


I'm still confused about the term. Can anyone explain what does "map" mean in the contexts I mentioned?
So, there are two distinct uses of the word "map", that I'll unpack here.


The first is very generic, where map means "to associate," particularly by way of a function. If we say "$f$ maps each $x$ to $2x$", then we're saying $\forall x \ldotp f(x) = 2x$.

This usage includes "memory mapped IO:" there is a (conceptual) function associating each piece of memory with a particular IO action. Nobody actually ever writes out the function, but it is indeed there: for each piece of mapped memory, there's some IO associated with it. Maybe a part of a disk, maybe a hardware register on a peripheral, etc.

Likewise, bit arrays (and arrays in general) fall into this: each index has a single element associated with it (at any given time), so an array is effectively an encoding of a finite-domain function.
In functional programming and derivatives (such as MapReduce), map refers to applying a transformation across a structure.

The original map comes from Lisp, where it referred to the function that took another function and a list, and returned the result of applying the function to each element of that list.

But, this phenomenon is quite general. In Haskell, a data structure that admits such an operation is called a functor, and the operation is called fmap (for historical reasons, to avoid conflicts with the list map).

These all are related through the concept of a Functor from category theory, which is an abstraction of structures admitting a "map" operation.