Thursday 11 August 2016

An introduction to Operating Systems

What is an Operating System?

An Operating System is an application that controls a computer. This is not the same as the applications that you create - those are usually only run when you want them. An OS runs almost as soon as the computer is turned on.
Windows is an Operating System, as is Linux and the Apple Mac OS X.

Switching On

When a computer is powered up, the CPU starts running immediately. But what does it run? On most PCs, whether Linux, Windows or Mac, there is aboot program stored permanently in the ROM of the PC.

Booting Up

Each PC motherboard manufacturer writes a boot program for their motherboard.
This boot program is not an Operating System (OS), it is there to load the OS. Its first job is the Power On Start-Up Test (aka POST). This is a system test, first checking the memory and flagging any errors. It will stop the system if something is wrong. Next it resets and initializes any devices plugged into the PC. This should result in the OS being loaded from whichever device has been configured as the boot device, be it Flash RAM, CD-Rom or hard disk

Managing The PC

The job of an OS is to manage all the resources in a computer. When user input is received from mouse and keyboard it has to be handled in a timely fashion. When you create or copy a file, the OS takes care of it all behind the scenes. It may store a file in a hundred different places on disk but it keeps you well away from that level of detail. You'll just see one file entry in a directory listing.
An OS is just a very complex collection of applications and nowadays takes hundreds or thousands of man hours to develop. We've come along way since Dos 6.22 which fitted on a 720 Kb floppy and Vista promises to be very large- 9 or 10 Gigabytes.

Protection and Security

Modern CPUs have all sorts of tricks built into their hardware - for example CPUs only permit trusted programs to run with access to all of the hardware facilities. This provides extra safety.
In Ring 0 protection on Intel/AMD CPUs, the code at the heart of the OS, usually called the Kernel code, is protected against corruption or overwriting by non Kernel applications - the kind you and I write. Nowadays it is rare for a user written program to crash a computer. The CPU will stop any attempt to overwrite Kernel Code.
Also, the CPU has several privileged instructions that can only be run by Kernel Code. This enhances the robustness of the OS and reduces the number of fatal crashes, such as the infamous Windows Blue Screen of death.
The language C was developed to write Operating Systems code and it is still popular in this role mainly for Linux and Unix systems. The Kernel part of Linux is written in C.
The operating system is arguably the most important piece of software on your PC. Read What is Software? and What is a Programming Language?for more insight into how your computer works.

No comments:

Post a Comment