How to develop an operating system for a computer

Table of contents:

How to develop an operating system for a computer
How to develop an operating system for a computer
Anonim

Operating systems, composed of hundreds of thousands of lines of code, enable users to interact with computer hardware. They are usually written in the C, C ++ and assembler programming languages.

Steps

Make a Computer Operating System Step 1
Make a Computer Operating System Step 1

Step 1. First, learn programming

Knowledge of assembler is essential; It is highly recommended that you also be aware of other additional lower-level programming languages such as C.

Make a Computer Operating System Step 2
Make a Computer Operating System Step 2

Step 2. Decide on which device you want to boot the operating system

This can be a CD, DVD, flash drive, hard drive, or other computer.

Make a Computer Operating System Step 3
Make a Computer Operating System Step 3

Step 3. Decide what you want your operating system to look like

Should it be a full version of the OS with a graphical user interface (GUI), or maybe something more minimalistic? You need to know which direction to go in before starting the process.

Make a Computer Operating System Step 4
Make a Computer Operating System Step 4

Step 4. Check which processor platform your operating system will support

AI-32 and x86_64 are the two most common versions for personal computers, so they can be considered the best choice.

Make a Computer Operating System Step 5
Make a Computer Operating System Step 5

Step 5. Decide whether you prefer to do everything yourself from scratch, or if there are kernels on the basis of which you would like to build on the system

Linux from scratch is a project for those who wish, for example, to create their own Linux distribution.

Make a Computer Operating System Step 6
Make a Computer Operating System Step 6

Step 6. Choose whether you are going to use your own bootloader or the previously created Grand Unified Bootloader (GRUB)

Because coding your own boot program requires extensive knowledge of computer software and BIOS, it can push back the programming schedule for the actual kernel.

Make a Computer Operating System Step 7
Make a Computer Operating System Step 7

Step 7. Decide on the programming language you are going to use

Of course, it is quite possible to develop an operating system in a language such as Pascal or BASIC, but it is preferable to write in C or assembler. Assembler is absolutely necessary, since some important parts of the operating system require knowledge of this particular language. C ++, on the other hand, contains the keywords required to run the full OS.

To build an OS using C or C ++ code, you will, of course, use one compiler or the other. This means that you should read the manual / instructions / documentation for the C / C ++ compiler of your choice that comes bundled with the software or is available on the distributor's website. You will have to learn a lot of complicated things about the compiler, and you will also need to learn its schema and ABI to improve C ++. You are expected to understand the various execution formats (ELF, PE, COFF, regular binaries, etc.) and notice that Windows' native PE format (.exe) is copyrighted

Make a Computer Operating System Step 8
Make a Computer Operating System Step 8

Step 8. Select the Application Programming Interface (API)

One collection of good APIs is POSIX, as it is well documented. All Unix systems have at least partial POSIX support, so it would be trivial to add Unix programs to your operating system.

Make a Computer Operating System Step 9
Make a Computer Operating System Step 9

Step 9. Decide on the design

There are monolithic kernels and microkernels. Monolithic kernels perform all services in the kernel, while microkernels have a small kernel combined with a custom service implementation. In general, monolithic kernels are faster, but microkernels have better isolation and protection against possible faults.

Make a Computer Operating System Step 10
Make a Computer Operating System Step 10

Step 10. Consider development and teamwork

This way, you will need less time to resolve big problems, which will allow you to create a better operating system in a shorter time frame.

Make a Computer Operating System Step 11
Make a Computer Operating System Step 11

Step 11. Don't erase your hard drive completely

Remember, formatting your drive will permanently erase all of your data! Use GRUB or another manager to duplicate booting your computer from another OS until your version is fully functional.

Make a Computer Operating System Step 12
Make a Computer Operating System Step 12

Step 12. Start small

Pay attention to the little things first, such as displaying text and interrupts, before moving on to complex elements like memory management and multitasking.

