HOW THE UNIX OPERATING SYSTEM WORK | UNIX OPERATING SYSTEM

UNIX OPERATING SYSTEM


UNIX OPERATING SYSTEM
OPERATING SYSTEM

CREATING  A PROGRAM

Once we upload the UNIX system in the memory then the computer is ready to receive the program.  The file be must enter into a file. The file name consists of letters, digit, and special characters like a dot and a letter c
Examples are
                          hello.c
                          program.c
                          ebgl.c
The text editor is used to creating the file, the text editor may be ed or vi. The command for calling the editor and creating the file is 
                                                                
                                          ed filename.

Any correction in programming is done by the editor.


                         When is the file is over, then the file is saved on disk. The program that is entered into the file is known as the source program Since it represents the original form of the program.




COMPILING AND LINKING

UNIX OPERATING SYSTEM unix,unix operating system,unix os,unix server,unix system,unix linux,unix computer,about unix,unix and linux
COMPILING

Let us assume that the source program has been created in a file name  hello.c. Now the program is ready for compilation. The compilation command to achieve this work under UNIX is  cc.hello.c.
The source program instructs to translate them into a suitable form for execution by the computer.
 The translation is done after examining each instruction for its correctness. The translated program stored in another file with the name hello1.o. This program is known as object code.

Linking is the process of putting together other program files and functions that are required by the program. For example, if the program is using exp() function, then the object code of this function should be brought from the math library of the system and linked the program.                                   


 If any mistake in the syntax of the language occurs, then they are listed out and the compilation process ends right there. The error should be corrected in the source program with help of an editor and the compilation is done again.
             

The compiled and the linked program is called the executable object code and is stored automatically in another file name a.out.                                                                                                            


EXECUTING THE PROGRAM

UNIX OPERATING SYSTEM unix,unix operating system,unix os,unix server,unix system,unix linux,unix computer,about unix,unix and linux
EXECUTION

The command a.out would load the executable object code into the computer memory and execute the instructions. During execution, the program may request for some data to be entered through the keyboard. Sometimes the program does not produce the desired result. sometimes is wrong with the program logic or the data. Then it is necessary to correct the source program or data. In case the source program is modified, the entire process of compiling, linking and executing the program should be repeated.

NOTE: The linker always assigns the same name a.out.

when we compile another program, this file will be overwritten by the executable object code of the new program. If we want to prevent from happening, we should rename the file immediately by using the command mv a.out name or cc -o name source -file

MULTIPLE SOURCE  FILE

To compile and link multiple sources program file, we must append all the name to the cc command.

              cc filename-1.c.....filename-n.c 
These files will be separately compiled into object files called
                     filename-i.o

and then linked to produce an executable program file a.out.     




UNIX OPERSTING SYSTEM unix,unix operating system,unix os,unix server,unix system,unix linux,unix computer,about unix,unix and linux
COMPILATION OF MULTIPLE FILES
  It is also possible to compile each file separately and link them later. For example the commands
                                                        cc -c mod1.c
                                                         cc -c mod2.c   
will compile each files mode1.c and mode2.c into objects files mod1.c.o and mod2.c.o. They can be linked together by commands
                        cc mode1.c.o mod2.c.o. 
We may also combine the source files and object files as follows:
                         cc mod1.c mod2.o
The only mod1.c is compiled and then linked with the object file mod2.o. This approach is useful when one of the multiple source files need to be changed and recompile or an already existing object file is to be used along with the program to be compiled.



MS-DOS SYSTEM

The program can be created using any word processing software in non-document mode. The file name should end with the characters ".c" like program.c etc. Then the command MSC PLAY. C under the MS-DOS operating system would load the program stored in the file PLAY.c and generate the object code. The code is stored in another file under name PLAY.obj. In case any language errors are found, the completed. The program should then be corrected and compiled again.

The linking is done by the command 
                                                   LINK PLAY.obj
Which generates the executable code with the filename PLAY.exe. Now command PLAY would execute the program and give the result

Comments