Hi,
A computer system is a system which has "expected functionality". This expected functionality can be split into many different things that are necessary to achieve a desired result (e.g. run arbitrary applications).
"Hardware", "kernel space" and "user space" are all just locations where parts of the expected functionality can reside. There is no hard rule saying where any part is implemented. For example it'd be possible to implement a scheduler in hardware, in kernel space or in user space. A more practical example would be clearing/filling the screen.
As programmers we deal with software, and are unable to shift parts of the expected functionality into hardware. For some things we can ignore functionality that's already been implemented in hardware and do our own implementation in software (if necessary), but it's usually best (for performance reasons) to use functionality implemented in hardware as much as possible.
We can also have hardware requirements. For example, an OS can require hardware (e.g. a video card) that implements some functionality in hardware (e.g. 2D acceleration capable of clearing/filling the screen). A "better" OS would still be usable for systems without this functionality in hardware (for e.g. supporting video cards that don't have 2D acceleration by doing it in software).
At the most fundamental level, a computer system has a CPU and some RAM - everything else is optional (including more CPUs, hard disks, video, sound, network cards, etc). However, a computer that can't get data from somewhere and send data somewhere is of little practical value. For an example, this could mean your OS needs a CPU, some RAM and a serial port for input and output - it's a very minimal computer system (but in most modern cars you'll find computer systems that are barely more than this being used for eveything from engine management to controlling the interior light).
The job of an OS developer is to identify what functionality is expected, decide where and how it should be implemented and then to ensure it is implemented.
For a general purpose desktop/server OS there's a large amount of "expected functionality", and large variations in hardware. For example, the same OS might be expected to be usable for word-processing (with keyboard, mouse, video and printer; but no networking) while also being expected to be usable as a router, web server or file server (with networking; but no keyboard, no mouse, no video and no printer).
This typically gives core functionality (things the OS is always capable of) and optional functionality (stuff the OS is capable of if optional hardware and/or software is present), where the core functionality includes some way of adding optional functionality (e.g. applications, device drivers, etc).
Catachan wrote:I have narrowed the list of essential tasks that the kernel must be capable of to the following, once again, if I missed something, or I am completely wrong, please correct me.
- Read the HDD
Write to the HDD
Write to Video Mem (or atleast send the video mem data)
parse input from the user space
Read and Write to RAM
Surely there are more, though the above is intended to be a very basic list
This depends on what you've determined as the "expected functionality". What if there is no hard drives (e.g. OS using remote storage - NFS), what if there is no video card, etc. For the "core functionality" (ignoring things that may or may not be optional), I'd include things like:
- Boot code
Memory management
Scheduler and process management
Some sort of IPC
Device detection/management(?)
Virtual file system(?)
Catachan wrote:It occurs to me, that I could have a single method of printing things to the screen in the kernel, and just make some sort of wrapper for other programing languages to use that method to print with. The same of course goes for all methods built into the kernel.
What if there's no video card and the kernel needs to send it's output to a log file, to a dumb terminal (via. a serial port), or to a printer? If the kernel sends it's output to "<insert optional module name here>" then it's much more flexible.
Now tell me where the Windows kernel sends it's output (I honestly don't know). For my Linux machine boot messages end up in the file "/var/log/dmesg", and the rest is sent to a process called "klog" which sorts it and puts different things in different log files.
Cheers,
Brendan