• Embed Doc
  • Readcast
  • Collections
  • CommentGo Back
Download
1
Note: This was originally a lecture notes for Operating Systems (CS321) students at BITS

Pilani. Later, this was accepted for publication with Tata Mc Graw Hill Publishers. Most of the material contained in this book is due to the experience I gained through implementation of BiOpSy in somewhat unrefined ways like using hex-editors, raw disk editors etc. Due to lack of time, I am not able to follow through with this endeavor. You are free to distribute it as long as this note is in tact.

Dinesh
June 1, 2002
Making of an Operating System \u2013 A Bottom-up Approach
Table of contents
Preface
Table of contents
1. Introduction
2. Hardware primer
IBM PC overview
CPU
System buses: CPU \u2013 memory/IO link
Memory subsystem
IO devices
2.1
Disk
2.1.1. Disk physics
2.1.2. Hard disk partitioning
2.1.3. FAT file system format
2.2.
Processor and its modes of operation
2.2.1. Real mode
2.2.2. Protected mode
Why protected mode?
Differences
- Operand size
- Interrupt mechanism
3. Bootstrap
3.1. OS executes itself
3.2. BIOS and boot sequence
3.3. Hand coding
3.4. Viruses
4. Implementation of a real mode operating system
5. OS loading and system initialization
5.1. Memory and disk layouts
5.2. Initialization sequence
6. The kernel
6.1. Device drivers
2
- keyboard
7. Tools
7.1. Binary editors
7.2.Assemblers and disassemblers
7.3.Compilers
7.4.Emulators
7.5.Partition Managers
Appendices

??Boot sector format
??MBR format
??FAT Directory entry format
??COFF format
??PEF format
??BIOS Interrupt listing
??8086 instruction set
??System memory map

3
Preface

Prevalent conception of working on a computer is to power the computer, wait until it \u2018boots\u2019 and login prompt appears, log into the system and start working. This process is so mechanized that people have taken for granted that it is something essential for a user to be able to work on a computer. Can\u2019t we run a program without booting the system? We very well can. In fact, an operating system is a program of that kind. There are so many aspects of OS implementation that are abstruse to most people interested in this field. Did you ever wonder what an executable file had? What does all that \u2018junk\u2019 inside an executable mean?

Right from the very first programming course we undertook we are used to writing application programs for different operating systems. But writing an OS itself is not as common. After undergoing the basic course on operating systems at under-graduate level, everyone knows what round robin scheduling is, what semaphores are. But after knowing all this, can you make your own OS? Not many computer science graduates can implement an OS. One should be able to see the big picture of an OS with all these things in place. Is writing an OS that difficult? Well, not quite. The reason essentially is lack of information. Many people around the world are starved of some basic information. No book tells you how to write an OS in its entirety. Unfortunately some of the very basic things like bootstrapping are considered too trivial by most authors and algorithmic aspects of operating systems are emphasized. To implement an OS one needs the information which bridges the wide rift between what we learn in class and what actually exists. This book will supplement the prescribed textbook for a course on Operating Systems at under graduate level thus enabling you to implement a minimal OS. This is not a book for dummies. The knowledge of basic assembly programming was assumed while preparing the manuscript. If you are one of those inquisitive souls who always feels a tickle at hand to do something \u2018different\u2019, and who has the zeal to learn things, this is the book for you.

Now that we are writing a stand alone OS we don\u2019t have any other OS underneath our OS to help us out in IO. There are no printf and scanf routines available. You have to implement all IO routines yourself. While implementing the bootstrap loader you might have to work with raw bytes of instructions in the program. Certain things might seem weird and unconventional. But then, remember that we are going to implement an OS not any application program. You can no longer hold the same perception of the software you use for programming. Compilers, assemblers etc are just tools. You should realize that they are too dumb to trust. You should in principle be able to do whatever you expect a tool to do for you. You\u2019ll understand the implications of this during the course of your study with this book. You\u2019ll learn how much fun it is to do all this.

There are myriad of operating systems existing in the market. Then, why write yet another? Our mission is not to market our OS and beat Microsoft. After all, we are trying to learn things. An operating system spans a wide variety of functionality. Writing an operating system demands a good understanding of anything to do with programming and hardware.

of 00

Leave a Comment

You must be to leave a comment.
Submit
Characters: ...
You must be to leave a comment.
Submit
Characters: ...