16
Page 1 of 16 How Does Software Work Together With Hardware ? Is this book for you or Not? 1. If you have installed an operating system (Windows XP, Windows 2000, Windows Server 2003, Linux, etc) on a computer a few times in the past and you just Don’t understand why you really had to install the operating system or you're just curious on how that operating system fits within the whole computer, this book is for you. 2. If you have installed many applications/programs on your computer previously and you just could Not understand exactly how those applications fit in with the whole computer or maybe you want to know why some of those applications totally refused to be installed in your computer, this book is for you. 3. If you’ve had trouble installing a piece of hardware on a computer, or if you have struggled to understand why a piece of hardware did Not work after you connected it into your computer, this book is for you. 4. If you have attempted to write or develop computer programs and you just could Not figure out or understand exactly how your programs actually fit into the whole computer, this book is for you. 5. If you’ve Never done any of the above, this book is definitely Not for you ! If all you do on the computer is to type documents in Microsoft Word/Excel/PowerPoint, or you just Play Games and browse the Internet and send Emails, then this book is definitely Not for you ! But you can still read it (Nothing stops you if you dare). Multitudes of people have been greatly confused about exactly how Software and Hardware work together. I can assure you that a lot of people can use software and probably hardware too, but most of them actually Don’t have a clue how these two things work together ! For most people it’s just an everyday mystery in a black box. I believe the problem is in the way that some books try to explain this subject. Normally the way in which software and hardware work together is Not pictured properly or it is pictured in a way that’s based on some logical imagination ! This can lead to a very confusing and controversial understanding on the learner’s part. Even if you are a logical thinker, you still need to paint a picture that shows how things work in a Physical Way. Today you will learn how these two things actually work together (hardware and software) both in the logical sense and a physical perspective too. I am going to clarify all the confusions and dispel all the myths that you may have already experienced from learning this subject in another book. Enough said. Let’s begin. Look at this picture below. If you turn your head slightly at 90 Degrees and look from the User down to the Hardware, what you should realize is that each element is on Top of Another Element. This is a stack of Layers. The User is on top of the Applications. The Applications are on top of the Operating System. The Operating System is on top of the Drivers and BIOS Programs. And Finally the Drivers and BIOS Programs are on top of the Hardware. The Hardware itself appears to be at the Lowest Level. They say a picture says a thousand words. Just take a minute and look at this picture carefully, study it and get it into your mind. Operating System The OS is Software. The OS normally sits on a Bootable Hard Disk or on a Bootable CD or Bootable Floppy and it gets loaded into RAM by the System BIOS Program when the system reaches a point where it must Boot. Applications Applications are Software. They sit on a Disk (any kind of Disk or Storage Media). They get loaded into RAM by the OS whenever they need to be Run. Information Flow, The User and The System, (Logical View) Copies of BIOS Programs BIOS Programs normally copy themselves from BIOS Chips into RAM before they start Running. Drivers Drivers are Software. They normally sit on the Hard Disk or Boot Disk and they get loaded into RAM by the OS when the system is Booting. HARDWARE A chip on a motherboard or on an Add-on adapter is a very good example of Hardware. But the word ‘Hardware’ also applies to big things like a Screen, Hard Disk, Network Adapter, Processor, Keyboard, Mouse, DVD Drive, Motherboard, Etc. BIOS Programs BIOS Programs are actually Part of the Hardware! They are Not a Standalone piece of Software that you can get on a Floppy Disk or on a CD! They are built into a chip and the chip itself is actually Hardware! The User It's a very simple picture. The arrows show that information can flow from The User step by step down to The Hardware and that information can also Flow Back from the hardware step by step upwards to the user. You might need to photocopy this picture or cut it out of this page and keep it on the desk next to you as you continue reading because I guarantee you that you will need to keep referring to this picture as we go along ! There's No way that you'll understand me properly if you simply look at this picture now and think you've seen it and that you Don't need it anymore. If you find that something I say later on is difficult to understand, your problem will probably be that you've forgotten the picture ! Everything that I will talk about later on will force you to keep coming back to this page to refer to this picture because almost this whole book is about this picture ! I want us to refer to this picture as a Logical View of Information Flow, The User and The System. The reason I want us to call it "Logical View" is because later on I want to dismiss this picture completely and talk about another view of this whole thing ! The other view that I will talk about later on is the Physical View. Many writers tend to forget that a Logical View does NOT show the actual or physical way in which information flows between the user and the various system components ! This has led to many people being

How Software And Hardware Work Together v1.2

Embed Size (px)

DESCRIPTION

Hardware And OS - How Software And Hardware Work Together v1.2

Citation preview

Page 1: How Software And Hardware Work Together v1.2

Page 1 of 16

How Does Software Work Together With Hardware ?

Is this book for you or Not? 1. If you have installed an operating system (Windows XP, Windows 2000, Windows Server 2003, Linux, etc) on a computer a

few times in the past and you just Don’t understand why you really had to install the operating system or you're just curious on how that operating system fits within the whole computer, this book is for you.

2. If you have installed many applications/programs on your computer previously and you just could Not understand exactly how those applications fit in with the whole computer or maybe you want to know why some of those applications totally refused to be installed in your computer, this book is for you.

3. If you’ve had trouble installing a piece of hardware on a computer, or if you have struggled to understand why a piece of hardware did Not work after you connected it into your computer, this book is for you.

4. If you have attempted to write or develop computer programs and you just could Not figure out or understand exactly how your programs actually fit into the whole computer, this book is for you.

5. If you’ve Never done any of the above, this book is definitely Not for you ! If all you do on the computer is to type documents in Microsoft Word/Excel/PowerPoint, or you just Play Games and browse the Internet and send Emails, then this book is definitely Not for you ! But you can still read it (Nothing stops you if you dare).

Multitudes of people have been greatly confused about exactly how Software and Hardware work together. I can assure you that a lot of people can use software and probably hardware too, but most of them actually Don’t have a clue how these two things work together ! For most people it’s just an everyday mystery in a black box. I believe the problem is in the way that some books try to explain this subject. Normally the way in which software and hardware work together is Not pictured properly or it is pictured in a way that’s based on some logical imagination ! This can lead to a very confusing and controversial understanding on the learner’s part. Even if you are a logical thinker, you still need to paint a picture that shows how things work in a Physical Way. Today you will learn how these two things actually work together (hardware and software) both in the logical sense and a physical perspective too. I am going to clarify all the confusions and dispel all the myths that you may have already experienced from learning this subject in another book. Enough said. Let’s begin. Look at this picture below. If you turn your head slightly at 90 Degrees and look from the User down to the Hardware, what you should realize is that each element is on Top of Another Element. This is a stack of Layers. The User is on top of the Applications. The Applications are on top of the Operating System. The Operating System is on top of the Drivers and BIOS Programs. And Finally the Drivers and BIOS Programs are on top of the Hardware. The Hardware itself appears to be at the Lowest Level. They say a picture says a thousand words. Just take a minute and look at this picture carefully, study it and get it into your mind.

Operating System

The OS

is Softw

are. The OS

normally sits on a

Bootable H

ard Disk or on a B

ootable CD

or Bootable

Floppy and it gets loaded into RA

M by the S

ystem BIO

S

Program

when the system

reaches a point where it

must B

oot.

Applications

Applications are S

oftware. They sit on a D

isk (any kind of D

isk or Storage M

edia). They get loaded into RAM

by the O

S w

henever they need to be Run.

Information Flow, The User and The System, (Logical View)

Copies of B

IOS

Programs

BIO

S P

rograms norm

ally copy them

selves from BIO

S

Chips into R

AM

before they start R

unning.

Drivers

Drivers are S

oftware. They

normally sit on the H

ard Disk

or Boot D

isk and they get loaded into R

AM

by the OS

w

hen the system is B

ooting.

HA

RD

WA

RE

A chip on a m

otherboard or on an A

dd-on adapter is a very good exam

ple of H

ardware. B

ut the word

‘Hardw

are’also applies to big things like a Screen,

Hard D

isk, Netw

ork A

dapter, Processor,

Keyboard, M

ouse, DV

D

Drive, M

otherboard, Etc.

BIO

S Programs

BIO

S P

rograms are actually

Part of the H

ardware! They

are Not a S

tandalone piece of S

oftware that you can

get on a Floppy Disk or on

a CD

! They are built into a chip and the chip itself is

actually Hardw

are!

The User

It's a very simple picture. The arrows show that information can flow from The User step by step down to The Hardware and that information can also Flow Back from the hardware step by step upwards to the user. You might need to photocopy this picture or cut it out of this page and keep it on the desk next to you as you continue reading because I guarantee you that you will need to keep referring to this picture as we go along ! There's No way that you'll understand me properly if you simply look at this picture now and think you've seen it and that you Don't need it anymore. If you find that something I say later on is difficult to understand, your problem will probably be that you've forgotten the picture ! Everything that I will talk about later on will force you to keep coming back to this page to refer to this picture because almost this whole book is about this picture ! I want us to refer to this picture as a Logical View of Information Flow, The User and The System. The reason I want us to call it "Logical View" is because later on I want to dismiss this picture completely and talk about another view of this whole thing ! The other view that I will talk about later on is the Physical View. Many writers tend to forget that a Logical View does NOT show the actual or physical way in which information flows between the user and the various system components ! This has led to many people being

