G
G
gleendo2014-07-18 01:58:50
Programming
gleendo, 2014-07-18 01:58:50

How to write an operating system from scratch?

I'm waiting for adequate answers, and not like: you have nothing to do, it's not real .. etc.
In general, I'm interested in what resources are needed to write an operating system? What PLs do you need to know, how much time can it take to write an alpha version of the OS, and how difficult and generally feasible it is?

Answer the question

In order to leave comments, you need to log in

14 answer(s)
A
Alex Raven, 2014-07-24
@evgeniy8705

A very long time ago, about 17 years ago, I also got the idea to write my own operating system. By that time, I had studied the MS-DOS system quite well from the inside - I wrote resident file viruses, but, so to speak, with a constructive goal - studying the "insides" of MS-DOS (none of my viruses contained destructive functions). Unfortunately, the development of my OS did not progress further than the bootloader and file system driver, although the plans were grandiose - multitasking and support for "huge" amounts of RAM - at that time I had a 386SX with two megabytes of RAM :) Wrote in Assembler. And then I got acquainted with Watcom C (which is still alive today, under the name Open Watcom), and interest in writing my own OS finally cooled down.
You can take the source codes of any operating system and "pick" them. Regarding "you have nothing to do, it's unrealistic", etc. - really, it will give a unique experience and +100500 to respect in the circles of fellow programmers :) As for the PL - definitely C / C ++. Knowing C / C ++, you learn a new language based on it in about a week.

S
svd71, 2014-07-18
@svd71

I agree with most of my colleagues - writing operating systems for commercial use is a very troublesome task in terms of money, labor resources, time, and even marketing.
Given all this, such systems are usually written not quite from scratch. Example: QNX. The Unix kernel is taken as a basis and rewritten for a real-time system. Now they are actively selling their system for managing nuclear reactors.
The OS is a layer between third-party programs and computer hardware. Here the problem of the ability to work with the entire zoo of iron pops up - for this you need to create a driver for each piece of iron that is controlled by your OS. Some OS manufacturers have solved this problem from a marketing point of view - hardware manufacturers themselves write drivers for their system. How are you going to solve this issue? On the other hand, you need to force developers to write programs for your OS. Also pay attention to what "gingerbread" other OS manufacturers offer for this. Right there, on Habré there is a full description of these proposals.
If we are talking about creating an OS "for yourself", there are no questions - your time and your desire. You just need to analyze what features other OSes provide for developers (mostly basic ones: the ability to work with the file system and convert data to the file system from / to I / O devices and data storage.
You can also study all the rake made by others: for example, the same hummingbird, or look for the source code of some DOS (Microsoft seems to have published its dosny, TR-DOS can be found, etc.) or study the forerunner of Linux - minix (after all, Torvalds started with it). to some existing project (Minix, Linux, Kollibry, ReactOS) and start creating something for them.

S
Shamil, 2014-07-18
@jawakharlal

Gone are the days when the operating system was written by 1 person.
Now for this we need a team - a solid team

A
Alexander, 2014-07-18
@Awake

Read what operating systems are for starters and the theory behind them. The book is even such "Operating systems". And don't ask stupid questions.

M
Misha Krinkin, 2014-07-18
@kmu1990

I wrote an operating system in 10 minutes and it took only a little assembler and an idea of ​​\u200b\u200bwhat a BIOS is. The OS doesn't know anything. The answer to your question: it will take 10 minutes, a little knowledge of assembler, a little knowledge of what BIOS and google are, in short, it is quite feasible. Will this answer suit you? In my naivete, it seems to me that it is not.

M
Maksim Zverev, 2014-07-18
@m1skam

ReactOS has been sawn since 98, sorry, but 16 years, as it were, and it’s hard to even call them beta.
Do you want to write your OS with "non-boring wallpapers"?
Books have already been advised, and you will also need a lot of dough, because it’s simply not enough to pull it alone, but people want to eat other small joys of life.
Programming language, hmm C / C++

P
Pavel, 2014-07-18
@PavelMSTU

The author did not write what problem he solves and therefore it is impossible to answer his question without trash.

A
Alexander, 2014-07-24
@DrunkenMaster

If you are waiting for adequate answers, explain the problem. OS for special control. devices is one thing, a general-purpose OS is another, server-side or with a nice user interface.
In any case, you can't tell in a nutshell. If you are serious, you will have to study a bunch of material. Probably the most important resource: wiki.osdev.org/Main_Page
You can start for example with: Beginner_Mistakes and Getting_Started .

A
Artem Spiridonov, 2014-07-24
@customtema

The operating system is now easy to write (everything is relative, of course). Expensive - write enough drivers.
Those companies for which it is not expensive are faced with such a bummer: you need to find a sufficient number of people who want to write applications for their operating systems. OS without applications - who needs it? What for? Samsung and Microsoft do their best to attract developers, but their success is cosmically far from the android, apple and GNU families.
Therefore, and for a number of other reasons, it is advisable to put the question of writing another new operating system from a different angle: why?
Why can't you use ready-made developments to solve your problems? Are you sure you need the OS? New core? Or just the shell?
Perhaps it makes sense to talk not so much about financial costs as about cultural achievements - hundreds of thousands of solutions are concentrated in the cores, 30-50 years of experience. To do something differently - of course it is necessary, but it would be an adequate decision to decide - what exactly and why ?
More direct answers:
- it would be nice to understand what kind of work is meant by writing an OS? If you do not use the existing one, what exactly and why do you need to do it again? Though one could argue that it doesn't make sense...
- C/C++
- Join open source projects. This is the best school in existence. You won't learn how to program anywhere.
- Costs in large projects are measured in man-hours.

3
386DX, 2014-07-18
@386DX

How difficult is it to write your own mobile operating system?

C
cigan, 2014-07-24
@cigan

In my opinion, the answers are obvious: 100% need an assembler, MAYBE contact C (although I would choose D). Resources - Intel documentation (available on any assembler site like wasm.ru), a bit of operating system theory (protection, synchronization, IPC, microkernels).
In terms of time - if only "enter protected mode, rejoice," then quickly - an hour at most. If with a memory allocator - long, +1 month. For everything else, +6 months for each technology, because each time it gets harder. As a result, all the ardor passes in two months. :)
It makes sense for you to try QNX - a lot of things have already been written there, moreover, commercial quality and time-tested. Plus it's POSIX compliant. But there's a terrible IDE with terrible C++. But the GUI has already been written. :)
Another interesting option is COSMOS:www.codeproject.com/Articles/220071/Csharp-Open-So... - OS in C#

A
andryusha11, 2015-08-28
@andryusha11

I read, read the comments, you all delight! We take the kernel of the OS, let's say Linux, but it is still desirable to have our own kernel (you can find many tutorials on this topic on the Internet), since not every OS will work well on this kernel. In any program like DevelStudio or C, we write Desktop (Desktop), and there are all sorts of jokes like Start, bottom panel, cursor type, and so on. Or there are many tutorials on YouTube

J
Jeditobe, 2014-10-18
@Jeditobe

Direct your efforts in a useful direction and save time - join an existing project.
www.Reactos.org - I recommend.

D
Dmitry Pritykin, 2015-05-19
@maisvendoo

Here is a rough description of what you will encounter

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question