I want to create an OS!!!

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
chentedev
Posts: 4
Joined: Sat Jan 26, 2013 5:17 pm

I want to create an OS!!!

Post by chentedev »

Hello friends I want to start developing a kernel, an operating system

What languages ​​do you recommend?

It will be possible with Python?
Chente Davila
Developer
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: I want to create an OS!!!

Post by pcmattman »

You will need to learn C, and you probably want to read the Introduction on the wiki too.

At your level of experience, it's wise to just learn C (and write some applications for your favourite OS before making one), and leave the thinking about Python for a much later date.
chentedev
Posts: 4
Joined: Sat Jan 26, 2013 5:17 pm

Re: I want to create an OS!!!

Post by chentedev »

No can do in python? : (
Chente Davila
Developer
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: I want to create an OS!!!

Post by pcmattman »

Not without a great deal of both C and difficulty.

Try something for me - run

Code: Select all

$ strace python
>>> exit(0)
Every system call you see (and there will be many) is a component of the runtime you would need to implement, in C, before you can run a Python script that does literally nothing on bare metal.

The alternative might be perhaps to write a full Python compiler that outputs machine code, but this will also most likely be written in C, and will still require you to write a runtime for each target system.

The fundamental issue is that Python is an interpreted and very high-level language. An operating system is by nature a very low-level concept. There's just too many layers between Python and the bare metal.
chentedev
Posts: 4
Joined: Sat Jan 26, 2013 5:17 pm

Re: I want to create an OS!!!

Post by chentedev »

Mmm but im trying develop in C# y most powerful
Chente Davila
Developer
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: I want to create an OS!!!

Post by pcmattman »

Similarly, C# also depends on a runtime (even Singularity, the 'C#' OS, has both assembly and C code).
chentedev
Posts: 4
Joined: Sat Jan 26, 2013 5:17 pm

Re: I want to create an OS!!!

Post by chentedev »

Mmmm then is possible? But implementing a interpreter ?
Chente Davila
Developer
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: I want to create an OS!!!

Post by Love4Boobies »

The bottom line is this: The lowest layer of your OS must run on bare metal and must thus end up as machine code. Whether this layer is an interpreter, a compiler, or the kernel proper, you either need to find tools that generate this mechine code from the higher-level languages you require, or implement them yourself. Note that regardless of the choices you make, some knowledge of assembly is imperative.

Generally speaking, I would say that these days C is inadequate for pretty anything other than embedded programming on resource-scarce environments, where no better alternatives exist. However, if you don't have too much experience in software development, you should definitely stick to C for a while (a) because there exist an abundance of learning materials on C applied to OS development, and (b) because your first project will likely be unambitious enough that the preparations for using higher-level languages will not be worth it---tools for use with C are readily available.

The choice of which programming languages to use is not specific to OS development. You should ask yourself the same question regardless of the software system you plan on developing. The best way to come up with an answer is to learn languages that are different enough from each other that you will expand your intellectual toolbox; you should learn which language paradigms and features are valuable under which situations (e.g., Should you use functional or procedural programming? What features of OOP, if any, do you need? What are the design goals of different exception handling mechanisms? How important is maintainability?). In fact, this will even help improve your understanding of and abilities in the languages you already know.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
feare56
Member
Member
Posts: 97
Joined: Sun Dec 23, 2012 5:48 pm

Re: I want to create an OS!!!

Post by feare56 »

Glad to see a new OSdev! I wouldn't recommend python, you need to at least know assembly for a basic kernel. But once you can change directories and run programs you could port python to your os and run python code on it as programs. If you need some basic assembly code the tutorials in the wiki will have a good start in an assembly kernel with one command that would get you to a couple of commands but not the big stuff. You also have to realize making an operating system is the hardest thing you could do on a computer, it is probably like making 10 completely different mmorpg's at the same time.
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: I want to create an OS!!!

Post by Love4Boobies »

Not to overgeneralize, but operating systems are definitely not the most difficult thing one can program, regardless of what we advertise on the wiki. Conceptually, they are quite simple. What makes them difficult is that they are actually formed of many subprojects (e.g., boot loaders, file systems, device driver interfaces, device drivers, network stacks, linkers, loaders, memory managers, schedulers, user interfaces, interprocess communication, power management, etc.). Not only must all these subprojects be executed correctly, but they also require integration. As you may already know, managing complexity is one of the most important skills an engineer must develop. Otherwise, the bigger the project, the bigger the mess. And by mess, I mean anything from bloat to halting projects or even loss of human life).
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
BMW
Member
Member
Posts: 286
Joined: Mon Nov 05, 2012 8:31 pm
Location: New Zealand

Re: I want to create an OS!!!

Post by BMW »

chentedev wrote:No can do in python? : (
It would (IMO) be easier to learn C and write it in C than write in python... C is an awesome language, I am sure you will not regret it if you learn it.
Currently developing Lithium OS (LiOS).

Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Casm
Member
Member
Posts: 221
Joined: Sun Oct 17, 2010 2:21 pm
Location: United Kingdom

Re: I want to create an OS!!!

Post by Casm »

C is by far the most widely used language in operating systems development; mostly because it was designed for that very purpose. You can't use Python, unless you can find a compiler for it - and probably not even then. Modula and its derivatives have been used.

It is also unlikely that you could get by without knowing any assembly language; although you might at least be able to get started without that if you used an "off the shelf" boot loader.
alexbnc
Posts: 14
Joined: Sun Jun 17, 2012 4:37 pm

Re: I want to create an OS!!!

Post by alexbnc »

Love4Boobies wrote:Not to overgeneralize, but operating systems are definitely not the most difficult thing one can program, regardless of what we advertise on the wiki. Conceptually, they are quite simple. What makes them difficult is that they are actually formed of many subprojects (e.g., boot loaders, file systems, device driver interfaces, device drivers, network stacks, linkers, loaders, memory managers, schedulers, user interfaces, interprocess communication, power management, etc.). Not only must all these subprojects be executed correctly, but they also require integration. As you may already know, managing complexity is one of the most important skills an engineer must develop. Otherwise, the bigger the project, the bigger the mess. And by mess, I mean anything from bloat to halting projects or even loss of human life).
"Loss of human life!?!?!?" Please, don't scare me, I'm quitting OS development right now. :D
Post Reply