RE:Should my Kernel be written in C or C++?
Posted: Wed May 05, 2004 11:00 pm
>Assembler is at the lowest possible level of abstraction because it does no
>hw abstraction while C and C++ are usually referred to as high-level
>languages because they are in themselves abstractions. With C and C++ your
>control of the machine is not as comprehensive as with assembler exactly
>because you are working at a higher level of abstraction. C and C++ do not
>give you absolute control of every single detail and therefore they also do
>not give you explicit control over those details.
For me C and C++ are high-level asm languges, since i know exactly how the program will look, when translated to asm. (For me a real high-level language is Java, SML, Refal, Lisp, ... )
>In an assembly OS? By directly manipulating relevant hardware state without
>any extra abstraction/indirection/protection layers. Protection is necessary
>but that could be guaranteed without assembly programmer hindering
>abstractions or indirections.
So, this means that you ever have a one man project,where every line of code(even in applications, if there is such a thing in you os) will be written by you. And you garanty protection between your programs=>no data will be lost of hdd or in memory, no corrupt screen, ...
Ever you are trying to make a unstable(without protection) os, since if at least one program(application) will be faulty, it will bring the whole system down?
Abstaction is used, not because programers wont to make there os complex and unyielding, but because it is a necessity, if you whant alot of programers to take part, and if you whant portability(at least some), and if you whant reusable code, .. . Abstaction is used to cooperate the work of programs ran together=>does this mean that your os does not have multitasking, paging & virtual memory(since any program which need some pages, allocates them by it self), you can't run untrusted applications => and therefore you have a stand alone program?
So, "hello world" program will be writen like this(for PC compatible-notice this, in an os with a HAL, you don't need to say this)
uint8 *buffer=(char*)0xb8000;//uint8 ~ unsigned char
buffer[0]='H';buffer[2]='e';buffer[4]='l';buffer[6]='l';...
Let me ask an even tougher question. Say you have an application which works with a com port(COM1-COM4) (say a modem), and now we install a usb-com adapter. Now
1)Could you say what steps will you need to take, to make that application work with this adapter?
2)Will you have two seperate programs for the com1 and for the usb-com adapter, or what ...?(remember decided not to have a HAL ) ?
Anton.
Anton
>hw abstraction while C and C++ are usually referred to as high-level
>languages because they are in themselves abstractions. With C and C++ your
>control of the machine is not as comprehensive as with assembler exactly
>because you are working at a higher level of abstraction. C and C++ do not
>give you absolute control of every single detail and therefore they also do
>not give you explicit control over those details.
For me C and C++ are high-level asm languges, since i know exactly how the program will look, when translated to asm. (For me a real high-level language is Java, SML, Refal, Lisp, ... )
>In an assembly OS? By directly manipulating relevant hardware state without
>any extra abstraction/indirection/protection layers. Protection is necessary
>but that could be guaranteed without assembly programmer hindering
>abstractions or indirections.
So, this means that you ever have a one man project,where every line of code(even in applications, if there is such a thing in you os) will be written by you. And you garanty protection between your programs=>no data will be lost of hdd or in memory, no corrupt screen, ...
Ever you are trying to make a unstable(without protection) os, since if at least one program(application) will be faulty, it will bring the whole system down?
Abstaction is used, not because programers wont to make there os complex and unyielding, but because it is a necessity, if you whant alot of programers to take part, and if you whant portability(at least some), and if you whant reusable code, .. . Abstaction is used to cooperate the work of programs ran together=>does this mean that your os does not have multitasking, paging & virtual memory(since any program which need some pages, allocates them by it self), you can't run untrusted applications => and therefore you have a stand alone program?
So, "hello world" program will be writen like this(for PC compatible-notice this, in an os with a HAL, you don't need to say this)
uint8 *buffer=(char*)0xb8000;//uint8 ~ unsigned char
buffer[0]='H';buffer[2]='e';buffer[4]='l';buffer[6]='l';...
Let me ask an even tougher question. Say you have an application which works with a com port(COM1-COM4) (say a modem), and now we install a usb-com adapter. Now
1)Could you say what steps will you need to take, to make that application work with this adapter?
2)Will you have two seperate programs for the com1 and for the usb-com adapter, or what ...?(remember decided not to have a HAL ) ?
Anton.
Anton