Computer Science Canada

What programming languages are required for building an OS?

Author:  php111 [ Wed Sep 12, 2007 7:32 pm ]
Post subject:  What programming languages are required for building an OS?

Hi all,

What programming languages are required in building an OS? What is required in building an OS? I never programmed before. Is there any tutorials for programming that is required to build an complete OS?

Author:  Mazer [ Wed Sep 12, 2007 7:49 pm ]
Post subject:  RE:What programming languages are required for building an OS?

Disclaimer: I realise after typing this whole message that you never actually implied that you wanted to build an OS yourself, but I'm leaving it anyways in case you really do.

Let me just say that you are getting in WAY over your head. Like, way way. You would not believe just how way over your head this stuff is.

I'm not trying to be a douche, but I don't want you to get the idea that doing your best and never giving up will get you somewhere this time. There are whole books that will serve just as introductions to the internals of an operating system.

If you are really curious about this, try looking for a book about it at your local library. You do need to know how to program, and you need to know alot of theory.

Author:  Tony [ Wed Sep 12, 2007 7:49 pm ]
Post subject:  RE:What programming languages are required for building an OS?

Considering the purpose of the OS, any programming language capable of communicating with the hardware can be used. There is no required language.

Anyways, if you have never programmed before, you should not be attempting anything on the OS's level of complexity for a while yet. Start smaller.

Author:  php111 [ Wed Sep 12, 2007 7:52 pm ]
Post subject:  Re: RE:What programming languages are required for building an OS?

Mazer @ Wed Sep 12, 2007 7:49 pm wrote:
Disclaimer: I realise after typing this whole message that you never actually implied that you wanted to build an OS yourself, but I'm leaving it anyways in case you really do.

Let me just say that you are getting in WAY over your head. Like, way way. You would not believe just how way over your head this stuff is.

I'm not trying to be a douche, but I don't want you to get the idea that doing your best and never giving up will get you somewhere this time. There are whole books that will serve just as introductions to the internals of an operating system.

If you are really curious about this, try looking for a book about it at your local library. You do need to know how to program, and you need to know alot of theory.


Is there any tutorials for this? What kind of programming and theory do i need to know?

Author:  php111 [ Wed Sep 12, 2007 7:53 pm ]
Post subject:  Re: RE:What programming languages are required for building an OS?

Tony @ Wed Sep 12, 2007 7:49 pm wrote:
Considering the purpose of the OS, any programming language capable of communicating with the hardware can be used. There is no required language.

Anyways, if you have never programmed before, you should not be attempting anything on the OS's level of complexity for a while yet. Start smaller.


Tony,

What can i do to start smaller?

Author:  Clayton [ Wed Sep 12, 2007 7:57 pm ]
Post subject:  RE:What programming languages are required for building an OS?

Start looking around for beginner tutorials. There are a large number of them here on this very site as introductions to programming. At the top of this very forum is a sticky called The [WIP] Collection, where you can find such tutorials.

Author:  php111 [ Wed Sep 12, 2007 8:03 pm ]
Post subject:  Re: RE:What programming languages are required for building an OS?

Clayton @ Wed Sep 12, 2007 7:57 pm wrote:
Start looking around for beginner tutorials. There are a large number of them here on this very site as introductions to programming. At the top of this very forum is a sticky called The [WIP] Collection, where you can find such tutorials.


Thank you Clayton. Is that what i need to learn? I can't edit posts. I am only a member. Thank you for the bits who ever gave them to me.

Author:  md [ Wed Sep 12, 2007 8:03 pm ]
Post subject:  RE:What programming languages are required for building an OS?

Buy Operating Systems and Design, ver. 3
Learn C
Learn C++
Learn assembler
Learn the internals of minix
Then you can start to think about what an OS should look like.
Then do WAY more research and studying and learning of C/C++/asm
Then you can start doing very basic OS level stuff.

Author:  php111 [ Wed Sep 12, 2007 8:06 pm ]
Post subject:  Re: RE:What programming languages are required for building an OS?

md @ Wed Sep 12, 2007 8:03 pm wrote:
Buy Operating Systems and Design, ver. 3
Learn C
Learn C++
Learn assembler
Learn the internals of minix
Then you can start to think about what an OS should look like.
Then do WAY more research and studying and learning of C/C++/asm
Then you can start doing very basic OS level stuff.


What do you mean? Do you mean i have to buy an Operating System (OS)? Can i just use my Vista?

Author:  CodeMonkey2000 [ Wed Sep 12, 2007 8:06 pm ]
Post subject:  RE:What programming languages are required for building an OS?

I don't see any advantages of programming your own OS. It's usually not a good idea to reinvent the wheel.

Author:  Clayton [ Wed Sep 12, 2007 8:07 pm ]
Post subject:  RE:What programming languages are required for building an OS?

php11 wrote:
What do you mean? Do you mean i have to buy an Operating System (OS)? Can i just use my Vista?