Page 2: How Software And Hardware Work Together v1.2

Page 2 of 16

confused about how exactly things happen inside the computer when they do something on it. So I want you to keep in mind that this is a Simplified Picture based on the Logical Way in which people normally imagine things. It is NOT the actual or correct way in which information actually flows between the user and the system. The dotted lines show us something very surprising. The dotted lines show us that information can also flow from the User straight to the BIOS Programs and also backwards from the BIOS Programs straight to the User. This way of thinking is normally taken for granted by many writers ! As I continue to explain later on, you will see exactly why this kind of information flow is possible. Let me make it even harder for you to believe me: How about if I say to you that Information can also flow from the User to the Hardware directly and also back from Hardware to the User directly ! Yes, that's perfectly possible. I know a lot of people might disagree with me on this view, but I will prove it beyond doubt that it's possible, as you will see later on. Alright, let's continue. As I discuss in detail about each layer below, you will find that I frequently keep mentioning how a layer talks to the two layers that are closest to it. For example, I will NOT just mention how the Drivers work and what they do. I will actually explain how a driver talks to the two layers that are closest to it (the Operating System and the Hardware). When I talk about the Operating System, I will similarly explain in detail how it talks to the two layers that are on both sides of it (the Applications and the Drivers or BIOS Programs). So Don’t be lost in the book when we go deeper in later ! COMPUTER USER (Person) The Computer User or Person appears as the highest layer in this whole thing. You are the computer user. As the user, you are Not actually part of the computer. I am simply putting the user in the picture to help you understand how a person fits into the design of a computer. That's just the way I prefer to think of it. So according to this way of thinking, there is actually Five Layers, starting from the User at the Top going down to the Hardware at the Low Level. As a computer user, you work with applications by clicking on them with a mouse or typing on them with the keyboard. APPLICATIONS When we are looking inside the Computer, this is the highest layer. This is the top-most thing on the computer. An application normally takes information from the user (from You) and passes it down to the Operating System. It also does the same job in reverse; it takes information from the Operating System and passes it upwards to the user. You just see on the screen and read what the application is saying or displaying to you. If the application wants something or some information from you, it will prompt you to Enter that information. You will normally use a Keyboard or Mouse or any other Input Device to Enter the information it wants. It will then take that information and pass it to the Operating System. If you are reading this book on a computer screen right now, then this kind of thing is probably happening right now ! The application is showing or displaying information to you. This information or book that you're reading right now had to pass through the Operating System first. This book is probably stored on a disk somewhere in your system. The disk is Hardware. When you opened this book, the operating system had to fetch it from the disk and pass it to the Application. As you can see from the picture, the operating system probably had to use a Driver (or maybe a BIOS program) in order to fetch the book from the disk. Applications are programs that are written to run on top of a specific operating system (eg: there’s applications for Windows XP/2000, Windows 98, Windows NT, Linux, FreeBSD, BeOS, Macintosh OS, Sun Solaris, etc). Normally a Linux application will NOT work on Windows or on Macintosh OS ! An application is also commonly known as a program. When you are using Windows Explorer to explore/browse your computer, you will frequently find files whose names end with .EXE or .COM or .DLL or .BAT. If none of the files in your Windows Explorer have names that end with a .EXE, then you may need to fix your folder/view settings and Enable File Extensions to be shown. These files actually contain programs. On other operating systems (Non Windows-like) applications/programs will Not necessarily be contained in the same kind/type of files such as .EXE or .COM or .DLL ! Assuming that you are running the Windows XP/2000/98 OS, when you find an .EXE file in Windows Explorer and you double-click it, you are actually running the program. In fact, you are telling the OS to load the program into RAM and to let the program begin executing/running. You could also go onto the MSDOS Prompt window and go to the directory that contains that same .EXE file and then you type the name of the .EXE file and hit ENTER . . .exactly the same thing should happen, the OS will load the program into RAM and let it begin executing/running. All modern operating systems today come with a lot of Free Built-in Applications. Some people then get confused by thinking that these free built-in applications are Not applications anymore ! The truth is that the free applications that come built-in with the operating system are still just applications. For example, Microsoft Windows XP is an operating system and it comes with lots of free built-in applications such as:

- WordPad - Notepad - Calculator - Windows Media Player - PaintBrush - Solitaire - Picture Manager and Many others.

When you work on the computer, normally you are clicking or typing. The thing that you are talking to as you’re clicking or typing is normally an application. You Don’t actually talk to the operating system directly. You know it’s there, but you Never talk to it directly. You normally just click on the application (windows, dialog boxes, menus, etc) or you type on the application (command prompt, text boxes, password boxes, etc) and that’s all you do. You (as the user) when you’re clicking and typing, you are sending information to the application. The application will then pass that info further down (to the Operating System / OS) and the OS passes the info even further down until the info actually reaches the proper hardware/place that you want to use or access. When there’s something or some info coming back (coming upwards) from that hardware/place, it will go through the same layers from the bottom upwards. You will just see the info popping up on the program/application in front of you. This whole process usually happens very quickly, normally within milliseconds !

Page 3: How Software And Hardware Work Together v1.2

Page 3 of 16

But what if the application that must receive the information from the operating system is NOT running ? How will the operating system handle this situation? How will it pass information upwards to an application if that application is Not running? Well, I think the answer to this questions is simple: The information will be discarded. I think the operating system will ask all running applications if any one of them wants this info. If None of the applications says Yes, then the operating system will simply throw away ALL that information, nothing wrong or bad should happen on your computer. The information will go up through the layers until it gets to the operating system and then the operating system will have Nowhere to send this info further, so it will just have to quietly throw it away. Let's just pray that your computer will NOT crush ! OPERATING SYSTEM The Operating System is the layer that sits just below the applications. When the OS receives information from an application, it will pass that information to the appropriate Driver or BIOS program. Normally there are many drivers in your system. Each driver is designed to help the OS to reach a certain piece of hardware or device in your computer. The driver itself is a layer that's just below the operating system. The driver will then pass the info further down to the actual piece of hardware in your system and something should happen on the computer (for example you might see or notice something happening on the Disk, on the Screen, on the Printer, on the Floppy Drive, on the CD-ROM, or you could hear a Sound from the sound adapter if you have some speakers connected to your sound adapter). The operating system itself is actually just a group of files (or a group of Programs) that are written by very clever programmers. For example; Microsoft Windows XP is an operating system. The Windows XP OS is made up of the following programs/files:

- NTLDR - NTDETECT.com - Winlogon.exe - Services.exe - Lsass.exe - Svchost.exe - Spoolsv.exe - Cisvc.exe - and a few others

In a similar manner, the Linux OS is typically made up of the following programs/files: - /linuxrc - /sbin/init - /etc/inittab - /etc/rc.d/rc.sysinit - and a few others

An operating system is written/created in such a way that it helps applications to talk to drivers by passing the information from the applications down to the drivers and also by passing information from drivers backwards/upward to the applications. This is Not a very easy job. Applications can be written by anyone who knows how to program computers. This means that the Operating System must be able to understand what an application wants, even if that application is written by You. This makes it very difficult to create an Operating System. If an application is written by someone who is Not very experienced in computer programming, there is a chance that his application might ask the OS to send information to a driver which does NOT exist ! This can cause the OS to hang or to struggle looking for the driver. There is also a chance that his application might ask the OS to send information to a WRONG driver ! Obviously the driver will NOT understand the information ! When the OS gets the info from the application, it will just pass the info down to that driver, but the driver might cause the system to hang or the system might even crash because the driver will be struggling to understand the info ! So applications have to send information to proper drivers and that information must look good. The info must appear in the format that the driver expects. If the info is corrupt or mixed up or if it's Not in the proper format expected by the driver, there's going to be a problem ! This brings us to the topic of Interfaces and Standards. Those who make Drivers must understand FULLY how a specific OS works. When you make drivers for the Microsoft Windows XP OS, you have to study and understand a Driver Interface Specification for Windows XP. The creators of the Windows XP OS must specify how Windows XP (the OS) talks to a driver. They must specify how Windows XP sends information to a driver and how it receives information back from a driver. Another way to say this: The makers of the OS must specify how their OS opens a driver, how it Writes to a driver and how it Reads from a driver. This makes it easy for the makers of a driver to make a driver that will behave properly when it's installed inside that OS because at least they can know beforehand how that OS expects a driver to behave. If you read this paragraph properly, you will realize that a driver for one OS will therefore NOT necessarily work on another OS. A driver for Linux will Not work on Windows XP or on the Sun Solaris OS. Normally drivers are created in a very strict manner, a driver for Linux will NOT even allow you to install it on Windows XP ! But I know there's a small chance that the same Driver might work on Two operating systems if those operating systems are VERY SIMILAR. Examples of similar operating systems are:

