February 10, 2010

A Nerdy Post on Programs

Filed under: Main — admin @ 12:01 am

Here I go! Off the deep end! Prepare to flee in terror from this blog post, because I’m going to be talking about how programs work on a computer. Not how to work a program, but what happens when the operating system takes a program from the computer’s mass storage system and tosses that code into computer memory.

Are you still there? Weird. I thought most people would be off to Stumble Upon by now, playing that cool game with the little guy sliding down the lines you randomly draw. Anyway.

One of the operating system’s primary duties is to run software, the programs you have installed on your computer. Like everything else, programs are stored on the computer’s mass storage system, typically the hard drive.

(I’m moving away from referring to long-term computer storage as “the hard drive” or “on disk” as not all computers have disk drives these days, and in the future everything will be solid state.)

The operating system takes a program from mass storage, then transfers that data — the raw program code — into the computer’s short-term storage, or memory. Once loaded into memory, the operating system then passes computer control over to that program. That’s the bare bones description.

There are two types of programs in the Windows world: image and executable.

An image program file is the older kind of program file that DOS used. The filename extension was COM, but BIN could also be used. (Though DOS wouldn’t run a BIN file directly from the command prompt.)

COM stands for Command. BIN for Binary.

COM files were exact images of the code, simply plopped down into memory by the operating system. After loading, the operating system passed control to the program, starting at a certain offset (100 hex) in memory. At that point, the program ran — or not, whatever the case would be.

COM programs were tiny and tight. At most they could only be 64K in size. Obviously you can see that would be an issue for any advanced program, such as, well, anything.

The executable program files sported the EXE filename extension, which stands for executable. Unlike COM files, EXE files could be huge. (excel.exe weighs in at over 19MB.)

EXE program files contain binary information, but they also contain a loader that tells the operating system where to place the program in memory. That way, the program can be laid out in larger swaths and use memory more effectively and efficiently than the older COM programs.

Today, Windows uses EXE files as the primary program file format and filename extension.

Over in the Unix world, program files are not known by their filename extension, but rather by their attributes. That’s a whole ‘nuther worm I’ll probably write about someday when I’m feeling nerdy again!

2 Comments

  1. That’s neat, something new I’ve learned that when I talk about it, no one will have any idea what I’m talking about! Well except for the vintage computer folk.

    I’m bound to bring something offtopic in here… this time it’s a small story about SkiFree ._.
    http://www.beige-box.com/skifree.txt

    Comment by linuxlove — February 10, 2010 @ 8:43 am

  2. It’s nerdy stuff, but the more you learn about your computer the more you’ll be happy as a computer owner.

    Comment by admin — February 10, 2010 @ 5:01 pm

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.


Powered by WordPress