It's a book.

Author:  php111 [ Wed Sep 12, 2007 8:12 pm ]
Post subject:  Re: RE:What programming languages are required for building an OS?

Clayton @ Wed Sep 12, 2007 8:07 pm wrote:
php11 wrote:
What do you mean? Do you mean i have to buy an Operating System (OS)? Can i just use my Vista?


It's a book.


Clayton real quick off topic question. Do you know how to use mIRC? How do i use it?

Author:  Clayton [ Wed Sep 12, 2007 8:18 pm ]
Post subject:  RE:What programming languages are required for building an OS?

Download, install, and run it. Google if unsure.

Author:  Geminias [ Fri Nov 30, 2007 10:37 am ]
Post subject:  Re: What programming languages are required for building an OS?

Assuming you know a thing or two about microcontrollers and assembly and C you could easily build a small embedded OS. For instance, most routers run linux. Getting into things like PDA's and web accessible cell phones and you won't stand much chance, but if you pick up a board with a microcontroller and lots of I/O pins you're looking at something more realistic.

Author:  Zampano [ Fri Nov 30, 2007 11:14 am ]
Post subject:  Re: What programming languages are required for building an OS?

Do return to the original question of this topic, what language does an operating system use? i know that every parts of WIndows I use is coded somewhere, but how can logic gates interpret the language that operating system code is written without first having to interpret the instruction for interpretting that language, and how can they do that without first interpretting the language of the instructions for interpretting that language.
I'm sure I'm not being clear when it comes to specifying a real question, but these are the kind of questions I have about computers which are never answered in the highschool compsci and compeng courses, which resort to explaining such complicated concepts with watered down videos:
"So how does the computer work?"
"Well, it reads instructions and follows them; it's that simple!"
"Oh! Everything concerning computers makes sense to me now."
Those videos are the most disappointed things I ever watched.

Author:  Wolf_Destiny [ Fri Nov 30, 2007 11:22 am ]
Post subject:  Re: What programming languages are required for building an OS?

I can't believe they forced you to watch videos like that...

Anyways, the computer uses Assembly language (really low level) which specifically tells the CPU "I want you to put this value into this register." Or the like. Not quite sure what interprets the assembly, however it's about as low as you can get. Then an interpreter for C is made in assembly. (Or any other language could be, but C seems to be the standard) Then since you've got a higher-level language you can build your OS kernel (which will likely still require bits of assembly code).

Author:  rdrake [ Fri Nov 30, 2007 12:45 pm ]
Post subject:  Re: What programming languages are required for building an OS?

Wolf_Destiny @ Fri Nov 30, 2007 11:22 am wrote:
Not quite sure what interprets the assembly, however it's about as low as you can get.
An assembler translates the assembly into machine code which is executed by the processor.

Wolf_Destiny @ Fri Nov 30, 2007 11:22 am wrote:
Then an interpreter for C is made in assembly. (Or any other language could be, but C seems to be the standard) Then since you've got a higher-level language you can build your OS kernel (which will likely still require bits of assembly code).
C for simplicity (don't laugh, it's simpler than ASM), and ASM for speed.

Author:  abcdefghijklmnopqrstuvwxy [ Fri Nov 30, 2007 7:46 pm ]
Post subject:  Re: What programming languages are required for building an OS?

Well the answer to the mystical question is actually quite simple. The logic within the cpu is such that it only knows how to "execute" a finite amount of instructions. Look up IA32 opcodes. Opcodes stands for operation codes. Each opcode, from a higher language perspective, is similar to a function. Some take in what are known as operands (parameters) and perform the specified operation.

All high level languages are eventually converted to binary which take advantage of the CPU's hardware determined opcodes to cause the cpu to execute a desired set of instructions which make up a program.

It would be more straightforward of an explanation if there weren't languages that were interpreted, meaning they get "compiled" into bytecode and then from there translated into machine code on the fly by another program called an interpreter. Regardless, at the end of every day all code, no matter how abstract and easy to write, eventually becomes binary in the form of opcode followed by operand to make the cpu function.

So what is all this opcode and asm and operand crap I'm talking about? Consider:
asm:

0x1 = add  ; add will be our opcode, add is the instruction.  As you can see, add is defined as 0x01 which is the number 0001 in binary. 

x = address 0xc  ; x is our variable and its located in

add x, 1  ;  can you guess what this does? 

Now lets see what it looks like in binary:

0001 1100 0001  ; notice that depending on where the binary number is, determines what function it plays. 
                         ; 0001 is not only an opcode, but in this case also takes on the literal value 1

if we looked at the memory location 0xc we'd see it's value get one added to it. 




Any more questions you'd like to ask? hahahaha

Author:  Zampano [ Fri Nov 30, 2007 10:56 pm ]
Post subject:  Re: What programming languages are required for building an OS?

Well, before I can begin to ask another question, I'll have to do some research and chew on al the information I've just read.
Thanks guys!


: