Programming Fundamentals with C
II Sem, Dept.of CSE
Organization of Computer and Familiarity with hardware and software Definition of Computer A computer is an electronic device that accepts the data, processes and produces the desired output. Characteristics of computer 1 Speed: Computers perform various operations at a very high speed. 2 Accuracy: Computers are very accurate. Do not make mistakes in calculations. 3 Reliability: Computers gives correct and consistent results always evenif they are used in adverse conditions. Many times errors are caused by human interventions not by computer. Computer output is reliable, subject to the condition that the input data and the instructions(programs) are correct. Incorrect input data and unreliable programs gives us wrong results. 4 Storage Capacity: The computer can store large amount of data and can be retrieved at any time in fractions of a second. This data can be stored in permanent storage devices like hard disk, CDs etc. 5 Versatility: Computers can do a variety of jobs based on the instructions given to them. They are used in each and every field, making the tasks easier. Limitations of a Computer:1) Not intelligent 2) Inactive Computer = Hardware + Software Hardware : • Hardware is the physical aspect of computers, telecommunications, and other device. • Hardware implies permanence and invariability • The components include keyboard, floppy drive, hard disk, monitor, CPU, printer, wires, transistors, circuits etc. Software: It is a set of programs used to perform certain tasks. Program is set of instructions to carry out a particular task
1
Programming Fundamentals with C
II Sem, Dept.of CSE
Hardware and Software Hardware The physical components making up the system are termed as Hardware.
Software Software is a set of programs used to perform certain tasks(logical component) Softwares include compliers, loaders, Banking s/w, library s/w, payroll s/w etc.
The components include keyboard, floppy drive, hard disk, monitor, CPU, printer, wires, transistors, circuits etc. Hardware works based on instructions
Software tell the hardware what to do
Logical Organization of Computer
CU ALU
O/P UNIT
I/P UNIT MAIN MEMORY UNIT SECONDARY
Dotted lines indicate the control signals issued by Control unit. represent data or instructions. The lines connecting various units represent group of electrical wires Group of electrical wires is called as Bus. The four tasks that are carried out by any computer system are:
2
Programming Fundamentals with C 1. 2. 3. 4.
II Sem, Dept.of CSE
Accept the data. Process the data. Store the data Output the data. (results).
The four functions are carried out by basic functional units namely: 1. 2. 3. 4.
Input Unit. Central Processing Unit. Memory Unit. Output Unit.
Input Unit: It is an external device that is connected to the computer system The input unit is used to enter data or program (instructions) to the computer. The various input devices include keyboard, mouse, scanner, joystick etc. Output Unit: The output unit display the processed data (result). The output displayed on the monitor is called the softcopy output. And the output printed on the paper is called the hardcopy output. The various output devices include monitor, printer, speakers, plotters, LCDs, Plasma panel displays etc. Some devices act as both input and output devices such as Touch panel and modem(modulator and demodulator) Central Processing Unit: The CPU acts as a Brain of the computer. It organizes and processes the data and instructions received from the input source such as keyboard or file. The CPU refers to the microprocessor of the computer. People always refer their computers based on the type of CPU they contain. CPU consists of two units namely a) Control Unit: The control unit controls and coordinates the activities of all the units by issuing proper commands. 1. Fetching data and instructions from memory. 2. Interpreting the instructions. 3. Controlling the transfer of data and instructions to and from memory. 4. Controlling the input and output devices. 5. The overall supervision of computer system
3
Programming Fundamentals with C
II Sem, Dept.of CSE
b) Arithmetic and logic unit: In this unit, actual operations are carried out under the supervision of control unit. The control unit issues signals to ALU to perform the following activities: • •
Arithmetic unit consists of an electronic circuitry which performs basic arithmetic operations +,-,*, / and logical unit consists of logic circuitry which performs logical operations AND ,OR, NOT and relational operations. The results are send to memory unit and then to output unit.
2) Memory Unit: The memory unit store data and instructions. This is also called as storage device The memory unit does the following. • Stores the instructions or data. • Stores the intermediate results. .Memory of a computer is measured in terms of bits, bytes and words Bits = 0 or 1 1 nibble = 4 bits 1 Byte = 8 bits 1 Kilo Byte = 1024 bytes 1 Mega Byte = 10 6 bytes 1 Word = Sequence of 16bits or 2 bytes. Computer Memory is classified in to 2 types namely 1) Main memory:- Temporary memory, because data and instructions are lost when the computer is switched off .It is also referred to as primary memory. • It is Internal to the computer system. • CPU can access directly. • Volatile memory. • Semiconductor memory. • Expensive. • Less storage capacity • e.g.: ROM(non volatile), RAM (Volatile), etc. RAM (Random access memory) :It is read write memory. It is just like a page of a notebook, where you can write something to or read something from. All the programs are brought into RAM just before execution. ROM(Read Only Memory) : It is Non volatile .It stores mainly the 4
Programming Fundamentals with C
II Sem, Dept.of CSE
monitor programs and BIOS(Basic Input Output System) Programs. The information stored in it can only be read but cannot be modified. The contents of ROM can be programmed under special conditions. It is manufacturer programmed memory 2) Secondary Memory(Auxillary memory): It is Permanent memory It stores a large amount of information for a long time. It is also called as backup memory. Made up of magnetic material. Magnetic Tape, magnetic disk and drum are secondary devices • External to the computer system. • CPU can’t access directly. • Non-volatile memory. • Magnetic memory • not expensive • Large storage capacity • e.g.: magnetic storage devices like floppy disk, hard disk, pen drive.Optical storage devices like CD, DVD etc Another type of memory used in computer system is : Cache Memory:- High Speed Memory, placed between the CPU and the main memory. Data & instructions stored in it are accessed at a higher speed as compared to the main memory. Users cannot access this memory. It stores data and instructions that are currently to be executed
Differences between: Primary Memory Also called as Main memory. Accessing the data is faster. CPU can access directly Semiconductor memory. Data storage capacity is less. Expensive. It is Internal memory. Examples : RAM, ROM
Secondary Memory Also called as Auxiliary memory. Accessing the data is slow. CPU cannot access directly Magnetic memory. Data storage capacity is more or huge. Not expensive. It is External memory. Examples: hard disk, floppy disk, magnetic tape etc.
5
Programming Fundamentals with C
II Sem, Dept.of CSE
RAM Random Access Memory. Volatile memory. The contents of the RAM are lost when power is turned off. Temporary storage medium. The data can be read and written.
ROM Read Only Memory. Non-volatile memory. The contents of the ROM are not lost when power is turned off. Permanent storage medium. The data can only be read, but the data cannot be written. BIOS and monitor programs are stored.
The programs are brought into RAM just before execution.
Categories of Software: System software Collection of programs written by expert programmers/manufacturers. System software can be used to control the computer system. System software helps in executing other programs. Examples include compilers, loaders .Operating System etc.
Application software Collection of programs written by users (programmers). Application software is written to perform particular task. Application software are not used for executing other programs. Examples include Banking s/w, library s/w, payroll s/w etc
-----------------------End--------------------
Uploaded by Nix
6
Programming Fundamentals with C
II Sem, Dept.of CSE
7