*

Windows Architecture Series: Part 2

Don't try to read this (or any of the instructor ramblings to follow) if you're tired, please :-) It's not the most exciting stuff in the world. I suppose I could liven it up a bit by throwing in random spy novel snippets, but that could obfuscate the meaning and utterly defeat the purpose. The fun part of discussing Windows Architecture is that it all needs to be explained concurrently; given the limitations of most human beings that's not going to happen, at least not this year. So, occasionally, ok, frequently, an explanation may, ok, will, have certain underlying assumptions of knowledge that you'll gain later on. Please always feel free to ask questions if something is unclear.

[Imagine there's a cute little trumpet icon here that if you click it will blare the cavalry charge tune...]

In discussing Virtual Memory, we need to start first with some terms and their definitions. First is "process". I'll quote from the Win32 SDK:

A process is a program that is loaded into memory and prepared for execution. Each process has a private virtual address space. A process consists of the code, data, and other system resources - such as files, pipes, and synchronization objects - that are accessible to the threads of the process. Each process is started with a single thread, but additional independently executing threads can be created.

Whoa! Duude! Huh?? Pipe? Thread? Sychroni-whosit?

Don't worry about the pipes and sychronization objects quite yet. Here's the formal definition of thread:

A thread can execute any part of the program's code, including a part executed by another thread. Threads are the basic entity to which the operating system allocates CPU time. Each thread maintains a set of structures for saving its context while waiting to be scheduled for processing time. The context includes the thread's set of machine registers, the kernel stack, a thread environment block, and a user stack in the address space of the thread's process. All threads of a process share the virtual address space and can access the global variables and system resources of the process.

Again, don't worry right now about structures and registers and stacks. You've just been introduced to two objects (everything is an object, by the way): the process and the thread. The thread cannot exist without the process. The process cannot exist without a thread. The CPU doesn't talk to processes, only to threads. We'll return to threads another evening when we discuss preemptive multi-tasking - just kind of put them in the back of your mind for tonight.

Now, getting back to the process definition... If you are running Windows NT/2000/XP you can catch a glimpse of processes by bringing up the Task Manager (right click on the task bar - it's the second command from the bottom). The process list is located on the middle tab. This would be a good time to notice that there is not a one for one relationship between the Applications and Process lists. (Those of you with Windows 95/98/ME can see a list of applications by doing a Control-Alt-Delete, but you cannot see a list of processes. Microsoft figures this might scare you, I guess.)

With the Task Manager open, start up a simple application/program like the Calculator (calc.exe). A simple program does have a one to one application/process relationship. You can see the calc.exe listing on the process tab. Now, start up VB6. At least on my machine, I get two processes: vb6.exe and apiload.exe, probably because I have the API Viewer Add-in set to load on Startup. If you have an anti-virus program like Norton you'll see that it has several processes associated with it. Applications/programs spawn at least one process, but may have more than one. A process has to belong to an application/program. That application/program might be running hidden, without a user interface, or in the System Tray and, hence, not show up in the Application list, though (like Norton AV).

So, hopefully that makes the term "process" a little clearer, at least the basics of it.

But what about that "private virtual address space"? Since the hour is late, we'll save the Tale of the Mythological 4GB Address Space for tomorrow....



Internet Content Rating Association Valid CSS!

Alrak's Course Resources ©2002-2007 Karla Carter. All rights reserved. This material (including, but not limited to, Mini-lectures and Challenge Labs) may not be reproduced, displayed, modified or distributed without the express prior written permission of the copyright holder. For permission, contact Karla.