• FreeBSD is similar to: NetBSD, and OpenBSD • RedHat Linux is similar to: Mandrake Linux, Suse Linux and SCO Unix • Windows NT is similar to: Windows 2000, and Windows XP • Windows 95 is similar to: Windows 98

In the same way as the driver and the operating system, there are Rules between all the other layers on the picture above. Just like in the case for the driver, the makers of the OS must further on specify how the OS expects an Application to behave. These rules are known as the Application Programming Interface (API). The API basically contains rules about how an application must behave when it's talking to the OS. The API tells the makers of applications how the OS talks to an application. It tells them how the OS sends information to an application and how it receives information back from an application. Another way to say this: The makers of the OS must specify how their OS opens an application, how it Writes information to an application and how it Reads information from an application. This makes it easy for the makers of an application to make an application that will behave and work properly when it's installed inside that OS because at least they can know beforehand how that OS expects an application to behave. If you read this paragraph properly, you will realize that an application for one OS will NOT necessarily work on another OS. Just as I said in the paragraph above about drivers, an application that's written or created for the Linux OS will Not run/work on Windows XP or on the Windows NT OS. Normally such an application will NOT even allow you to install it on Windows XP ! But I know there's a small

Page 4: How Software And Hardware Work Together v1.2

Page 4 of 16

chance that the same Application might run on Two operating systems if those operating systems are VERY SIMILAR. Examples of similar operating systems are the same as those that I mentioned in the previous paragraph. Is it really necessary for a Layer to Send or Pass ALL information to the two layers next to it? Is it really necessary for a Layer to Receive information from the two layers next to it? The answer to both of these questions is NO. When the OS receives information from the application, it does Not always have to Send or Pass that information down to the Driver ! Normally each piece/block of information that passes through the layers will have an Address which clearly says where the info must be sent. The piece/block of info will have something in it that says: “Please send me to this place” or maybe something like: “Please send me to this address”. The address contained in the info clearly tells each Layer whether the info should be Forwarded/Passed further up/down to another layer or whether it should be Handled. For example: If the information is coming from an application and it is addressed to the OS, then when the OS receives it, it will first check whether this info is addressed to itself. If the information is indeed addressed to the OS, then the OS will have to Handle the information. The OS should NOT actually pass the info further down to a driver or any lower layer because then a Driver will NOT know how to handle that info because the info was meant to be handled by the OS itself. The info is Addressed to the OS. I think this technique is known as Inter Process Communication. This means that information can flow from the Application to the OS and when the OS receives the info it will first check whether the info is actually addressed to itself. If the info is indeed addressed to the OS (or anything or any component on the OS layer), then the info will NOT flow any further past that point. The OS will fully handle the info and send back the answer to the place/layer where the info originally came from. The answer might be a message such as: “The job you requested me to do was done Successfully, Here is the Results, Thank You” or it might be a negative reply such as: “Error, sorry the info you sent me is NOT understandable to me, the problem is Bla Bla Bla, Please fix the info and send it to me again!”. But if the info is Not addressed to the OS or anything on the OS layer, then the OS will have to pass the info further Down/Up to the next Upper or Lower Layer. So what I’m basically saying is that it’s perfectly possible for information to flow only half the way down the layers or half the way up the layers. If there is something that can answer or handle the info in any of the layers, the info will just end up in that layer and it will be fully handled and a response/answer will be sent back from that layer to the layer where the info originally came from. Another example: If a piece of hardware sends a request to an application and the request goes up the layers step by step until it reaches the OS, if the OS finds that it can answer that request, then the OS would actually send back the answer to that piece of hardware. As you can see, this means the info/request will have turned back at the OS layer. The info/request will therefore NOT even reach the application. We could continue with this same example a little deeper: Let's say a driver understands the request and it can handle it, the driver will actually send back the answer to that piece of hardware. In this case the info/request will have turned back at the Driver layer. The info/request will therefore NOT even reach the OS or the Application. Let’s look at one last example again in the opposite direction: If an application sends a request to a piece of hardware and the request reaches the OS, if the OS finds that it can answer that request, then the OS might actually send back the answer to that application. This means the info/request will have turned back at the OS layer. The info/request will therefore NOT even reach the Driver or BIOS program or even the hardware itself ! We could continue with this example a little more: If the OS could Not handle the info/request, it would obviously pass the info/request to the Driver. If the driver can understand the request and handle it, the driver will actually send back the answer to the application. This would mean the info/request will have turned back at the Driver layer. The info/request will therefore still NOT reach the hardware. But if Nothing on the middle layers can handle this info/request, then the info is going to end up flowing all the way down. In this case the specific hardware or device will have to handle the info and send back the answer to the application (hopefully!). Of course the answer MUST go upwards back to the application through all the other layers that sit in between, No shortcuts ! I think this technique is also known as Loose Coupling. Loose Coupling basically says “any Layer is allowed to handle the info even if that info was actually meant/addressed to go to something at a Lower or Upper layer“. That’s why it’s possible to have a CD-ROM device showing up in the Device Manager dialog box in your Windows OS when there is actually NO physical CD-ROM device in your system ! You can install a special kind of driver (called an Emulation Driver) in your OS for a device that is NOT physically present in your computer ! It’s perfectly possible. Let's say you've installed a CD-ROM Emulation Driver; the driver will actually emulate a CD-ROM device. It will intercept all requests/info that applications are trying to send to a CD-ROM device and it will handle all those requests and send back perfect answers. The OS and Applications just keep sending their requests to read a CD inside the CD-ROM drive, when these requests reach the emulation driver, the emulation driver will send back proper answers to the applications or OS. It will Not pass the requests further down to a lower layer because there’s Nothing in the lower layer; there’s actually No CD-ROM device in your system ! As you can follow in this example, the answers are Not actually coming from a real CD-ROM device ! The emulation driver is actually fooling the OS and all the applications into thinking that there is indeed a physical CD-ROM device in your system ! What about when many applications need to talk to the OS at the same time? Or what about when many drivers need to talk to the OS at the same time? Or what about when many drivers need to talk to the Hardware at the same time? From what I know, you Cannot run Two Operating systems at the Same Time on your computer ! So there is NO question of what happens when Two Operating systems need to talk to the same Driver at one time ! Secondly, I have Never heard of many separate drivers talking to the Same piece of Hardware at the same time ! Normally the OS only allows you to use One Driver for each piece of hardware in your computer. If you have 2 drivers for the same piece of hardware, then you’ll normally have to choose one of the drivers and stay with it. If you want to use the other driver, then you would have to Uninstall or Disable the first driver. If you do so, many times you will have to restart the system so that the OS can reload. As the OS reloads, it will then load the second/new driver that you have chosen to use. Normally you should NOT need to have two or many drivers for the same piece of hardware ! The only time when you might need to keep 2 or more drivers for the same piece of hardware is when you have installed 2 or more operating systems on your computer. But even in this case, when the first operating system is running, the other/second OS must stay asleep. The only way to activate the other OS is by restarting the computer and choosing to load the second/other OS when the system is booting. When the second OS becomes active, the first OS will have to stay asleep. And even in this case where you have installed 2 operating systems and you keep switching between them, the second OS must have its own set of drivers for ALL the hardware in your computer. You will have to install or make sure that the Drivers for the second OS are installed into the Second OS ! The second OS will probably NOT load nicely if it does NOT have its own complete set of drivers. If the second OS does NOT have its own complete set of

Page 5: How Software And Hardware Work Together v1.2

Page 5 of 16

drivers then some of the devices might appear to NOT be working properly when the second OS is running. The second OS Cannot actually use the drivers that were installed into the first OS, even if the two operating systems are Very Similar. So the only useful questions we are left with are therefore these three:

1. Many applications talking to the OS at the same time. 2. Many drivers talking to the OS at the same time. 3. Many drivers talking to the Hardware at the same time.

Let’s start with the last question, cuz it’s the easiest. As I have explained above, many drivers Cannot talk to the Same Piece of Hardware at the same time. But many drivers can talk to different pieces of hardware at the same time. A driver for a video adapter can talk to the video adapter while a driver for the hard disk is also talking to the hard disk at the same time. In this situation, each driver uses a thing called an I/O Address to access its associated hardware device. Each device is given a unique I/O Address when the system is starting up. The job of giving each device a unique I/O Address is done by the System BIOS program which I will explain in detail later on. After each device has been given its own unique I/O Address, the OS and Drivers will load (the system is Booting), the drivers will then be able talk to their respective devices by using these unique I/O Addresses. This technique of I/O Addresses is very useful because it allows multiple drivers to talk to multiple devices at the same time without confusion or mix ups. Each driver can independently talk to its associated hardware device without touching or affecting other drivers. As I just explained, the info that flows between a driver and its associated device will have a destination I/O Address in it. This address helps to prevent the info from one driver mixing with the info from another driver and then both pieces of info ending up going to the same hardware !

• Each driver only handles information that's addressed to itself. • We also said recently that you Can't have two different or two separate drivers that are both associated with the same device.

