How to Make an Operating System

By Intelmit

Operating system Operating system

Rate: (5 Ratings)

An operating system (OS) is a group of programs that help you operate your computer. It could be considered the "government" of your computer's internal society, the central program that tells the other programs what they may do and provides services they need. A computer might contain more than one operating system, but only one operating system at a time may be "in charge". The action of starting or loading the operating system is called "booting" the computer. The purpose of an operating system is to organize and control hardware and software so that the device it lives in behaves in a flexible but predictable way. Today’s operating systems tend to have graphical user interfaces (GUIs) that employ pointing devices for input. A mouse is an example of such a pointing device, as is a stylus. Commonly used operating systems for IBM-compatible personal computers include Microsoft Windows, Linux, and Unix variations.

Instructions

Difficulty: Challenging

Things You’ll Need:

  • Programming experience, preferably C or C++
  • Knowledge of assembly language and the architecture of the machine you're developing for is a definite bonus.
  • One machine that can be rebooted frequently for testing; preferably, you have another machine for editing and/or compiling.
  • Persistence and Mental Stability.
Step1
Development Environment Building a development environment consists of two machines, a development workstation and a testbed machine. The workstation needs to be a Unix variant which is able to compile GNU binutils and gcc. The testbed needs to be a 386 with at least 2 megs of RAM on a network and video card.Decide what you want your OS to do. Whether it is a fully capable OS with a GUI or something a bit more minimalistic, you'll need to know what direction you are taking it before beginning.
Step2
Compiler Compile, build the image, and boot a basic Operating System to display "Hello World!". Then, write a text output driver to handle displaying text, numbers, addresses, and more, as well as scrolling the display.Decide on your bootstrap strategy
Step3
Debugging In debugging method is The Assert() macro is a useful tool in all programming, not just in operating system development. However, it takes on extra importance in an operating system, since, without a conventional debugger, there are frequently no other convenient ways to fully test a system. Assert() is not much more than an if()/else macro, but therein lies most of its power. When the system is fully debugged, the Assert()s can be compiled out (taking up no code space and no time during execution) by turning off a compile-time definition.

Assert() simply takes a C expression and asserts its truth. If the expression is true, execution continues without any noticeable interruption. However, if the assertion is false, the program should print out some debugging information and halt immediately.
Step4
OS Kernal It is essential to understand the heart of the OS,is known as kernal, is the MOST important part of an OS. Fancy graphics and SVGA coding can all come after you have developed a solid hardcore kernel. Protect the kernel from itself, by installing exception handlers that will print out debugging information (fault type, location of fault, and machine state) for all valid exceptions.Get gdb remote debugging to work.
Step5
i386 Write an application program for your OS to load and execute. Then, interface the application to the kernel via some simple system calls and write a few of the simpler calls.Use the i386's I/O address space to extend your video driver to video driver to move the cursor as you output text.Now would also be a good time to start work on the system standard library.
Step6
Intel memory map Next decide the memory management,choose two schemes for managing memory; one for managing internal data structures in kernel memory and one for managing application memory. Lay out the address space and modify the kernel to bootstrap itself into this new model. Finally, run an application in the new address space, and handle page faults by mapping in unused pages.
Step7
Multitasking Now go for the multitasking, Start two tasks (they may or may not be the same) and context-switch between them.
Step8
Interprocess Communication Then do the interprocess communication ,start two dependent tasks that use this mechanism to effectively cooperate. Run the two tasks in different address spaces. Analyze the system to see if any race conditions exist or if deadlock could result if the system is interrupted at any random moment.
Step9
Device driver model Develop a device driver model which handles both IO and Interrupts.For the adventurous try your hand at getting PCI working.In most architecture the PCI bridge handles most everything such as Memory Mapped IO, DMA, and I/O ports it you are on a PC. All that you don't have to worry too much about except for configuring it.
Step10
Symmetric multiprocessing in OS Perform the symmetric multiprocessing. Using multiple processors which share the same physical memory in the same computer at the time.
Step11
Start small. Begin with small things such as displaying text and interrupts before moving on to things such as memory management and multitasking.
Step12
PCLinuxOS mklivecd If you want an easy way, consider Ubuntu remastersys, Fedora Revisor, Custom NimbleX, Puppy Remaster, PCLinuxOS mklivecd and SuSE KIWI.

Tips & Warnings

  • Do not wipe your hard drive completely. Use GRUB(Grand Unified Bootloader) or another boot manager to dual boot your system with another OS until yours is fully functional.
  • An alternative method of testing your new operating system is to use a virtual machine. Rather than rebooting your computer each time you make changes, or having to transfer the files from your development computer to your test machine, you use a virtual machine application to run your OS while you're current OS is still running. Two such VM applications are VMWare and the open source alternative bochs.
  • Getting a copy of the Intel developer manuals from http://developer.intel.com/products/processor/manuals/index.htm is vital.
  • The most important thing about using an OS is how its loaded. All hard drives and bootable media have something called boot sectors (typical near front cylinders of the media) that allow "execution" of your OS. As long as you comply with specific system standards and handle all your RAM right then your OS should be properly loaded.
  • Believe it or not you can use any standard command line compiler or IDE (such as Borland or MSVC++).
  • Having your operating system carelessly write to the hard drive can corrupt it completely. Be careful.
  • Be prepared to spend a good portion of your time beating your head against a wall.
  • Libraries are essentially non-existent because each operating system treats the machine in a different manner and it would be extremely difficult to write the libraries for general-purpose use.

Comments

| View All Comments
mithu12

mithu12 said

Flag This Comment

on 9/11/2008 Hi there, I came across this site and saw few of your articles - eye care and making operation system. You have done excellent work by giving such valuable info. The easy to read and understand language and very thorough knowledge and sharing techniques. It shows from your background from Intel and research scientist. Great !! keep it up.

Flag This Comment

on 5/30/2008 A well written and informative article. Thank you for taking the time to share this with us.

Intelmit

Intelmit said

Flag This Comment

on 5/30/2008 Thanks a ton !I wish to write more good articles.take care.

Flag This Comment

on 5/29/2008 Great guide here...... I sent it on to my husband as well. You did a great job!

showpup

showpup said

Flag This Comment

on 5/29/2008 Great information and love all the photos you took the time to include to show these steps. 5 stars

Post a Comment

POST A COMMENT

Request a New How-To Article

Looking for more How To information? Chances are there’s an eHow member who knows how to do what you’re looking to do. Submit an article request now!

eHow Article: How to Make an Operating System

Article By: Intelmit

Intelmit

Authority Authority | 6156 Points

Category: Computers

Articles: See my other articles

Related Ads