260 likes | 462 Views
Introduction to Computers and Computing. Chapter Topics. Computer Systems: Hardware and Software Programming Languages The Complete Programming Process Bits and Bytes Object-Oriented Programming. Computer Systems: Hardware.
E N D
Chapter Topics Computer Systems: Hardware and Software Programming Languages The Complete Programming Process Bits and Bytes Object-Oriented Programming
Computer Systems: Hardware Computer hardware components are the physical pieces of the computer. The major hardware components of a computer: The central processing unit (CPU) Main memory Secondary storage devices Input and Output devices
Computer Systems: HardwareCentral Processing Unit CPU ArithmeticLogicUnit Control Unit Instruction (input) Result (output)
Computer Systems: HardwareCentral Processing Unit The CPU performs the fetch, decode, execute cycle in order to process program information. The CPU’s control unit fetches, from main memory,the next instruction in the sequence of program instructions. Fetch The instruction is encoded in the form of a number. The control unit decodes the instruction and generates an electronic signal. Execute Decode The signal is routed to the appropriate component of the computer (such as the ALU, a disk drive, or some other device). The signal causes the component to perform an operation.
Computer Systems: HardwareMain Memory known as random-access memory (RAM) RAM contains: currently running programs data used by those programs RAM is volatile, which means that when the computer is turned off, the contents of RAM are erased.
Computer Systems: HardwareMain Memory RAM is divided into units called bytes. A byte consists of eight bits. Each bit holds a binary value 0 or 1. Each byte in memory is assigned a unique number known as an address.
Computer Systems: HardwareMain Memory Main memory can be visualized as a column or row of cells. 0x000 A section of memory is called a byte. A byte is made up of 8 bits. 0x001 1 0 1 0 1 0 1 0 0x002 0x003 0x004 0x005 A section of two or four bytes is often called a word. 0x006 0x007
Binary (base-2) vs. Decimal (base-10) Base-2 to Base-10 conversion 11102 = 1×23 + 1×22 + 1×21 + 0×20 = 1410 Base-10 to Base-2 conversion Base-2 table 210 29 28 27 26 25 24 23 22 21 20 1024 512 256 128 64 32 16 8 4 2 1 e.g. given a decimal number 156 1024 512 256 128 64 32 16 8 4 2 1 1 0 0 1 1 1 0 0 15610 = 100111002
Computer Systems: HardwareSecondary Storage Devices Secondary storage devices are capable of storing information for longer periods of time (non-volatile). Common Secondary Storage devices: • Hard drive • Floppy drive • CD RW drive • CD ROM • DVD drive • Compact Flash card
Computer Systems: HardwareInput Devices Input is any data the computer collects from the outside world. That data comes from devices known as input devices. Common input devices: Keyboard Mouse Scanner Digital camera
Computer Systems: HardwareOutput Devices Output is any data the computer sends to the outside world. That data is displayed on devices known as output devices. Common output devices: Monitors Printers Some devices such as disk drives perform input and output and are called I/O devices.
Computer Systems: Software Software refers to the programs that run on a computer. There are two classifications of software: Operating Systems Application Software
Computer Systems: SoftwareOperating Systems An operating system (OS) has two functions: Control/Manage the system resources CPU scheduling Memory allocation Provide the user with a means of interaction with the computer Operating systems can be either single tasking or multi-tasking.
Computer Systems: SoftwareOperating Systems A single tasking operating system is capable of running only one program at a time. DOS A multitasking operating system is capable of running multiple programs at once. Windows Unix Mac OS X
Computer Systems: SoftwareOperating Systems Operating systems can also be categorized as single user or multi-user. A single user operating system allows only one user to operate the computer at a time. Multi-user systems allow several users to run programs and operate the computer at once.
Computer Systems: SoftwareSingle User Systems Examples: • DOS • Windows • 95/98/ME
Computer Systems: SoftwareMulti-User Systems Examples: • Unix, Linux • BSD • Modern Windows Versions • NT/2000/XP/Vista/7/8 • OS/X
Computer Systems: SoftwareApplication Software Application software provides a more specialized type of environment for the user to work in. Common application software: Spreadsheets Word processors Accounting software Tax software Games
Programming Languages A programming language is a special language used to write computer programs. A program is a set of instructions with rigorous syntax a computer follows in order to perform a task. An algorithm is a set of well defined steps to complete a task. English-like pseudo code For example, to compute gross pay Get payroll data Calculate gross pay Display gross pay
Programming Languages: 1GL A computer needs the algorithm to be written in machine language (also called first generation programming language). Machine language is written using binary numbers. Each CPU has its own machine language. Motorola 68000 series processors Intel x86 series processors ARM processors, etc. Example of a machine language instruction: 1011010000000101 Machine code is tedious and unfriendly to human.
Programming Languages: 2GL Programmers developed assembly language (also called second generation programming language or low level language). Example: MOV id3, R2 MUL #60.0, R2 MOV id2, R1 ADD R2, R1 MOV R1, id1 Assembler made things easier but was also processor dependent.
Programming Languages: 3GL High level programming languages followed that were not processor dependent. Some common programming languages: Java C Visual Basic BASIC C++ Python COBOL C# Ruby Pascal PHP JavaScript
Programming Languages 4GL and 5GL Closer to natural languages The language environment provides visual programming tools that allow non-programmers to create software applications
Programming LanguagesCommon Language Elements There are some concepts that are common to all programming languages. Common concepts: Keywords Operators Punctuation Programmer-defined identifiers Strict syntactic rules