They Cannot both operate/run at the same time. One of them will have to be Disabled. If these two statements are true, then just take a moment and think it up in your mind: It means information that's passing through one driver will only end up at the device that is associated with that driver. That info cannot possibly end up going to another/wrong device. Drivers Can't share a single device at the same time, but many separate drivers can run at the same time without any problems as long as each of them is talking only with its associated hardware device. Let’s now look at the second question in the middle. Yes, indeed many drivers can talk to the OS at the same time. All the modern operating systems these days are designed to do their job using a technique called Multi-tasking. Most operating systems these days come with built-in true Multi-tasking capabilities. Long ago when resources were limited Not all operating systems had true multi-tasking capabilities. The MS-DOS OS and the Windows 3.1 OS are good examples of operating systems that are still Not able to do true multi-tasking. Without multi-tasking, when the OS is busy talking to something, ALL the other things/programs that want to talk to it must wait until the OS is free ! This means that if one driver is busy sending a large amount of information to the OS, all the other things that want to talk to the OS at that time would have to wait until that driver is finished. People who lived in the age of No multi-tasking will tell you that this used to cause the OS to appear to be hanging for No reason and then suddenly it would just come back to normal operation again ! Multi-tasking is a good technique whereby the OS never takes too much information from one program. The OS takes only a little amount of information from one program at a time and then it checks whether there is another program that also wants to talk to it at the same time. If there is No other program that wants to talk to the OS, then the OS continues taking more information from the first program until there is No further info to handle. But as soon as another program kicks in and asks to talk to the OS, the OS will temporarily tell the first program to wait a little bit and it will start serving BOTH programs simultaneously. The first program might experience that the OS is slowing down a little, but this should be No problem because at least the OS does Not appear to the hanging for the second program ! As more programs request to talk to the OS, the OS will just keep serving them by splitting the time across all of them equally. The OS will take a little bit of info from one program and pass that little bit of info forward then quickly jump to the next program and take a little bit of info from that program and do the same and jump to the next program and do the same and so on. Don’t forget that a Driver is a Program ! The technique of multi-tasking therefore allows the OS to Receive information from multiple drivers at the same time and to also Send information to multiple drivers at the same time. I hope you can already see that we have answered the question. Let’s now look at the first question at the top. This question is also pretty easy to answer. The answer is actually the same technique, Multi-Tasking ! Multi-tasking happens on both sides of the OS. The OS will do multi-tasking on the Driver’s side and also on the Application’s side. Since Drivers and Applications are both just Programs (even the OS itself is just a program!), the OS handles them in a fairly similar manner. Multiple applications are able to talk to the OS at the same time (just like Drivers) because the OS still uses the technique of multi-tasking even for applications. We know that programs normally come on a disk. But we also know that when a program starts running, it must first be loaded into RAM. The OS loads each program into RAM whenever the program has to start running. Each program when it’s running in RAM it will have its own Address Space. It does Not matter whether the program is a Driver or an Application, each program will have its own Address Space in RAM (even the OS itself has its own Address Space in RAM). This address space is actually a block of memory (a portion of RAM) used to hold the program’s instructions (statements of code) and all the data/information that the program is using. So what I’m saying is that the program itself sits in RAM when it’s running. Over and above this, the program actually uses some of its address space to store temporary values (computer programmers call them “variables”) as it is running. When the OS is doing multi-tasking, it simply jumps back and forth from one address space to another in order to serve the multiple programs that are running or requesting to talk to it. The address spaces in RAM that are used by different programs are therefore very useful because they help the OS to quickly find running applications and jump back and forth from one application to another. Like I said above, many operating systems come with a lot of Free Built-in Applications. Not only do they come with free built-in applications, many operating systems ALSO come with Free Built-In Drivers for many popular or standard devices. The makers of operating systems try their best to supply the operating system with lots of built-in drivers for common and popular standard devices/hardware. For example, a hard disk normally will NOT require that you install drivers for it before it can work. Many operating systems come with built-in drivers for a hard disk. Most modern operating systems today will see and recognize your hard disk immediately after you connect it into your system. There's normally No Need to install any drivers to help the operating system recognize that there is a hard disk in your system. Other good examples of devices that normally Don't need drivers are:

- Floppy Drives - CD Drives & DVD Drives

Page 6: How Software And Hardware Work Together v1.2

Page 6 of 16

- Standard Monitors - IDE Controllers - Floppy Drive Controllers - Standard Mouse - Serial Ports (COM1, COM2) - Parallel Ports or Printer Ports (LTP1) - Processors & USB Ports - PCI Slots and other Bus Slots - Some standard BIOS chips that are mounted on the motherboard.

I need to clarify something about this issue of standard BIOS chips that are mounted on the motherboard. Normally if the BIOS chip that's mounted on the motherboard is a Sound Chip, a Video Chip, a Network Chip or a Modem Chip then it might actually need drivers ! Just because a chip is mounted on the motherboard it does NOT mean it's a standard BIOS chip and that you Won't need drivers for it ! When I say "Standard BIOS chips" I mean only a few simple things like the PnP BIOS chip, the System BIOS chip, the System Clock/Timer chip, the ACPI chip, the IRQ Controller, the DMA Controller and maybe a few others that come mounted on the motherboard. DRIVER The driver is normally software (Files or Programs) that comes on a disk or can be downloaded from the Internet. The driver is actually written/created by the manufacturer of the chip. The chip manufacturer knows exactly what his chip can do and what it Cannot do. He will supply proper drivers for the chip. But he might have to supply drivers for ALL the different operating systems that will use his chip. For example, a chip manufacturer might supply a driver that will allow Microsoft Windows XP or Windows 2000 to talk to his chip, and then he might also supply a driver that will allow the Linux OS to talk to his chip, and then he might also supply a driver that will allow the FreeBSD OS to talk to his chip and maybe another driver that will allow some Other OS to talk to his chip. This is NOT an easy task ! If you are manufacturing chips for computers, how are you going to know which operating systems are there in the world? Well, there's No way you're gonna know of all the OSes that exist in the world. This is why you will find that many chip manufacturers will write down in a manual/booklet that comes with the chip (or the Adapter) they will specify which operating systems are currently supported by the chip. When they say the chip supports a certain operating system, they mean they have already written a driver for that OS and they have tested the driver on that OS and the OS is able to talk to the chip using that driver. Basically it means that operating system is able to send information to the chip (write to it) and receive information from the chip (read from it) using that driver. That's what they mean when they say "this chip or this device supports a certain OS". They simply mean they've created drivers for that OS. If you are Unlucky sometimes you could be running an OS that's NOT supported ! In that case they might say "Linux or Windows NT is NOT supported". If they say a certain OS is Not supported, they simply mean they have Not created drivers for that OS yet. Keep in mind that the operating system makers Don’t normally know how the chip works. Therefore there will be a need for something to sit in between the chip and the operating system. That thing is the driver. In the picture above, let's just remove the driver and see what would happen. If there were No drivers, the makers of the operating system would have to know how every chip in the world works ! But they Don’t make chips! They only make operating systems! So it would be UNFAIR if we said the makers of an OS must make their OS talk to ALL chips that exist in the world today and ALL chips that will be manufactured in the future ! To solve this issue, the OS makers normally publish a document/book known as a Driver Interface Specification which I've already discussed above. In that document the OS makers simply specify how their OS sends information to a driver and how it receives information back from a driver. If you are a device/chip manufacturer, you can then study/use the specification to make drivers for that OS. The document helps the makers of a driver (or the device manufacturers) to make a driver that will behave and work properly when it's installed inside that specific OS because the document clearly tells them how that OS expects a driver to behave. On the other side the driver must know how to talk to the chip/device, but this one is obviously simple and straightforward because the manufacturer already knows his device/chip anyway. Once you have installed a driver in your OS, your OS should be able to send information to the hardware device/chip or receive information back from the device without any problems. The OS will reach the device through the Driver. Normally the driver should be supplied by the manufacturer of the chip or device, but luckily as I've explained above many operating systems come with built-in drivers for popular and common devices, so you Don't have to always download or search for drivers for EVERY device that's inside your system. Usually only some special add-on devices or Unusual chips will need you to have a Driver that comes on a separate disk. Normally Sound chips, Network chips, Video chips, Printers, Digital Cameras, Modems and some Special add-on Devices will come with a disk of drivers that must be installed into your OS. If your OS is Not supported by the device, then the booklet that comes with the device will tell you so. As I have said, a driver is normally written by the manufacturer of the chip, so a driver knows perfectly how to pass information to the chip and how to fetch or receive information back from the chip. The difficult job is on the side of the OS. On the side of the OS the driver must behave properly as the OS expects and it must pass information upwards to the OS in a manner that the OS expects. If you are a device/chip manufacturer, you will therefore have to study a driver interface specification for that specific OS in order to make your driver to work properly with that OS. As you can follow, Drivers are an important layer that allows the OS to talk to a device/chip and to use ALL the power inside the device/chip even if the OS does Not know completely what the device is designed to do. BIOS ROM or BIOS Program This is an area that has confused a lot of people in the past ! You need to read carefully. The BIOS ROM or BIOS Program is actually a small simple Program built into the BIOS chip at the factory where they manufactured the chip. Normally we are used to programs

