Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Jun 2007 14:29:55 -0700
From:      Alfred Perlstein <alfred@freebsd.org>
To:        Mark Jayson Alvarez <mjalvarez@fastmail.fm>
Cc:        freebsd-drivers@freebsd.org
Subject:   Re: Where software meets hardware..
Message-ID:  <20070621212955.GT98795@elvis.mu.org>
In-Reply-To: <1182418101.6802.1196302545@webmail.messagingengine.com>
References:  <1182418101.6802.1196302545@webmail.messagingengine.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Mark, you've pretty much answered your own question in your email here.

Your compiled software is somehow loaded into memory as a steam of
instructions that will be executed by the cpu.

This executed stream of instructions, besides doing interesting things
like math and flow control can access hardware through special
"input/output instructions" or through "input/output virtualization
through memory access".  

This is how software interacts with hardware.

Think of one of those automatic pianos that work off one of those
reams of paper that has holes punched into it.

The original sheet music is "the source program".
The punched hole tape is the "program loaded and compiled into memory".
The thing that loads the tape is the "operator" or maybe even "operating
system".
And the mechanism inside the piano that reads the tape is CPU.
Each hole is an "io instruction" that the CPU interprets and sends
a signal to cause a hammer to hit a string.
The hammer and strings are the "hardware".

* Mark Jayson Alvarez <mjalvarez@fastmail.fm> [070621 02:41] wrote:
> Hi,
> 
> Good day! I could have sent this to questions@freebsd.org but I know it
> will get treated
> as irrelevant topic as well. Just trying my luck here though. Those of
> you who've been
> inspired with my curiosity may email me directly. :-) Just f***ing
> google it advices are also
> welcome.
> 
> I have a cousin who's taking up a programming course. He doesn't have
> background with
> programming nor an in depth understanding of how the computer works.
> I tried explaining him that it all started with abacus, and that people
> wanted to use
> something that could make their arithmetic life easier and that Charles
> Babbage tried
> automating this manual calculator with his steam engine or some sort...
> and that... oh,
> forget about these craps. 
> 
> This is how my programming teacher explains how a program gets executed.
> First you compile
> it into a machine readable code, then the operating system writes it in
> the memory, and finally
> the CPU fetches it and it finally gets toasted by the electricity
> flowing on the CPU's surface.
> It doesn't make things clearer though.:-(
> 
> Here's how I understand it: Suppose I'm writing this email. If I press a
> letter in the keyboard, 
> it generates an tiny electric current which eventually translated to
> interrupt. Next the keyboard driver
> picks this up and tell the operating to talk to the monitor driver and
> output the letter in my 
> monitor..
> 
> I really don't get it. Can you in a very simple sentence explain to me
> how and where a software program
> meets the hardware? Does it have anything to do with the bios? Wiki
> entry for it doesn't say much about
> this. It only says, this is how things get started when you power on
> your pc. The bios initializes all
> your computer parts, then call the boot loader and so on and so forth..
> 
> I really wanted to get down really really low. Someone told me to read a
> driver source code in C but if I compile it, it will still be translated
> into assembly code or something. Still the operating system reads that
> code and the cycle goes on again. I am no programmer by profession but I
> do know how to program. I told my cousin, that someday he will be a real
> programmer and that even if he will be dealing only with java, html,
> animation and all sorts of high level programming stuffs, in the spirit
> of open source (and freebsd of course), it's better that he knows
> exactly how a program interacts with the physical computer.
> 
> 
> Thanks for the time.
> I hope this one doesn't bounce back. :-)
> 
> 
> 
> -- 
>   Mark Jayson Alvarez
>   mjalvarez@fastmail.fm
> 
> -- 
> http://www.fastmail.fm - Same, same, but different?
> 
> _______________________________________________
> freebsd-drivers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-drivers
> To unsubscribe, send any mail to "freebsd-drivers-unsubscribe@freebsd.org"

-- 
- Alfred Perlstein



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070621212955.GT98795>