Basic Theory Of Computer Science

From OSDev.wiki
Revision as of 15:10, 19 January 2020 by osdev>Atomicscience
Jump to navigation Jump to search
This page is a work in progress.
This page may thus be incomplete. Its content may be changed in the near future.

This article is intend to explain to new users, who are unfamiliar with computer theory, basic concepts of computing and computer systems organization and structure.

The idea of the creation of this article was inspired by the general disorganization of such kind of theoretic articles and pages at OSDev.org. And as long as theory is very important for beginners (and as long as they generally never ever read serious books), this chaotic structure of theoretic material will cause problems in comprehensive study of OS development. But this article is meant to fix the problem

Managing the complexity of electronic systems

Levels of abstraction

The system you are using to read this article (let me guess it's a personal computer) is one of most complex systems ever created by the mankind. Just imagine hundreds of billions transistors on several separate integrated circuits joint together and operating at gigahertz rates, running hundreds of millions lines of code in a blink of an eye - hundreds of thousands of computer scientists, engineers and programmers united their efforts to make this miracle come true in less than 80 years...

However, I bet you are not experiencing any kind of trouble with using such a "miracle". The main reason of it is that, despite you don't realize it really, you are managing complexity of your system. It have let you to open this article in few mouse clicks (it's not so complex task to complete, right?) without having to keep in mind details of, for example, the PCI protocol your CPU use to direct data to your graphics processor.

Usually developers identify 9 levels of abstraction for an average electronic computing system:

  1. Physics
    Explores the world and systematizes obtained knowledge to laws and theories which can be relatively easily studied by other persons
  2. Devices
    Uses physical models to create devices, such as transistors and diodes, usable in circuits
  3. Analog Circuits
    Combines devices to create circuits with desired properties
  4. Digital Circuits
    Uses analog circuits to create models of the digital circuits, which can be used in digital design
  5. Logic
    Combines digital circuits to create functional blocks, such as adders, multiplexers and so on.
  6. Microarchitecture
    Implements an architecture using logic elements
  7. Architecture (also known as ISA)
    Describes electronic system from programmer's perspective. Defines instruction set, visible registers. Is implemented by microarchitecture
  8. Operating System
    Operates computer hardware, manage system resources and provide API and drivers for application software
  9. Application Software
    Programs, which use operating system features to solve user problems

As you can see, each abstraction level use models and features of underlying level (e.g. logic uses digital circuits as much as application software uses operating system features) Also, each level hides details of implementation from the overlying level (e.g. user do not have to bother about representing their requests in "computer" form as long as application software provides the human-understandable GUI)

And it means, that each layer accomplishes two tasks:

  • Provides simplified interfaces for overlying layers
    For example, there are no files on the hard disk of your PC - only some bytes written to it in the specified order. File is just an abstract model of storing files on the physical drive, implemented by a filesystem - one of the parts of your operating system. So, filesystem provides a very convenient interface for application software, by implementing a simple file I/O
  • Hides implementation details from overlying layer and manages them
    For example, our filesystem also contains drivers for different types of storage devices, such as hard drives, optical drives and so on. Each one have its own interface to handle. However, you, as a user, don't want to keep these details in mind. So, filesystem takes care of it, hiding such a details from user, managing all that low-level things by itself.

So now, let us have a look at each level, starting form the physics

Physics layer

Physics, according to its definition[1], is the "natural science that studies matter, its motion and behavior through space and time, and the related entities of energy and force".