Category Archives: Basic

Bits and Bytes

The word Bit is short for Binary Digit. The Bit consists of two values usually 0 or 1 are also known as on or off. Computer only understand the 0 or 1 and not any other thing. Everything we store in computer is stored in format of 0 and 1. Now the question arose why it only understand 0 or 1 and the answer is computers system is based on the two options: switches on the microchip that are either on or off. After about 50 years of research and practice it was established that standard 8 bits are to be used to store the value of a character known as byte. Thus a single byte consumes the 8 bits. For the calculations bases the integer 2 is used as the base because the bit may be on or off. If you closely see the ASCII table you will find that Capital Letter ‘A’ is given the number 65 because on 65 number all the 8 bits come on function and the need for another bit is required after 128 but up to that all the characters of alphabetic are included in the 8 bits. Thus every character used 1 byte i,e, 8 bits.

ASCII has defined 0 to 32 ASCII numbers as codes for things like carriage return, line feed, addition, subtraction and escape etc. 33rd number is given for the space and from 34th to 64th contains the special signs and numbers and from 65th to 122nd alphabets characters in upper and lower case and 123 to 127th some extra character such as dot and delete.

Why Bits & Bytes Important for Programming?

Now why they are important, you must have heard about the processors have 16 bit, 32 bit and 64 bit. Worlds first CPU is made of 1 bit processor buts its purpose is very limited such as calculations and other simple things they calculate this which can be stored up to 128 bits only but then they upgraded the CPU of 2 bit Processor they program can stock the value up to 256 bits, the programmers at this level started doing assembly language but it is very difficult to do so. But when 4 bit processors are invented the programmers got 512 bits to store the value. At this level many new things started to pop up and by the time when 4 bit processors are ready, the worlds most popular language is also ready to deal with it with 1024 bits of storing capacity. The math results or values can be stored easily and make them easily solvable and this time computers are one of the best device for Army to do equations for their strategy.

When 8 bit processors are made the worlds most successful Language C is developed and Intel in 1972 started with 8008 processors, it was very successful and also known as “Mark-8”.

Between 1972 to 1980, the 12 bit processors are made but they give most of the their research to next processors which were worlds best processors know as commercially.

In early 80’s, Intel introduced the x86 family first processor of 16 bits and it is also known as Intel 8086. Operating System DOS also known as MS-DOS is also ready. With 16 bit processors many new programs are written and they are very successful such as WordStar, Lotus 1-2-3 etc. softwares. Most of the popular softwares are written in C, such as DOS and WordStar. In America 16 bits processors are commercially very successful but the world is unknown  about computers and thus they started exporting product to other countries up to 1999.

In 1985, the Intel introduced the 32 bit processors as next member of x86 family. In America they become the most successful and continued to rule the market until 2003. But in between 1999 to 2003 the Intel also started to export the 32 bit processors to the world but for America the 64 bits computers are already in the market in 1999 and selling like hot cakes.

In around 2007 Intel announced to export the 64 Bits of processors and since the world doesn’t know about much about advantage of 64 bits of processors it is now the most valuable product in the market. In International market 64 bits of Processors are still have to find a space in consumers. Up to 2011 Intel doesn’t issue any other processors but I am of the view that Intel had already developed 128 bits of processors and can any movement introduce them in American Market and International Market simultaneously.

But since Americans are using 64 bits of processors from many years 128 bit will find easy space in America but for the world who doesn’t know the power of 64 bits and it would take another 5-7 years to reach up to 128 bits of processors.

Tagged ,

How programs are Executed?

First of all you have to understand how the programs are executed from source code. It is very important to understand the working of any language or program. There are really two types of ways to execute program from source code and they are:

1. Interpreters

Interpreter reads the program line by line and then translate it to the machine code and then executes it. It needs the source code again and again for executing. Python, Java and PHP etc. are the language of interpreter. Every time you access a web site each page is executed with the reference of the source code. The process involves steps as:

Source Code    ===>     interpreter     ===>     Output

2. Compilers

Compilers reads the whole program and then translate it completely before giving an output. It doesn’t need the source code again and again. The compiler make a execute file which is distributed and on executing give the same output. This process involves many steps as under:

Source Code     ==>     Compiler     ==>     Translated to machine code     ==>     Object Code      ==>     Execute     ==> Output

When you compile a program, the compiler usually operates in orderly sequence of the phases called passes. The sequence happens approximately like this:

  1. First the compiler reads the source code, perhaps generating an intermediate code (such as pseudo-code) that simplifies the source code for subsequent processing.
  2. Next, the compiler converts the intermediate code (if there is any) or the original source code into an object code file, which contains machine language but it is not executable. The compiler builds a separate object file for each source file. These are only temporary and are deleted by the compiler after compilation.
  3. Finally, the compiler runs a linker. The linker merges the newly created object code with some standards, built-in object code to produce an executable file that can stand alone.

Language C

C is a Compiler execution program that is made up of, among other components, variable and functions. A variable is a way to hold some data which may vary, hence the name. For example, a variable might hold some the number 17 and later the number 41 or another variable might hold the word “Sue”. Every program has its own file extensions and in C the extension of files are as below

File names and extensions

Source code file

program_name.c

Object file

program_name.o

Executable file

program_name.exe

Header file

name.h

Library file

libname.a or libname.so

A function is a segment of text in the source code of a program that tells the computer what to do. Programming consists, in large part, of writing functions.

Tagged
%d bloggers like this: