Why does the Windows registry exist? [closed]
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this questionthis is more OS architecture question than programming directly, but still. Why was the Windows registry created as a completely separate subsystem for storing system/application settings? In *nix OS'es there is /etc directory which is perfectly understandable, as filesystem is a natural hierarchical way for storing settings, while Microsoft decided to create a completely outside hierarchical subsystem, which seems to be a foolish investment, why didn't they just use a filesystem hierarchy?
- Centralized - which is useful for roaming profiles.
- Transactional - which makes it harder to smash your configuration.
- Security - You can enforce read/write with better granularity than a file (per-key/value).
So that when the binary registry gets corrupted, you'll just give up and go buy the newest version of windows for a fresh install.
This article discusses INI files vs registry: https://devblogs.microsoft.com/oldnewthing/20071126-00/?p=24383.
- Each application doesn't have to reinvent a config file format
- You can easily use the registry in kernel mode code
As mentioned in the Old New Thing article cited by Bastien:
- The system can handle concurrency issues for you
- You can ACL registry keys
I would also mention that many *nix frameworks have reinvented the registry... Like gconfd on GNOME.
Also, file system granularity: one cluster for each value is a bit to much, so you need to make a tradeoff where the file system ends and the settings file starts. That of course doesn't give you a consistent API. So why not pull all settings into a few key files, and give you a consistent API to access it? BAM - registry.
(And since MS generally considers API more importantthan format, it's no surprise the files are opaque)
[Raymond Chen voice]Remember, it was designed for computers where 4MB of RAM was plenty.[/Raymond Chen voice]
The idea is to have all settings for all programs stored in one single place instead of having them spread all over your disk.
They did it, I believe, to support a separate setting for each login user. In Unix, there's a concept of home directory, while none in Windows.
For starters, it's quicker to read and write to the registry during the course of a user session.
It created a single point entry for the entire system's application configuration control. It would have been a nice usecase for an embedded network database (e.g. Raima used by Rational) or a text database (Bernstein's cdb).
精彩评论