Page 7: How Software And Hardware Work Together v1.2

Page 7 of 16

coming on a disk (CD, DVD, Floppy, Hard Disk, etc). We Never really think of a computer program hiding or sitting inside a BIOS chip! But a program can actually sit inside a BIOS chip. You Cannot change this program or make it do more things than what they set it to do at the factory! You CAN’T even DELETE this program from the chip! It’s normally a very simple program that can do only Simple/Basic Input and Output operations. For example, it can ask the chip if there is any information that the chip is Receiving from another device, if there is information coming in, then the program would probably Read this information and pass it upwards to the OS. And when the OS wants to send information down to the chip, the same BIOS program will again tell the chip that there is some information that's coming in from the OS. The program would then pass the info to the chip. The chip itself will probably then pass this info to the ports on the adapter or to another device inside your computer. For example: a chip on a video adapter will normally pass information to the Video port and the info would flow out via the Video port to the screen. You will just see the info appearing on the screen. This kind of thing usually happens within milliseconds !! Another example: a chip on your internal modem adapter can receive information from the OS via the Driver (modem driver). In this case, the BIOS program inside that chip will NOT be used, because you have installed a Driver ! But if you did NOT have a driver for the modem adapter, then the BIOS program in the chip on that modem would probably be used. The info would flow straight from the OS to that BIOS program. If we assume that there is a driver, then the info will flow from the OS to the driver and then from the driver down to the chip. The chip will then cause the modem to dial out on the phone line and connect to the internet. That's what would normally happen each time when you connect to the internet ! Another example again: a chip on the network adapter can receive information from the OS (Let's say you have Not installed a Network Driver). Since you Don’t have a network driver, the info will probably flow from the OS to the BIOS program of the network chip. The BIOS program would tell the chip that there is info coming in from above (from the OS). The chip would then prepare to accept the info. The chip will then pass that info out through the port on the network adapter to another computer on the network! One more example: As in the example above, the same port on the network adapter can receive info from another computer on the network. This info would be passed to the chip on the network adapter. The chip would then pass the info to a Driver (if you have installed a network driver) or the info would flow to the BIOS program of that chip. The BIOS program (or Driver) would then pass the info more upwards to the OS and so on ! Last example: a chip on the audio/sound adapter can receive information from the OS (via the Audio Driver). Since you have an audio driver, the info will probably flow from the OS to the driver. The driver would then tell the chip that there is info coming in from above (from the OS). The chip would then prepare to accept the info. The chip will then pass that info out through the Speaker-out port and you would hear the sound on your speakers or stereo headphones! But how does the chip know where it should pass the info to? The answer to this question is "I/O Addresses". Let’s just take a moment and think for a while. There must be some form of addresses that are used when devices talk to one another. And I think the address where the information must go is normally contained inside the information itself. I think the first few bytes in the information actually contain the Address of the Device or Port where the information must go. This address is commonly referred to as the I/O Address. This way the info never goes to the wrong place or gets lost ! The original sender or creator of the info must actually include a destination address inside the info so that when the info starts flowing, it travels in the correct path. This works very similar to the postal system where people use Envelopes. The outside of the envelope must have a full address that says where the Envelope must go. Or maybe it’s NOT addresses that are used; maybe devices just use Unique Labels when they send information to each other. But even in that case, I think something inside the information would still have to say which unique label the info must be sent to. In this way when the info passes from one layer to the next, it does Not get lost or end up at the wrong place! For example, if the OS wants to send information to the Audio Adapter, I think the first few bytes in that information will definitely be the address (or Unique Label) of that Audio Adapter. When the machine is starting up, every Port and Device in the machine will be given its own unique address or unique label so that other devices can talk to it without mistakenly confusing it with something else. For example, if you have Two Network Adapters in your system and they both physically look exactly the same (let's say they come from the same factory), unique addresses/names would be very useful in this case because then other devices or other Layers will Not get confused about which one is which ! For example, when the OS wants to send info to the second one, the info would contain the I/O Address (or Unique Label) of the second network adapter, and this would prevent the info from going to the first network adapter. When you switch on the computer, each of these network adapters would be given/assigned its own I/O Address or Unique Label. Later on when the OS, the Drivers and Applications have loaded, it would then be possible for them to send information to Only One of the network adapters without fearing that the information might end up going to the other adapter by mistake !! The BIOS program is built into the BIOS chip at the factory where they manufactured that BIOS chip. Bear in mind that when you see a chip on an adapter, it Does NOT necessarily mean that the factory where the whole adapter was made is the same factory where the chip itself was also made ! Normally chips come from one factory (for example many chips come from Silicon Valley in the USA) but the Whole Adapter itself might come from another factory (for example many adapters are labelled "Made in China" or "Made in Taiwan" or "Assembled in Malaysia"). The adapter manufacturers normally they just mount (paste) the chip onto a circuit board and connect it with a few other components (Resistors, Transistors, Capacitors) on the circuit board. We can say they “assemble” the adapter out of ready-made components; one of those components will be the Chip itself. The chip will already be having a BIOS program inside it because the BIOS program is built into the chip at the factory where they make the chip, Not at the factory where they assemble/make the adapter ! The adapter manufacturers may also put some ports on the back of the adapter so that you can plug other devices onto the adapter from outside the computer. You might actually come across the SAME chip on different adapters! Yes, it’s very possible. Anyway, let’s come back to the topic of BIOS Programs. As I mentioned earlier on, BIOS Programs are simple programs that are built into the BIOS chip at the factory where they manufactured that BIOS chip. These programs normally can do only Simple/Basic Input

Page 8: How Software And Hardware Work Together v1.2

Page 8 of 16

and Output operations (such as to Read information into the chip and to Write information out of the chip). They can Receive information from a Driver and they can also Send information upwards to a Driver. If a driver had to be created by someone who did Not make the chip, it would be difficult or even impossible for him to really know how the chip works ! He would Not know how to send info from his driver to the chip or how the chip will send info back to his driver ! That's why the best people for making drivers are actually the makers of the chip themselves. Luckily, many manufacturers of chips have published books or programming guides where they fully specify how their chips work inside-out. This means that people who did Not make the chip and those who Don't work at the factory where the chip was made can also help to write drivers for the chip ! By studying these programming guides, some very creative people have been able to write much better drivers than even the drivers that come from the maker of the chip. A BIOS program does the simple job of Input and Output. That's why it's called "BIOS", that's Basic Input and Output System. Input means to Receive information, Output means to Send information. Another way to say this: Input means to Read information in, Output means to Write information out. What if we remove the BIOS program from the picture above? What would happen? Well, unlike the driver, it is indeed possible to bypass the BIOS program completely and have the Driver talk to the hardware directly. But how? This is possible because of the way in which BIOS programs are designed to work. Normally when a BIOS program starts running, it copies itself to RAM and then it continues running from there (from RAM). It does this because RAM allows it to run much faster than when it runs from its original location (from the chip). I think this technique is known as ROM Shadow. The BIOS program creates a shadow (a copy) of itself in RAM. When it is running in RAM, the BIOS program can still talk to its mother chip directly and cause the chip to do EVERYTHING that the chip is designed to do. The chip Won't even know that its BIOS program is running from a far away place (from RAM) ! But then RAM is a place where other programs can sit too. This means another program can take over or overwrite the copy of the BIOS program that's in RAM ! Yes, that's exactly how you can bypass the BIOS program. As I discussed above, modern operating systems prefer to talk to devices using drivers because drivers work in a high-performance mode rather than BIOS programs which work in a very slow mode. Once the OS starts loading, it will normally overwrite or replace the copies of the BIOS programs that are in RAM with its own high-performance drivers. These drivers will then talk to the chips or devices directly and completely replacing/bypassing the BIOS Programs ! But the Original copies of the BIOS programs that are inside the chips will always remain intact. There's No way that an OS would want to overwrite the original copies of the BIOS programs that are inside the chips, cuz that would be crazy ! That would change the chip or even damage it ! In fact, there's No reason why the OS would want to erase or overwrite the original copy of a BIOS program inside a chip because that area is actually Not writable. That's why it's called the BIOS ROM (Read Only Memory).

The OS can either use Drivers or BIOS Programs (Shadow Copies in RAM) to talk to the Hardware

Operating System

Applications

Shadow C

opies of B

IOS

Programs in

RA

M

Drivers

HA

RD

WA

RE

Chips, S

creen, Hard

Disk, N

etwork A

dapter, Processor, Keyboard, M

ouse, DV

D D

rive, M

otherboard, Etc.

BIO

S Programs

(original Copies

on Chips)

The User

