Writing is the process of recording characters on a medium, with the intention of forming words and other larger language constructs. The instrument or instruments used for recording, and the medium on which the recording is done can be almost infinite, and can be done by any instrument capable of making marks on any surface that will accept them; writing has even been done at nearly the atomic level. Writing can be done even on a grain of rice. The durability is often very good, but very volatile is e.g. writing in the sand; writing on a blackboard is also for short-term use and often erased after some minutes or hours.
Writing is also often used to describe the craft of creating a larger work of literature. This is an extension of the original meaning, which would include the act of writing longer texts. (Interestingly, if this is done on a typewriter, the physical act of making the marks on the paper in the typewriter would be called typing, whereas the intellectual activity involved in generating the letters, words and sentences would be called "writing".) Writing in this sense can refer to the production of fiction, non-fiction, poetry and sometimes letters.
Most of time, writing aims to produce works that are target of reading.
Typically, however, one will use a writing utensil (such as a pen or pencil) to write characters on paper; or a computer (or typewriter) to record characters to disk, (electromagnetic tape, CD-ROM, or other computer medium on which information can be recorded). The use of pen and paper has historical primacy, and one could argue that the second is merely analogous to writing. Still, as commonly used, writing refers to recording visual characters on physical or electronic media.
In the western world, this means putting characters together to form words and sentences. In cultures using ideograms, each character used represents a word or concept, and can then be put together with others to form sentences.
Writing is believed to have originated by the simple drawing of ideograms: for example, a drawing of an apple represents an apple, and a drawing of two legs may represent the concept of walking or standing. From this origin, the symbols become more abstract, eventually evolving into symbols which seem unrelated to the original symbol. For example, the letter N in English is actually from an Egyptian hieroglyph representing the same sound, but depicting waves in water - the Egyptian word for water contains only one consonant /n/, and the picture eventually came to represent not only the idea of water, but the sound /n/ as well.
Writing with the intent to communicate has been viewed spontaneously in non-humans. Work with the bonobos Kanzi and Panbanisha in the United States has provided one such example. The examples which occur are very few, but the origin of bonobo "writing" seems to be analogous to the origin of human writing.
An exception to the general rule that writing is an attempt to communicate is the writing in unknown scripts or languages alleged by mediums to be communicated to them by ghosts, spirits, or other, generally supernatural or extraterrestrial entities. This technique is known as automatic writing.
Writing that blends meaning and transcription is called constrained writing.
Sometimes writing is done in invisible ink that can be later decoded, if the message is intended to be secret and only for the recipient or recipients.
Rarely, "writing" is used to refer to the making of marks using various methods, that is not, strictly speaking, writing, as in the "indecipherable writing" (a type of surautomatism) developed by the Romanian surrealists; "indecipherable writing" is actually more akin to what would commonly be described as drawing or painting than writing.
The borderline between prehistory and history is usually taken to be the time from when we have written records. The importance of writing for history and record keeping comes from the fact that it allows information to be stored and communicated across generations, in addition to between individuals (as language enables.)