***Welcome to ashrafedu.blogspot.com * * * This website is maintained by ASHRAF***

Posts

    Thursday, September 24, 2020

    Linking and Loading

     

    Linking and Loading

    Linking and Loading are the utility programs that play a important role in the execution of a program. Linking intakes the object codes generated by the assembler and combines them to generate the executable module. On the other hand, the loading loads this executable module to the main memory for execution.

    Loading:
    Bringing the program from secondary memory to main memory is called Loading.

    Linking:
    Establishing the linking between all the modules or all the functions of the program in order to continue the program execution is called linking.


    Differences between Linking and Loading:

    1. The key difference between linking and loading is that the linking generates the executable file of a program whereas, the loading loads the executable file obtained from the linking into main memory for execution.
    2. The linking intakes the object module of a program generated by the assembler. However, the loading intakes the executable module generated by the linking.
    3. The linking combines all object modules of a program to generate executable modules it also links the library function in the object module to built-in libraries of the high-level programming language. On the other hand, loading allocates space to an executable module in main memory.



    Compiler and Interpreter

       Introduction to Compiler

    • A compiler is a translator that converts the high-level language into the machine language.
    • High-level language is written by a developer and machine language can be understood by the processor.
    • Compiler is used to show errors to the programmer.
    • The main purpose of compiler is to change the code written in one language without changing the meaning of the program.
    • When you execute a program which is written in high level programming language then it executes into two phases.
    • In the first phase, the source program compiled and translated into the object program (low level language).
    • In the second phase, object program translated into the target program through the assembler.

     Interpreter

    Interpreter also converts the high level language into machine readable binary equivalents. Each time when an interpreter gets a high level language code to be executed, it converts the code into an intermediate code before converting it into the machine code. Each part of the code is interpreted and then execute separately in a sequence and an error is found in a part of the code it will stop the interpretation of the code without translating the next set of the codes.

    Interpreter Vs Compiler

    Interpreter

    Compiler

    Translates program one statement at a time.

    Scans the entire program and translates it as a whole into machine code.

    Interpreters usually take less amount of time to analyze the source code. However, the overall execution time is comparatively slower than compilers.

    Compilers usually take a large amount of time to analyze the source code. However, the overall execution time is comparatively faster than interpreters.

    No intermediate object code is generated, hence are memory efficient.

    Generates intermediate object code which further requires linking, hence requires more memory.

    Programming languages like JavaScript, Python, Ruby use interpreters.

    Programming languages like C, C++, Java use compilers.



     


    Programming Languages

    Programming Languages


    A programming language defines a set of instructions that are compiled together to perform a specific task by the CPU (Central Processing Unit).

    The programming language mainly refers to high-level languages such as C, C++, Pascal, Ada, COBOL, etc.

    Each programming language contains a unique set of keywords and syntax, which are used to create a set of instructions. These languages vary in the level of abstraction they provide from the hardware. Some programming languages provide less or no abstraction while some provide higher abstraction.


    Based on the levels of abstraction, they can be classified into two categories:

    • Low-level language
    • High-level language

    Assembly language provides less abstraction whereas high-level language provides a higher level of abstraction.

    Low-level language

    The low-level language is a programming language that provides no abstraction from the hardware, and it is represented in 0 or 1 forms, which are the machine instructions. The languages that come under this category are the Machine level language and Assembly language.

    a.      Machine-level language

    The machine-level language is a language that consists of a set of instructions that are in the binary form 0 or 1. As we know that computers can understand only machine instructions, which are in binary digits, i.e., 0 and 1, so the instructions given to the computer can be only in binary codes. Creating a program in a machine-level language is a very difficult task as it is not easy for the programmers to write the program in machine instructions. It is error-prone as it is not easy to understand, and its maintenance is also very high. A machine-level language is not portable as each computer has its machine instructions, so if we write a program in one computer will no longer be valid in another computer.

    The different processor architectures use different machine codes, for example, a PowerPC processor contains RISC architecture, which requires different code than intel x86 processor, which has a CISC architecture.

    b.      Assembly Language

    The assembly language contains some human-readable commands such as mov, add, sub, etc. The problems which we were facing in machine-level language are reduced to some extent by using an extended form of machine-level language known as assembly language. Since assembly language instructions are written in English words like mov, add, sub, so it is easier to write and understand.

    As computers can only understand the machine-level instructions, a translator is required to convert the assembly code into machine code. The translator used for translating the code is known as an assembler.

    The assembly language code is not portable because the data is stored in computer registers, and the computer has to know the different sets of registers.

    The assembly code is not faster than machine code because the assembly language comes above the machine language in the hierarchy, so it means that assembly language has some abstraction from the hardware while machine language has zero abstraction.

    The following are the differences between machine-level language and assembly language:

    Machine-level language

    Assembly language

    The machine-level language comes at the lowest level in the hierarchy, so it has zero abstraction level from the hardware.

    The assembly language comes above the machine language means that it has less abstraction level from the hardware.

    It cannot be easily understood by humans.

    It is easy to read, write, and maintain.

    The machine-level language is written in binary digits, i.e., 0 and 1.

    The assembly language is written in simple English language, so it is easily understandable by the users.

    It does not require any translator as the machine code is directly executed by the computer.

    In assembly language, the assembler is used to convert the assembly code into machine code.

    It is a first-generation programming language.

    It is a second-generation programming language.

     










    High-Level Language

    The high-level language is a programming language that allows a programmer to write the programs which are independent of a particular type of computer. The high-level languages are considered as high-level because they are closer to human languages than machine-level languages.

    A compiler is required to translate a high-level language into a low-level language.

    Advantages of a high-level language

    • The high-level language is easy to read, write, and maintain as it is written in English like words.
    • The high-level languages are designed to overcome the limitation of low-level language, i.e., portability. The high-level language is portable; i.e., these languages are machine-independent.

    o    The following are the differences between low-level language and high-level language:

    Low-level language

    High-level language

    It is a machine-friendly language, i.e., the computer understands the machine language, which is represented in 0 or 1.

    It is a user-friendly language as this language is written in simple English words, which can be easily understood by humans.

    The low-level language takes more time to execute.

    It executes at a faster pace.

    It requires the assembler to convert the assembly code into machine code.

    It requires the compiler to convert the high-level language instructions into machine code.

    The machine code cannot run on all machines, so it is not a portable language.

    The high-level code can run all the platforms, so it is a portable language.

    It is memory efficient.

    It is less memory efficient.

    Debugging and maintenance are not easier in a low-level language.

    Debugging and maintenance are easier in a high-level language.

    Generation of Programming Languages

    Generation of Programming Languages

    There are five generation of Programming languages. They are:

    First Generation Languages :
    These are low-level languages like machine language.

    Second Generation Languages :
    These are low-level assembly languages used in kernels and hardware drives.

    Third Generation Languages :
    These are high-level languages like C, C++, Java, Visual Basic and JavaScript.

    Fourth Generation Languages :
    These are languages that consist of statements that are similar to statements in the human language. These are used mainly in database programming and scripting. Example of these languages include Perl, Python, Ruby, SQL, MatLab(MatrixLaboratory).

    Fifth Generation Languages :
    These are the programming languages that have visual tools to develop a program. Examples of fifth generation language include Mercury, OPS5, and Prolog.

    The first two generations are called low level languages. The next three generations are called high level languages.



    Operating System

     Operating System

    Ø  An operating system is a type of software without which you cannot operate or run a computer.

    Ø  It acts as an intermediary or translation system between computer hardware and application programs installed on the computer.

    Ø  The operating system is itself a program or software, it allows users to run other programs or applications on the system.

    The common functions of an operating system includes –

          Process(or) management : The operating system decides which process gets to run, for how long and perhaps at what priority or level of importance.

          Memory management : Operating system is responsible for keeping track of which parts of the memory are currently being used and by whom.

          Device management : The operating system allocates the various devices to the processes and initiates the I/O operation. It also controls and schedules accesses to the input/output devices among the processes.

          File Management : The operating system keeps track of every file in the system, including data files, program files, compilers, and applications. The file system is an operating system module that allows users and programs to create, delete, modify, open, close, and apply other operations to various types of files. It also allows users to give names to files, to organise the files hierarchically into directories, to protect files, and to access those files using the various file operations.

          Provides user interface: It acts as an interface between the user and the hardware. It can be a GUI where you can see and click elements on the screen to perform various tasks. It enables you to communicate with the computer even without knowing the computer's language.

          I/O management: It manages the input output devices and makes the I/O process smooth and effective. For example, it receives the input provided by the user through an input device and stores it in the main memory. Then it directs the CPU to process this input and accordingly provides the output through an output device such as a monitor.

          Security: It has a security module to protect the data or information stored in the memories of the computer against malware and unauthorised access. Thus, it not only manages your data but also helps to protect it.


    Generations of Computers

    Generations of Computers

    A generation of computers refers to the specific improvements in computer technology with time. In 1946, electronic pathways called circuits were developed to perform the counting. It replaced the gears and other mechanical parts used for counting in previous computing machines.

    There are five generations of computers which are described below:

    1.      First Generation Computers

    The first generation (1946-1959) computers were slow, huge and expensive. In these computers, vacuum tubes were used as the basic components of CPU and memory. These computers were mainly depended on batch operating system and punch cards. Magnetic tape and paper tape were used as output and input devices in this generation;

    Some of the popular first generation computers are;

    • ENIAC ( Electronic Numerical Integrator and Computer)
    • EDVAC ( Electronic Discrete Variable Automatic Computer)
    • UNIVACI( Universal Automatic Computer)
    • IBM-701
    • IBM-650

    2.      Second Generation Computers

    The second generation (1959-1965) was the era of the transistor computers. These computers used transistors which were cheap, compact and consuming less power; it made transistor computers faster than the first generation computers. In this generation, magnetic cores were used as the primary memory and magnetic disc and tapes were used as the secondary storage. Assembly language and programming languages like COBOL and FORTRAN, and Batch processing and multiprogramming operating systems were used in these computers.

    Some of the popular second generation computers are;

    • IBM 1620
    • IBM 7094
    • CDC 1604
    • CDC 3600
    • UNIVAC 1108

    3.      Third Generation Computers

    The third generation computers used integrated circuits (ICs) instead of transistors. A single IC can pack huge number of transistors which increased the power of a computer and reduced the cost. The computers also became more reliable, efficient and smaller in size. These generation computers used remote processing, time-sharing, multi programming as operating system. Also, the high-level programming languages like FORTRON-II TO IV, COBOL, PASCAL PL/1, ALGOL-68 were used in this generation.

    Some of the popular third generation computers are;

    • IBM-360 series
    • Honeywell-6000 series
    • PDP(Personal Data Processor)
    • IBM-370/168
    • TDC-316

    4.      Fourth Generation Computers

    The fourth generation (1971-1980) computers used very large scale integrated (VLSI) circuits; a chip containing millions of transistors and other circuit elements. These chips made this generation computers more compact, powerful, fast and affordable. These generation computers used real time, time sharing and distributed operating system. The programming languages like C, C++, DBASE were also used in this generation.

    Some of the popular fourth generation computers are;

    • DEC 10
    • STAR 1000
    • PDP 11
    • CRAY-1(Super Computer)
    • CRAY-X-MP(Super Computer)

    5.      Fifth Generation Computers

    In fifth generation (1980-till date) computers, the VLSI technology was replaced with ULSI (Ultra Large Scale Integration). It made possible the production of microprocessor chips with ten million electronic components. This generation computers used parallel processing hardware and AI (Artificial Intelligence) software. The programming languages used in this generation were C, C++, Java, .Net, etc.

    Some of the popular fifth generation computers are;

    • Desktop
    • Laptop
    • NoteBook
    • UltraBook
    • ChromeBook

    Types of Computers

    Types of Computers

    Computers are divided into different types based on different criteria. 

    1. Micro Computer
    2. Mini Computer
    3. Mainframe Computer
    4. Super Computer
    5. Workstations

    1. Micro Computer:

    It is a single-user computer which has less speed and storage capacity than the other types. It uses a microprocessor as a CPU. The first microcomputer was built with 8-bit microprocessor chips. The common examples of microcomputers include laptops, desktop computers, personal digital assistant (PDA), tablets, and smartphones. Microcomputers are generally designed and developed for general usage like browsing, searching for information, internet, MS Office, social media, etc.

    2. Mini Computer:

    Mini-computers are also known as "Midrange Computers.". They are multi-user computers designed to support multiple users simultaneously. So, they are generally used by small businesses and firms. Individual departments of a company use these computers for specific purposes. 

    3. Mainframe Computer:

    It is also a multi-user computer capable of supporting thousands of users simultaneously. They are used by large firms and government organizations to run their business operations as they can store and process large amounts of data. For example, Banks, universities, and insurance companies use mainframe computers

    4. Super Computer:

    Super-computers are the fastest and most expensive computers among all types of computers. They have huge storage capacities and computing speeds and thus can perform millions of instructions per second. The super-computers are task-specific and thus used for specialized applications such as large-scale numerical problems in scientific and engineering disciplines including applications in electronics, petroleum engineering, weather forecasting, medicine, space research and more.

    5. Work stations:

    It is a single-user computer. Although it is like a personal computer, it has a more powerful microprocessor and a higher-quality monitor than a microcomputer. In terms of storage capacity and speed, it comes between a personal computer and minicomputer. Work stations are generally used for specialized applications such as desktop publishing, software development, and engineering designs.

    What is Computer?

     

    What is Computer?

    A computer is a programmable electronic device that accepts raw data as input and processes it with a set of instructions (a program) to produce the result as output.

     The term "computer" is derived from the Latin word "computare" which means to calculate.

    It is believed that the Analytical Engine was the first computer which was invented by Charles Babbage in 1837. Charles Babbage is also known as the father of the computer.


    There are 5 main computer components that are given below:

    • Input Devices
    • CPU
    • Output Devices
    • Primary Memory
    • Secondary Memory
            Inputting: It is the process of entering raw data, instructions and information into the computer.              It is performed with the help of input devices.

        Storing: The computer has primary memory and secondary storage to store data and instructions. It stores the data before sending it to CPU for processing and also stores the processed data before displaying it as output.

       Processing: It is the process of converting the raw data into useful information. This process is performed by the CPU of the computer. It takes the raw data from storage, processes it and then sends back the processed data to storage.

      Outputting: It is the process of presenting the processed data through output devices like monitor, printer and speakers.

     Controlling: This operation is performed by the control unit that is part of CPU. The control unit ensures that all basic operations are executed in a right manner and sequence.

      Ø  Central Processing Unit (CPU)

    A Central Processing Unit is also called a processor, central processor, or microprocessor. It carries out all the important functions of a computer. It receives instructions from both the hardware and active software and produces output accordingly.

    Generally, a CPU has three components:

    • ALU (Arithmetic Logic Unit)
    • Control Unit
    • Memory or Storage Unit


    Control Unit: It is the circuitry in the control unit, which makes use of electrical signals to instruct the computer system for executing already stored instructions. It takes instructions from memory and then decodes and executes these instructions. So, it controls and coordinates the functioning of all parts of the computer. The Control Unit's main task is to maintain and regulate the flow of information across the processor. It does not take part in processing and storing data.

    ALU: It is the arithmetic logic unit, which performs arithmetic and logical functions. Arithmetic functions include addition, subtraction, multiplication division, and comparisons. Logical functions mainly include selecting, comparing, and merging the data. A CPU may contain more than one ALU. Furthermore, ALUs can be used for maintaining timers that help run the computer.

    Memory or Storage Unit/ Registers: It is called Random access memory (RAM). It temporarily stores data, programs, and intermediate and final results of processing. So, it acts as a temporary storage area that holds the data temporarily, which is used to run the computer.

    Top