Memory & Hard drives

Bozo

Storage? I am Storage!
Joined
Feb 12, 2002
Messages
4,396
Location
Twilight Zone
When a file or program is opened, is it copied from the hard drive into memory, or is it removed from the hard drive and placed into memory (cut-n-paste)? Or a combination of both?
 

ddrueding

Fixture
Joined
Feb 4, 2002
Messages
19,511
Location
Horsens, Denmark
Depends on a lot of stuff. The typical is that it is copied from the disk to memory, then messed with, then it overwrites the one that was sitting there.

Of course, all kinds of things can affect this.
 

Fushigi

Storage Is My Life
Joined
Jan 23, 2002
Messages
2,890
Location
Illinois, USA
Programs are always copied. In fact, there's no guarantee the entire program is ever read into memory as the OS may page in the portions that are needed as they are called for.

Data files are usually opened. Which means the program can read and optionally write to the file (there are usually a read-only open and a read/write open commands). Nowadays, what happens with an open data file will vary:

- Some will copy the file via a read-only open to a temp file that has read/write access, do the manipulation on the temp file, and when the file is closed will delete the read-only version and rename the read/write version to the original file name. I'm not sure of any apps that do this but the tell-tale would be a temp file of similar size to the main file.
- Some will also use a temp file but will write net changes to it. When the file is saved/closed the changes in the temp file are incorporated into the main file. I think Word does this as it's temp files are small.
- Some will read in the file, operate on it in memory, and write out the changed file when it is saved/closed (and possibly periodically as well). I think Excel does this since I haven't noticed a temp file that matches an open file (though I haven't look hard for one).
- Some will manipulate the data file directly, applying changes as they are made. This is normally true with the data files can grow to be large and other forms of manipulation have distinct performance penalties. Most database apps do this. Hopefully they maintain a separate net change or transaction file (SQL Server does a log file, for instance).
- I've not heard of any app that actually reads the file & deletes it then writes an entirely new file upon saving. Not that it wouldn't happen but it'd be a poorly designed app since the data file would be lost if the machine were to lock up or reboot without warning.
 

LunarMist

I can't believe I'm a Fixture
Joined
Feb 1, 2003
Messages
16,624
Location
USA
PS does nothing with an open file until it is saved. I know that much.
 

Stereodude

Not really a
Joined
Jan 22, 2002
Messages
10,865
Location
Michigan
IMHO Gimp will drive you nut if you've ever used Photoshop. They made it similar enough that you expect it should behave in the same way as Photoshop, but it doesn't.
 

Mercutio

Fatwah on Western Digital
Joined
Jan 17, 2002
Messages
21,563
Location
I am omnipresent
I don't need to edit photos in ways that photoshop edits them. I'm fine with Gimp or f-spot, or Paint.net or Picasa on Windows.

Also I think Adobe's products are satan's playthings and won't install any of them.
 
Top