Make a Computer Operating System Step 13
Make a Computer Operating System Step 13

Step 13. Keep a backup copy of the latest working version

This gives you some peace of mind in case something goes completely wrong with your current version of your OS or subsequent add-ons. In the event of a breakdown of your computer and the inability to boot, as you yourself understand, having a second copy for work will be an excellent opportunity, so that you can fix the existing faults.

Make a Computer Operating System Step 14
Make a Computer Operating System Step 14

Step 14. Test your new operating system in a virtual machine

Instead of restarting your computer every time you make changes or transfer files from your production computer to a test machine, you can use an application to run the OS in a virtual machine while your current OS is still running. VM applications include VMWare (which also has a freely available server), alternative open source, Bochs, Microsoft Virtual PC (not Linux compatible), and XVM VirtualBox.

Make a Computer Operating System Step 15
Make a Computer Operating System Step 15

Step 15. Release the release version

This will allow users to tell you about possible flaws in your operating system.

Make a Computer Operating System Step 16
Make a Computer Operating System Step 16

Step 16. The operating system should also be user-friendly, so be sure to add useful features that will become an integral part of your design

Advice

  • When the development is finished, consider whether you want to make the code freely available or to establish private rights to it.
  • Make sure to make security features your top priority if you want your system to be viable.
  • Don't start an operating system development project for the purpose of teaching programming. If you do not know C, C ++, Pascal, or any other suitable languages and properties, including pointer types, low-level bit operations, bit switching, inline assembler, etc., then you are not ready to create OS.
  • Browse portals such as OSDev and OSDever to help you improve your own operating system. Please note in particular that for most of the issues, the OSDev.org community prefers that you consult the site content yourself rather than joining the forum. If you nevertheless decide to join the ranks of the members of the forum, there must be certain prerequisites for this. You must have a thorough knowledge of C or C ++ and the x86 assembly language. You should also understand general and complex programming concepts like Linked Lists, Queues, etc. The OSDev community in its rules explicitly states that no one is going to babysit new programmers. If you are trying to develop an OS, it goes without saying that you are a "god" in the field of programming. You are also required to read the processor manual for the architecture of your choice; for example x86 (Intel), ARM, MIPS, PPC, etc. Such a reference to processor structure can be easily found by searching Google ("Intel Manuals", "ARM manuals", etc.). Don't sign up on the OSDev.org forum to ask obvious questions. It will just lead to answers like "Read the f *** ing Manual". To get started, you should try reading Wikipedia, tutorials for the various tools you intend to use.
  • Check for potential blind spots and other bugs. Shortcomings, dead ends, and other issues can affect the design of your operating system.
  • If you want an easier way, imagine Linux distributions such as Fedora Revisor, Custom Nimble X, Puppy Remaster, PCLinuxOS mklivecd, or SUSE Studio and SUSE KIWI. However, the OS you create is owned by the company that first introduced the service (although you have the rights to freely redistribute, modify and run it as you like under the GPL).
  • A good solution is to create a completely new partition for the operating system under development.

Warnings

  • Careless rewriting of the OS to the hard drive can damage it completely. be careful
  • You won't have a complete system in two weeks. Start with a bootable operating system and then move on to more interesting material.
  • If you do something reckless, like write messy bytes in random I / O ports, then destroy your OS and can (in theory) burn your hardware.
  • Don't expect it to be easy to build a quality operating system. There are many complex interdependencies. For example, for an OS to be able to handle multiple processors, your memory manager must have "locking" mechanisms to prevent unnecessary processors from accessing the same resource at the same time. The "blocks" used assume a scheduler to make sure that only one processor is accessing a critical resource at any given time, and all others are idle. However, the scheduler depends on the presence of the memory manager. This is an example of a deadlock dependency. There is no standard way to solve these kinds of problems; each operating system creator is expected to be skilled enough to come up with their own solution.

Popular by topic