As you can see in the picture above, when the OS wants to talk to the hardware, it will either use drivers or it can go via the BIOS programs (via the shadow copies of BIOS programs in RAM). Modern operating systems are actually able to use BOTH methods. If there is No drivers for a piece of hardware in your system, the OS will try to talk to that piece of hardware via the BIOS Program of that hardware (normally only the Shadow copies in RAM are used), but if you are lucky enough and you have installed the drivers for that piece of hardware properly, then the OS will actually talk to the hardware in high-performance mode via the Driver. Drivers are a better way of talking to Hardware than BIOS programs. That’s why sometimes a piece of hardware (especially Video Adapters) might seem to be working but in a very weak or funny way. For example, if you have Not properly installed the drivers for a video adapter, you might find that the appearance of everything on your screen is a little faint and rusty or everything just appears in a very low quality. This is a sign that the OS is talking to your video adapter via the video BIOS program. This could also be a sign that you have Not installed your video driver properly. Once you properly install the video driver, you might be suddenly surprised that everything on the screen looks a lot smoother/crisp and in high quality. The same thing is true for other devices such as Sound Cards (Audio Adapters), Internal Modem Adapters, Network Adapters, and many others. When the system is switched on, the System BIOS program (it is built into the System BIOS chip) will be in control of the computer. It will copy itself to RAM (as we expect) and do the POST (Power On Self Test) all the way until a point where it loads the Operating System (from the Hard Disk or Floppy Disk or Bootable CD or any Bootable Storage device). After this, the OS will take control of the

Page 9: How Software And Hardware Work Together v1.2

Page 9 of 16

system and that's when the OS would normally overwrite or replace the copy of the System BIOS program that's in RAM with its own high-performance drivers. I want to talk about Two types of BIOS Program, but before I do so, let me just stress again that ALL BIOS programs regardless of which type I will talk about, they ALL seem to do a similar thing when they have to run. They want to load/copy themselves into RAM first and then run from within RAM. Alright, there is two types of BIOS program. The first type is the BIOS program in the Main BIOS Chip that's mounted on your motherboard. This BIOS program is called the System BIOS Program.

The other type of BIOS program is all those that are sitting on ALL the other chips, such as the chips on adapters or the chips on other devices including those devices that are mounted on the motherboard (on-board sound, on-board video, on-board LAN, etc). The reason I want to separate the two kinds of BIOS programs is because I want to talk a little deeper about the System BIOS Program alone, and I Don’t want you to mistakenly think that this topic applies to other BIOS Programs such as the ones found in add-on devices !

Here is an example of other Add-on BIOS chips. The Other

BIOS Programs are built into these other

chips (the black squares). As you can see, these chips are usually mounted on

Add-on Adapters and other Devices inside

your computer.

When the system is switched on, the first thing that displays on the screen is actually a program running. That's the System BIOS Program, it's on the previous picture, it's Not in one of these other BIOS chips on this picture above ! The system BIOS program is probably the most important BIOS program of all. When you see the very first words showing up on the screen after you switch on the computer, at that time, the System BIOS program has already copied itself to RAM and what you are seeing is the copy of the System BIOS program running from inside RAM. That's why a computer will NOT show anything on the screen if it has No RAM ! Even if you have connected EVERYTHING else perfectly. Many people have been fooled by this issue for many years. When your computer has No RAM, there will be nothing showing on the screen when you switch it on BECAUSE . . . . the System BIOS program wants to First copy itself to RAM and then run from within RAM ! When it has copied itself to RAM successfully, it's ONLY then that you will see something on the screen because the System BIOS program only starts running when it's in RAM ! As it is running, you will see it reporting to you how much RAM you have on your computer and also what kind of Hard Disk or IDE devices it has detected and also what kind of Ports you have on your computer and any other general devices that it has detected on your computer. Normally the System BIOS program allows you to interrupt it and actually go into a place called the CMOS and change some settings about how you prefer devices to be detected when your system is starting up. Normally it displays a message saying "Press Bla Bla Bla Key" to go into the CMOS Setup. In the CMOS, you are allowed to Disable/Enable certain devices that the System BIOS program is detecting each time when it starts running. Earlier on I mentioned that a User can talk directly with a BIOS program (without going through an Application or OS or Driver) and I mentioned that many people will find this statement strange. I also mentioned that some people might disagree with me on this issue. Well, here we are! As I just explained recently, a BIOS program allows a User to change CMOS settings ! When a user is changing CMOS settings, he is talking directly with the BIOS program. There's No application or OS involved here because the OS has Not loaded yet ! Applications are even much worse because they can only load and run on top of an OS when the OS itself has fully loaded and running ! On the picture at the beginning of the book I drew dotted lines that shows us the fact that information can flow directly

Here is an example of a System BIOS chip. The

System BIOS Program is built into this chip. This chip itself is usually mounted on

your Motherboard.

Page 10: How Software And Hardware Work Together v1.2

Page 10 of 16

from the User to the BIOS program! Also when the BIOS program is reporting the devices that it's detecting and other stuff, it is actually talking/reporting to the user directly. So indeed it's perfectly possible for information to flow directly between the BIOS program and the user. But wait just a minute, because very soon I am going to be talking about the Physical View and I will actually dismiss this whole idea and throw it out of the window because it is still NOT actually the pure truth ! The CMOS is a special kind of memory where the System BIOS program stores its settings about all the devices that it detects when it starts running (when you switch the computer on). The CMOS is therefore a storage place (like a Hard Disk or Floppy Disk) where the System BIOS program keeps its settings so that the next time when you switch on the system, it can remember what you have Disabled/Enabled.

An example of a CMOSMemory chip.

A C

MO

S B

atte

ryon

the

Mot

herb

oard

.

If you remove the battery from your motherboard, the CMOS will lose all it's contents because unfortunately the CMOS storage can only hold its contents while the battery on the motherboard is still connected ! Luckily this is Not such a dangerous thing because many people never need to remove the battery from their motherboard. In fact, I bet many people Don't even know that there is a battery on their motherboard ! Some people Won't even know which battery I'm talking about ! Anyway let's continue. When the battery is removed from the motherboard, the CMOS will lose all its contents, but luckily the System BIOS program has default settings that are built into it. It will simply write (store) its default settings again into the CMOS when the battery is put back onto the motherboard. You will then need to go into the CMOS again and change some of those default settings back to your own personal preferences and everything should be ok. NB: Never put or remove a battery or any device onto a motherboard when the computer is still running ! ! When you are in the CMOS, you are allowed to Change CMOS settings/contents. You are allowed to Disable or Enable many of the devices that the System BIOS program has detected. By storing your changes or preferences in the CMOS, the System BIOS program is able to REMEMBER your preferences the next time when you switch the system is on. This allows it to NOT keep on displaying certain devices/things on the screen which you have chosen to Disable because you would then be annoyed. The System BIOS program reads the CMOS to check your preferences first before it displays something on the screen. It checks whether you have chosen to have that thing disabled or Not.

Page 11: How Software And Hardware Work Together v1.2

Page 11 of 16

Earlier on I mentioned that I am going to be talking about the Physical View and that I will actually dismiss the whole idea about applications, operating systems, drivers and hardware. I said I will throw this idea out of the window because it is NOT actually the pure truth about how information flows between the user and the computer ! I am glad that we have finally arrived here. This picture below (the Physical View) shows us something quite different from the first picture at the beginning of the book (which was the Logical View).

BIOS ProgramsBIOS Programs are actually Part of the Hardware! They are Not a

Standalone piece of Software that you can get on a Floppy Disk or

on a CD! They are built into a chip and the chip itself is actually

Hardware!

DriversDrivers are

Software. They normally sit on the Hard Disk or Boot Disk and they get

loaded into RAM by the OS when the

system is Booting.

Operating System

The OS

is Softw

are. The OS

normally sits on a B

ootable H

ard Disk or on a B

ootable CD

or Bootable Floppy and it

gets loaded into RA

M by the S

ystem B

IOS

Program

w

hen the system reaches a point w

here it must B

oot.

Applications

Applications are S

oftware. They sit on a D

isk (any kind of D

isk). Just like Drivers, applications get loaded into R

AM

by the O

S w

henever they need to be Run.

RAMCopies of

BIOS Programs BIOS Programs normally copy

themselves from BIOS Chips into RAM before they

start Running.

HARDWARE

A chip on a motherboard or on an Addon adapter is a very good

example of Hardware. But the word ‘Hardware’ also applies to big

things like a Screen, Hard Disk, Network Adapter, Processor, Keyboard, Mouse, DVD Drive,

Motherboard, Etc.

Information Flow, The User and The System, (Physical View)

The User

Looking at this picture above, I want you to pay special attention to the arrows. The arrows represent the possible way in which information can flow. You should be able to see that this picture is quite different from the other picture at the beginning of this book. As I said earlier on, now I want us to dismiss the first picture which I showed you at the beginning of this book. I want you to get that picture out of your mind right now, otherwise you are going to have a major problem understanding everything from this point onwards ! This picture above shows us the Physical View of Information Flow, The User and The System. This picture differs from the first picture (Logical View) in that it shows us the physical way in which information actually flows between the user and the various system components ! Unlike the first picture, this is NOT a picture that shows you how people imagine things ! It’s a picture of what actually happens when you do something on the computer, NOT what you think is happening ! This picture shows us the actual or correct way in which information actually flows between the user and the system. Just looking at the picture a little closer, you can clearly see that information NEVER actually flows from a user to an Application. Look at the picture carefully again and you will see that information rather flows in this fashion:

