Sign in with
Sign up | Sign in
Your question
Solved

Which Programming Language for OS

Tags:
  • C#
  • C/C++
  • Programming Language
Last response: in Apps General Discussion
Share
October 7, 2014 7:19:35 PM

Hello guys i wanna know which programming language is the best for creating OS like C, C++ or c#
or any other.

More about : programming language

October 8, 2014 12:55:33 AM

The commonest, and easiest, language to use for these purposes is C, with a certain amount of assembler, although other languages can be used. Early OSs were written entirely in assembler and this is still the approach taken by some individuals.

Much more important than the language used is that you have a thorough understanding of the processor and support chips that you are targetting your OS at.
m
0
l
October 8, 2014 1:02:12 AM

Ijack said:
The commonest, and easiest, language to use for these purposes is C, with a certain amount of assembler, although other languages can be used. Early OSs were written entirely in assembler and this is still the approach taken by some individuals.

Much more important than the language used is that you have a thorough understanding of the processor and support chips that you are targetting your OS at.


by saying understanding of the processor and support chips do you mean the version it's capabilities and all the details about them.
m
0
l
Related resources

Best solution

October 8, 2014 1:25:11 AM

The version is probably the least important information as you want your OS to run on any version of the processor.

I mean that you have to understand the way that the processor works, the registers it contains, and all the instructions that it obeys. For example, with an x86 processor you need to understand the state it is in when it starts up and how to move it from real mode to protected mode and then (possibly) to 64-bit long mode. To do this you will need to understand how the processor uses the segment registers to address memory and how it translates virtual addressed to physical addresses via the paging mechanism. That's just for starters.

The processors are very well documented by the manufactures (the Intel Programmer's Manual, which is a free download explaining every aspect of how the processor works, comes as a 5-volume manual), the support chips less so. And some peripherals are more difficult to control than others - text display, keyboard input, hard disk support are easy; graphic display more difficult, and USB devices difficult even for the most expert programmers.

Basically, OS programming is about the most difficult development work that you can undertake. But if you are already skilled in assembly language and a higher-level language such as C it can be a very rewarding hobby.
Share
October 8, 2014 4:19:37 AM

Ijack said:
The version is probably the least important information as you want your OS to run on any version of the processor.

I mean that you have to understand the way that the processor works, the registers it contains, and all the instructions that it obeys. For example, with an x86 processor you need to understand the state it is in when it starts up and how to move it from real mode to protected mode and then (possibly) to 64-bit long mode. To do this you will need to understand how the processor uses the segment registers to address memory and how it translates virtual addressed to physical addresses via the paging mechanism. That's just for starters.

The processors are very well documented by the manufactures (the Intel Programmer's Manual, which is a free download explaining every aspect of how the processor works, comes as a 5-volume manual), the support chips less so. And some peripherals are more difficult to control than others - text display, keyboard input, hard disk support are easy; graphic display more difficult, and USB devices difficult even for the most expert programmers.

Basically, OS programming is about the most difficult development work that you can undertake. But if you are already skilled in assembly language and a higher-level language such as C it can be a very rewarding hobby.


can you tell from where i can get the manual
m
0
l
October 8, 2014 4:20:26 AM

War_Mechine said:
Hello guys i wanna know which programming language is the best for creating OS like C, C++ or c#
or any other.


As Ijack mentioned the predominant language for operating system level programming is C, although C++ may be used to a limited extent. C++ leans on the C++ standard library for language features whereas C does not. For example, dynamic memory allocation in C++ is a language feature accessible through the new and delete keywords. These are provided by the C++ standard library. Their C analogues, malloc() and free(), are function calls rather than keywords. The standard libraries for either of them are not available to the kernel, so the kernel designer is responsible for implementing the kernel's own memory manager as well as providing the mechanisms to allow applications to manage their own memory.

All operating systems will rely on the target platform's assembly language to a small degree as there's no elegant way to perform platform specific operations such as switching operating modes, managing interrupt vector tables, handling hardware exceptions, etc... C was designed with the purpose of enabling the Unix operating system to be platform portable, but a small amount of the code simply can't be ported. Windows wraps all of the platform specific stuff up in the hardware abstraction layer, hal.dll. The Windows NT kernel itself is fully portable.

There is an experimental system called Singularity which uses fully managed code including the kernel and device drivers. It is written in a language that is an extension of C# (C# itself is not suitable for system level programming). This operating system still relies on C and assembly for some of the very low level operations such as loading the kernel and handling interrupts.
m
0
l
October 8, 2014 2:52:19 PM

Ijack said:
The manuals: http://www.intel.com/content/www/us/en/processors/archi...

Here is a site that provides a lot of information about OS programming: http://wiki.osdev.org/Main_Page . Be a little careful when using the forums here as the expectation is that you already have a great deal of knowledge; people can be intolerant of absolute beginners who ask questions that are already answered in the Wiki.


I hope that you mean the forums on that site, not here on Tom's Hardware.
m
0
l
October 8, 2014 11:02:52 PM

Poorly worded! Yes, I mean the forums on osdev.org .
m
0
l
!