Beruflich Dokumente
Kultur Dokumente
What is a Computer?
Computer
Device capable of performing computations and making logical decisions Computers process data under the control of sets of instructions called computer programs
Hardware
Various devices comprising a computer Keyboard, screen, mouse, disks, memory, CDROM, and processing units
Software
Programs that run on a computer
Computer Organization
Six logical units in every computer:
Input unit
Obtains information from input devices (keyboard, mouse)
Output unit
Outputs information (to screen, to printer, to control other devices)
Memory unit
Rapid access, low capacity, stores input information
Computer Architecture
A Computer Consists of
a central processing unit (CPU) consists of an arithmetic/logic unit (ALU) where math and logic operations are performed, a control unit which directs most operations by providing timing and control signals, and registers that provide short-term data storage and management facilities. a memory unit that stores instructions and data, and input (e.g. keyboard, mouse, microphone, disk drive, etc.) and output (e.g. monitor, status indicator lights, speakers, disk drive, etc.) units that are used to transmit data into and out of the computer.
ALU
A : The type of operation that the ALU needs to perform is determined by signals from the control unit . B: The data can come either from the input unit, or C: from the memory unit. D: Results of the operation can either be transferred back to the memory unit or E: directly to the output unit .
The memory unit - or random access memory (RAM) stores instructions and/or data. Memory is divided into an array of "boxes" each containing a byte of information.
A byte consists of 8 bits. A bit (binary digit) is either 0 (OFF) or 1 (ON). The memory unit also serves as a storage for intermediate and final results of arithmetic operations.
F : Control signal (a read or a write operation). G : A location in memory H : Input to memory data lines when the control signal J is enabled. I : Memory to the output unit when the control signal L is enabled.
Control Unit
contains logic and timing circuits that generate the appropriate signals necessary to execute each instruction in a program. It fetches an instruction from memory by sending an address (G) and a read command (F) to the memory unit. The instruction word(s) stored at the memory location specified by the address is then transferred to the control unit (K). After decoding this instruction, the control unit transmits the appropriate signals to the other units in order to execute the specified operation. This sequence of fetch and execute is repeated by the control unit until the computer is either powered off or reset.
Common Softwares
Operating System Compilers Assemblers Interpreters
Multiprogramming
Computer resources are shared by many jobs or tasks (users still waited a long time for their output)
PL hierarchy
Assembler
Instructions written in assembly language must be translated to machine language instructions :
Assembler does this
One to one translation : One AL instruction is mapped to one ML instruction. AL instructions are CPU specific.
Compiler
Instructions written in high-level language also must be translated to machine language instructions :
Compiler does this
Generally one to many translation : One HL instruction is mapped to many ML instruction. HL instructions are not CPU specific but compiler is.
Interpreter
An interpreter translates high-level instructions into an intermediate form, which it then executes. In contrast, a compiler translates high-level instructions directly into machine language. Compiled programs generally run faster than interpreted programs. The advantage of an interpreter, however, is that it does not need to go through the compilation stage during which machine instructions are generated. This process can be time-consuming if the program is long. The interpreter, on the other hand, can immediately execute high-level programs. For this reason, interpreters are sometimes used during the development of a program, when a programmer wants to add small sections at a time and test them quickly.
Typed Languages
Type information was added to programs to improve efficiency.
For ex. An integer addition is performed more efficiently than floating point addition. Hence it is more advantageous to declare the value/variable as integer whenever it is possible.
For example..
1. A language is strongly typed if it contains compile-time checks for type constraint violations. If all checking is deferred to run time, it is weakly typed. 2. A language is strongly typed if it contains compile- or run-time checks for type constraint violations. If no checking is done, it is weakly typed. 3. A language is strongly typed if conversions between different types are forbidden. If such conversions are allowed, it is weakly typed.
More Examples..
4. A language is strongly typed if conversions between different types must be indicated explicitly. If implicit conversions are performed, it is weakly typed. 5. A language is strongly typed if there is no language-level way to disable or evade the type system. If there are C-style casts or other type-evasive mechanisms, it is weakly typed.
Structured Programming
Structured programming
Disciplined approach to writing programs Clear, easy to test and debug and easy to modify
Structured programming
Only the following code structures are used to write programs: 1.Sequence of sequentially executed statements. 2.Conditional execution of statements (i.e., "if" statements). 3.Looping. 4.Structured SubRoutine calls.