- Between the User and Hardware - Between Hardware and Drivers or Between Hardware and Copies of BIOS programs in RAM. - Between Drivers and the Operating System. - Between the Operating System and Applications.

As you can see in the picture, the application is actually very far away from the User. I know it is hard to believe it, but applications are actually the Furthest thing away from the User ! Believe it or Not, the user actually interacts with the hardware ! The hardware is made up of various devices such as Hard Disks and BIOS chips, etc. RAM is also hardware; you can see and touch a RAM chip with your fingers. As you can see in the picture, RAM is part of hardware; RAM appears as a smaller box inside the bigger/outer hardware box. BIOS chips are also hardware; you can see and touch a BIOS chip with your fingers. As you can see in the picture, BIOS chips appear directly in the bigger/outer hardware box. Inside the BIOS chips there is BIOS programs. BIOS programs are built into BIOS chips. But BIOS programs can also exist in RAM because they normally copy themselves to RAM when they are about to run. That's why I drew a dotted box of BIOS programs (shadow copies of BIOS programs) in RAM. When a BIOS program is running, then it’s normally the shadow copy of it in RAM that’s actually running. Inside RAM you can also see that there is Drivers. Exactly as the picture says: Drivers are software. They normally sit on the Hard Disk or Boot Disk and they get loaded into RAM by the OS when the system is Booting. Again inside RAM you can see that there is the Operating System itself. As the picture says: The OS is software. The OS normally sits on a Bootable Hard Disk or on a Bootable CD or Bootable Floppy and it gets loaded into RAM by the System BIOS program when the system reaches a point where it must Boot. Inside RAM you can also see that there is Applications. Just read what the picture is saying about them too. I hope this picture has helped me to dismiss ALL kinds of myths and hallucinations that people often have about how the various components actually fit together and also how information actually flows between the computer and the User.

Page 12: How Software And Hardware Work Together v1.2

Page 12 of 16

HARDWARE Examples of Hardware include things like:

- Motherboard, Controllers - Power Supply - Cables, Monitor, Printer - Scanner, Digital Camera - Modem, Keyboard, Mouse - Processor, RAM, Video Adapter - Network Adapter, USB Ports - Sound Adapter, Microphone, Speakers - Hard Disk, Floppy Disk Drive - CD-ROM Drive, DVD-ROM Drive - and also BIOS Chips themselves, and many others.

BIOS Chips are the square black chips on the motherboard and also on Adapters. When you hold an adapter in your hand and just look at it (for example a Sound Adapter, Video Adapter, or Network Adapter, etc) normally the biggest chip on the adapter is the most important. That’s the thing that has ALL the brains of that adapter !

If it the adapter/device has Two or more big chips on it, then it’s probably a more advanced device ! Hardware normally does physical things that you can see and touch. A printer will print a page out. A scanner will scan a photo. A monitor will display some info on the screen, A BIOS chip on an audio adapter will create sound, and so on. Hardware is controlled by BIOS programs or by Drivers. The reason I say "or by drivers" is because I mentioned earlier on that it's possible to bypass BIOS programs and replace them with drivers. These drivers can normally talk directly with the chip/hardware. They can send information to the chip directly in high-performance mode and receive information back from the chip directly. When the OS is loading, it will replace most of the copies of BIOS programs in RAM with drivers if you have installed those drivers properly into your OS. Just like the System BIOS program that I explained above, other BIOS programs on other chips also copy themselves into RAM when the system is switched on. They load copies of themselves into RAM when they are ready to run. The System BIOS program talks to them and asks them to identify themselves. It can ask them by talking to their copies that are in RAM (fast) or by talking to their original copies that are in the various BIOS ROMs on the chips (slow!). They reply and say who they are (or what they are) and that’s how the System BIOS program actually “detects” devices. To detect a device is to ask the device to identify itself and to listen and capture the reply coming back from the device and then display the reply on the screen or maybe we should say "send the reply to the video chip". Another way to say this: The system BIOS program sends a request/info to a certain I/O Address asking the device at that I/O address to identify itself. Each I/O address will receive a request, which means every device that's connected in the system will be reached and be detected. This is a BIOS-to-BIOS talk. One BIOS program (System BIOS program) talks to other BIOS programs (ie: the BIOS programs on other devices). If you have a modern computer, your system BIOS program will probably be able to load all the other BIOS programs into RAM or it could just tell them to load themselves into RAM and start running. It can coordinate between them and let them take over the system temporarily or it can even give some of them complete control over the system until a point where the OS has to be loaded from the Hard Disk. Then the OS would take control of the system and replace all the BIOS programs in RAM with drivers and take full control of the system.

Page 13: How Software And Hardware Work Together v1.2

Page 13 of 16

Earlier on I mentioned that a User can talk directly to Hardware. I mentioned that this view is NOT supported by many people and that some people might disagree with me for thinking in this way ! Well, let’s see. When you type on the keyboard or when you press a button on a mouse, you are sending information to the Keyboard or to the Mouse. Information flows from your head/brain to your finger and then your finger touches the keyboard or the mouse. When your finger touches a button on the keyboard, you are directly passing or sending information to a piece of Hardware (the keyboard). The keyboard then sends your information further upwards to a specific BIOS program or to a Keyboard Driver (Look at the Physical View picture above). Normally the keyboard does Not have its own BIOS chip, so the information will probably go to the System BIOS chip, this obviously means the info will be handled by the System BIOS program. If the system BIOS program has been replaced by a high-performance Driver such as a Logitech Keyboard Input Driver, then the info will just go Straight to that Driver (in this case the system BIOS program will actually NOT be used at all, cuz it will have been bypassed). From the driver the info goes further up to the OS. The OS then passes that info upwards to the proper Application. When the application receives the info, what do you think happens? . . . . Many people think you will just see the info in the application on the screen (the letter of the key that you typed on the keyboard), but I have bad news for you . . . .That's WRONG! When the information reaches the application, you WON'T actually see it on the screen. The application will send the info back Down to the OS. The OS will then send the info further down to the Driver (this time it's going to the video driver, NOT the keyboard input driver!). The Video Driver will then send the info down straight to the Video Chip on your video adapter (the video chip itself is obviously Hardware). When the video chip receives the info it will pass the info to the video port on that adapter. The info will then flow out through the video port to the Screen/Monitor. It's only then that you will see the info on the screen ! ! Hey, just make sure that your screen is connected to the video adapter and that it's switched on ☺ Now that's actually how this whole thing works ! Even if the info you send to the application is just a simple thing like typing one letter or touching one key on the keyboard, that's how it would flow ! Many people never talk about it in this way. They rush to say that when the information reaches the application the user will just magically see the info on the screen. That's Not a very True statement. There is still something that happens between the application and the screen and I think it's very important to talk about that thing ! The application is NOT the screen. The screen is Hardware and the Application is Software. So you must stop believing crazy stories. . . How can you possibly see information on an Application? It's impossible! When the application receives information, it must actually pass the information back (downwards) to the OS, then to the Driver (a video driver), then down to the Video Chip which is on the Video Adapter and then to the video port on the adapter and that’s only then that you will see the info on the Screen. The screen then passes the information to YOU (to your eyes!). Now wait a minute . . . .if the screen actually passes information to you, it means hardware (the screen) can send information DIRECTLY to a User ! That's why on the picture above (Physical View) the arrows are connecting the User directly to the Hardware and NOT to the application ! The application is far away from the user ! The arrows show that information actually flows directly between Hardware and the User. Examples of hardware that can Receive information directly from the user:

- Keyboard. - Mouse. - Magnetic Card Readers/Swipes or Credit Card Reader. - Scanner and the Buttons on the front panel of your Scanner. - The buttons on the front panel of your Printer. - Microphone. - Joystick. - Digital Camera or Web Cam. - The Reset Button and the Power-On/Off Buttons on the front panel of your computer. - MIDI Keyboard, Musical Instrument or Synthesizer. - USB Port (You have to use your hand to insert the USB stick into the USB Port !) - The Floppy Drive (You have to use your hand to insert the floppy disk into the drive !). - The CD-ROM Drive or DVD-ROM drive (You have to insert the CD with your hand !). - The Eject Buttons on the CD-ROM, DVD-ROM and Floppy drives. - The Brightness & Contrast Buttons on your Screen.

Examples of hardware that can Send information directly to a user: - Screen (it sends information to your eyes). - Printer (it sends information to your eyes). - Audio Adapter (if you have connected speakers to it, it will send information to your ears). - Stereo Headphones (they send information to your ears). - All the LEDs on the front panel of your computer (they send information to your eyes). - Fax Machine (a Modem on your PC can send a fax to the fax machine at your office). - All the LEDs on your external Modem (they send information to your eyes). - The blinking LED at the back of your Network Adapter (it sends information to your eyes). - The Floppy Drive (you can eject a floppy disk out of the drive and put it into your pocket !). - The USB Port (you can pull a USB stick out of the USB port and put it into your pocket !). - A CD-Writer or DVD-Writer (they send information to your hands). These devices can automatically eject the disk when your recording is done. You have to take the disk from the drive with your hand ! - The Beeping sounds from the PC Speaker ! (it sends information to your ears)

As I promised, Now I believe I have proven to you in all respects that Information can indeed flow directly from the User to Hardware and even backwards from Hardware to the User ! There are many other examples of information flowing back and forth between hardware and the user. If you just take time and think of it, you’ll realize that it’s true.

Page 14: How Software And Hardware Work Together v1.2

Page 14 of 16

RAM? Why is RAM so Important? RAM is very important because Everything that’s running is normally loaded into RAM first and then it actually runs from within RAM.

Examples of a RAM chip.

But BIOS programs are able to run without being loaded into RAM. They can actually run directly from within their chips. The only problem is that they run Very Slow if they are Not loaded into RAM. So almost all modern BIOS programs these days will force to load themselves into RAM first before they start running. In fact, most BIOS programs are very strict on this issue; if they Cannot load into RAM, they DON’T even want to run at all ! If your RAM is faulty or there is No RAM in your system, then you will simply Not see anything on the screen when you switch the computer on. Or something might appear for a few seconds while the System BIOS program is running and then the screen could just go blank when the OS is about to be loaded. You might also experience that the OS appears to be loading and then a few seconds after that the screen just goes blank. From the Physical View picture, you can clearly see that Drivers get loaded into RAM by the OS. The OS itself gets loaded into RAM by the System BIOS Program. The System BIOS program is loaded by YOU when you switch on your system ! The Applications get loaded into RAM by the OS whenever they need to be Run. So RAM is very important because Everything that’s running is first loaded into RAM and it actually starts running from within RAM. I think the reason why programs run from within RAM is because RAM allows programs to store temporary values and lots of other information that they use and work with in a very fast and quick response manner. Of course I know that the hard disk and many other kinds of disks are also used to store information. But the problem with disks is that they are just Too Slow for holding a program when the program is running. Disks are good for holding/storing a program that's NOT running or for storing general user information/files for a long period of time. RAM allows programs to read and write information much faster than a hard disk or any other kind of disk. But many times a program will still need to write information to a disk or read information from a disk. This process obviously causes the program to slow down a little bit, but nonetheless it's important that some of the information that the program is working with must be saved in a permanent storage such as a disk because if the computer hangs or you lose electricity in your house then all the info that is in RAM will be lost ! RAM keeps its contents only while the system is running ! When the electricity comes back again, you could still load the program again from the disk but all the information that the program was busy working with will probably be lost, unless it was saved or written to disk just before the electricity went down. Another good precaution is to tell the program/appliation every few minutes that you want to save the information to disk while you are still busy working with the information in the program/application on the screen. In this case, you are very wise, cuz when the electricity goes away and then comes back later on, you will be able to Reload both the program and the information that you saved from disk and continue working where you left off ☺ When programs are running, it is important that they use very High Speed temporary storage, otherwise a program might appear to be frequently hanging every time when the user is clicking or typing on it. RAM provides this kind of High Speed temporary storage that programs need when they are running. That’s what RAM is for.

Page 15: How Software And Hardware Work Together v1.2

Page 15 of 16

The Processor (The CPU) What exactly is the job of the CPU? Why is it so important? The CPU looks just like the other BIOS chips. In fact, the CPU is just a much bigger and very powerful BIOS chip.

Here I have a collection of examples of some Popular Processors

Intel Pentium II

Intel Pentium III

Intel Celeron

Intel Xeon

AMD Athlon 64Intel Pentium4

As I have explained earlier on, when the system is switched on, the System BIOS program will detect ALL devices in the system. It will ask all devices to identify themselves. Each device will identify itself as required. In the same manner as with all the other devices, the CPU will also be asked to identify itself. Your CPU might identify itself by saying something like this: “Intel Pentium4 3.8 Ghz, Hyper-Threading, 2MB L2 Cache”. But what exactly is the job of a Processor? If you’ve been reading carefully, you will realize that ALL these things are actually Programs:

- Drivers - Operating System - Applications - BIOS Programs

The only thing that’s NOT a program is Hardware ! A chip is NOT a program but the BIOS program inside a chip is a Program ! I think I will have to repeat this statement in a more interesting way: A chip is NOT a program, it is Hardware, but inside the chip there is a program hiding in there. The program is sitting in an area inside the chip known as ROM (Read Only Memory). There might be a few other things inside a chip, but the most important thing you need to know is that there is a BIOS program that’s stored in the ROM area inside the chip. I have repeated this statement many times in earlier parts of this book already. The Processor is actually Nothing special. It is just a very Advanced Calculator chip. It is a powerful BIOS chip which has a very powerful calculator program built into it. When all the other programs (Applications, OS, Drivers, etc) need to calculate or process something very complex, they ask the processor to help them with that kind of work. Sometimes the word ‘calculate’ is Not used a lot. The word that people normally use is ‘Process’. I think that’s why it’s called a processor. But actually it’s just a very advanced calculator. You could say a processor processes data. Another simpler way would be to say it calculates information. The processor is designed to perform very complicated calculations in a very short period of time. The processor can calculate anything that makes sense or anything that’s logical. When you ask it to calculate something, you need to give it the information (data) that needs to be processed/calculated and then also tell it what kind of calculation/processing you want it to do. For example, you could ask a processor to Add Two Numbers. Let’s say the numbers are 3 and 6. In this example, the kind of calculation/processing you want is “Addition”. You want the two numbers to be Added. The information or data that you want to be added is the Two Numbers: 3 and 6. Once the processor has the data/information that must be processed and it knows the kind of calculation it must do with the data, it will quickly start doing its job. Once it has finished the job, it will give you the Answer/Result immediately. Normally the processor will write the answer/result to RAM. Actually I think when you give the two numbers to the processor, you send them via RAM. You tell the processor where to find the two numbers in RAM. It will then go to that place/address in RAM and pick the two numbers up from there. When it’s done with the calculation it will write the answer/result to another place/address in RAM. Actually you have to tell the processor where (the RAM address) it should write the result when it’s done! You tell it at the time when you are giving it the info to be processed. This way you already upfront know where to find your result in RAM when the processor is done with your calculation. Recently we said the processor has a powerful BIOS program built into it (just like other BIOS chips). This BIOS program specializes in doing calculations. We also said BIOS programs copy themselves to RAM before they start running because RAM allows them to run much faster. Does this mean the processor’s BIOS program also copies itself to RAM? . . . . . The answer is No. The processor’s BIOS program Never copies itself to RAM. The reason is that the processor uses its own high-performance temporary storage memory called Cache and Registers. The cache and registers are many times faster than RAM, which means they actually run at the speed of lightening ! If the BIOS program in the processor had to copy itself to RAM when it runs, it would find RAM to be way too slow for it ! Modern processors these days run at clock speeds of Gigahertz. This kind of speed is much Faster than RAM. For the processor, everything is about neck-breaking speed ! In your computer, the processor is the thing that runs at the fastest speed than all the other components. In order to ensure this, many manufacturers of processors will try all sorts of performance-tuning tricks to ensure that their

Page 16: How Software And Hardware Work Together v1.2

Page 16 of 16

processors perform calculations in the fastest way possible. So the BIOS program in the processor Never actually loads into RAM because by doing so it would be forced to operate at the speed of RAM, which is much slower. The other problem with RAM is that it is usually available/manufactured from other factories which are Not the same factories where the processors are made. If the processor’s BIOS program had to load into a cheap or inferior RAM chip, then its speed would actually be negatively affected by that RAM chip ! Because of this issue, the makers of processors Never actually depend on RAM and they never design the processor’s BIOS program to load into RAM. All the various programs including those that I’ve mentioned above (Applications, OS, Drivers, BIOS programs, etc) will frequently need to use the processor for doing calculations. Time and again a program will send instructions to the processor asking it to help with some complex or even simple/easy calculation. That’s what the processor is there for. I hope I have given you enough basic information about the processor. Writing this book has brought me great satisfaction and joy, but it also took a great amount of effort and time. Coming to the end makes me feel a sense of achievement that I haven’t felt in many weeks. Now I feel I have to move on and do other things. This being my last words, I hope you are also feeling a sense of achievement and satisfaction from the kind of intuition this book has instilled in you. If you found this book to be truly helpful, then I suggest you send me an email [email protected] and just thank me for taking the time to share my knowledge with you! As compensation for wasting your precious time reading my book, I might actually send you $50 in return ! What do you think ! Will there really ever be anything better than reading this book ?

_____________________________________________________ Designed and Compiled by : Moses T. Motlhale Document Version : 1.2 Original Compilation Date : 16 June 1999 09:18 GMT+02H00 Last Revision Date : 17 October 2004 12:18 GMT+02H00 Notice : Copyright(C) 2004