1 / 58

Introduction to Programming

Introduction to Programming. Instructor: Sanchita Mal-Sarkar Course: CIS 260. Computer. An electronic machine that accepts input, processes data, stores data, and produces output. Data can be numbers, text, images, graphics, and sound, etc.

peta
Download Presentation

Introduction to Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Programming Instructor: Sanchita Mal-Sarkar Course: CIS 260

  2. Computer • An electronic machine that accepts input, processes data, stores data, and produces output. • Data can be numbers, text, images, graphics, and sound, etc. • Computer program is a set of instructions. Without it computer is useless. • Programming languages allow us to write these instructions (e.g. C, C++, Java, etc).

  3. Computer system • A computer system consists of a computer, peripheraldevices, and software. • The computer itself can take care of the processing function, but it needs additional components, called peripherals, to accomplish its input, output and storage functions. • Example of an internal peripheral device is hard disk drive.

  4. Computer Hardware • Hardware is the physical component of a computer. • Hardware is the equipment used to perform the necessary computations. • Examples: • Main memory (RAM, ROM), secondary memory (hard disk drive, floppy disk drive), CPU, input devices (keyboard and mouse), and output devices (monitor and printer).

  5. Hardware Components of a Computer System • Central Processing Unit (CPU) • Arithmetic-Logic Unit • Control Unit Input Devices Secondary Storage • Magnetic disk • Optical disk • Magnetic tape • Keyboard • Computer mouse • Touch screen • Source data automation Buses Output Devices • Printers • Video display terminals • Plotters • Audio output Communications Devices Primary Storage

  6. Central Processing Unit (CPU) • Coordinating all computer operations. • Performs arithmetic and logical operations on data. • To process a program stored in main memory, • - CPU retrieves each instruction in sequence. • - Interprets the instruction to determine what should be done. • - Retrieves any data needed to carry out that instruction • - Then CPU performs the actual manipulation. • CPU’s current instruction and data values are stored temporarily inside the CPU in special high-speed memory locations called registers.

  7. Central Processing Unit (CPU) • The CPU consists of a control unit and an arithmetic-logic unit. • Three kind of buses link the CPU, primary storage, and other devices in the computer systems. • The data bus moves data to and from primary storage. • The address bus transmits signals for locating a given address in primary storage. • The control bus transmits signals specifying whether to read or write data to or from a given primary storage address, input device, or output device.

  8. Primary Storage 1 8 # T U Data Bus, Address Bus, and Control Bus Central Processing Unit (CPU) Arithmetic-Logic Unit 24 + 12 = 36 12 < 24 Control Unit Data Bus Address Bus Control Bus Output Devices Secondary Storage Input Devices

  9. Main Memory • Computer memory is a set of storage locations on the main circuit board (motherboard). • Four types of memory: • RAM, virtual memory, ROM, and CMOS (complementary metal oxide semiconductor memory)

  10. Random access memory • Consists of electronic circuits on the motherboard (main circuit board). • Temporarily hold programs and data while the computer is on. • Each circuit has address that is used by the microprocessor to transmit and store data. • RAM is constantly changing (volatile). • E.g. When we write a paper, the word processing program will be temporarily copied into RAM so that microprocessor can quickly access the required instructions.

  11. Virtual Memory • Today’s microcomputer software uses space on computer’s storage devices to simulate RAM if more needed. • This extra memory is called virtual memory. • How it works? • Suppose my computer is running a word processing program that takes up most of the memory in RAM, but I want to run a spreadsheet program at the same time.

  12. Virtual Memory (Cont.) • The OS moves the infrequently used segment of the word processing program into virtual memory on disk. • The spreadsheet program now can be loaded into RAM. • If that segment is later needed, it is copied from virtual memory back to RAM. • Disadvantage:It is much slower than RAM.

  13. Read-only memory(ROM) • Another set of electronic circuits on the motherboard inside the computer. • We cannot increase ROM capacity. • Manufacturer permanently installs ROM. • When computer is on, the sets of instructions in ROM checks • all the computer system’s components to make sure they are working and • activates the essential software that controls the processing function.

  14. Complementary metal oxide semiconductor(CMOS) • A chip installed on the motherboard. • Activated during the boot process. • Contains information about where the essential software is stored. • A small rechargeable battery powers CMOS. • It changes every time we add or remove hardware to the computer system. • CMOS is referred as semipermanent memory.

  15. Secondary Storage Devices • RAM retains data only when the power is on, so computer must have a more permanent storage option. • The most common magnetic storage devices are hard disk drive, floppy disk drives, and tape drives.

  16. Hard disk drive • most computers contains one hard disk that cannot be removed from drive. • Provides a storage area to be shared by all users of the computer. • Generally, the programs that are needed to operate the computer system are stored here. • Advantages over floppy disk: speed and capacity.

  17. Hard Disk Drive Internal Components

  18. Floppy disk drive • Most common magnetic storage device. • Users can have any number of floppy disks that can be inserted into computer’s floppy disk drive. • High density disk- capacity to store 1.44 MB. • Low-density disk - capacity to store 720 KB.

  19. Tape drive • Another magnetic storage device. • Provides inexpensive archival storage for large quantities of data. • Too slow to be used for day-to-day tasks. • Used to make backup copies of data stored on hard disks. • If a hard disk fails, data from the backup tape can be reloaded on a new hard disk.

  20. Compact Disk Read Only Memory (CD-ROM) • Optical storage device. • Uses laser technology to read and write data on compact discs (CDs). • High capacity and portability. Can store up to 680 MB, equivalent to more than 450 floppy disks. • Disadvantage: The surface of the CD is not rewriteable like magnetic media. Once the laser cuts a pit in its surface, the pit cannot be recut, so the data stored there cannot be changed. • Relatively slow access. Mainly used for software distribution and storing large data files such as graphics, animation, and video.

  21. Input Devices • Input device - keyboard, mouse. • When we press a letter or digit key on a key board, that character is sent to main memory and displayed on the monitor. • Keyboard consists of three major parts: main keyboard, keypads, and function keys. • A mouse is a hand-held device used to select an operation.

  22. Output Devices • Shows the result of processing data. • Output devices - monitor and printer. • Monitor is the TV-like device that displays the output from a computer. • Printer produces a hard copy of the text or graphics processed by the computer.

  23. Processing Hardware • The most important computer function is processing data. To understand this you need to learn how the computer represents and stores data. • Computer does not understand human language because it is an electronic device that interpret every signal as either “on” or “off” like a light bulb.

  24. Binary Representation of Data • For information to flow through a computer system, it must be in form suitable for processing. • All symbols, pictures, or words must be reduced to a string of binary digits. • A binary digit is called a bit and it represents either a 0 or a 1. • In the computer, the presence of an electronic or magnetic signal means “one” and its absence means “zero”. • A string of 8 bits that computer stores as a unit is called a byte. • Each byte is used to store a decimal number, a symbol, a character, or a part of a picture. • By using binary number system a computer can express all numbers as group of zeroes and ones. • There are two standard binary codes: • EBCDIC (Extended Binary Coded Decimal Interchange Code) • ASCII (American Standard Code for Information Interchange).

  25. 0 1 One bit or 0 0 1 1 0 0 0 0 0 1 0 0 0 0 1 1 Bits and Bytes 0 1 0 0 0 0 0 1 One byte for character A The Computer representation in ASCII for the name ALICE is: A 0 1 0 0 1 1 0 0 L I 0 1 0 0 0 0 1 1 C 0 1 0 0 0 1 0 1 E

  26. Data representation • Computer represents “on” with a 1 and “off” with a 0. These numbers are called binary digits or bits. • Binary number system: most widely used method for interpreting bit settings as nonnegative integers. • 38 (decimal) = 21 +22+25 = 00100110

  27. Ones complement notation • One of the widely used methods for representing negative binary numbers. • A negative number is represented by changing each bit to the opposite bit setting. • Example: • 38 (decimal) = 00100110 (binary) • -38 (decimal) = 11011001 (binary)

  28. Twos complement notation • Another popular method of representing negative binary number • In this method, 1 is added to the ones complement representation of a negative number. • Example: -38 (decimal) = 11011001 (ones complement) -38 (decimal) = 11011010 (twos complement)

  29. Floating-point notation • Usual method to represent real numbers • Real number is represented by a number, called a mantissa, times a base raised to an integer power, called an exponent. • Example: 387.53 = 38753 x 10 -2 Other possibilities .38753 x 10 3, 387.53 x100 (we choose mantissa is an integer with no tailing 0s)

  30. Floating-point notation(cont.) • A real number is represented by a 32-bit string. • 24-bit for mantissa and 8-bit for exponent. • Base is fixed to 10. • Example 100 = 0000000000000000000000100000010 -387.53 = 11111111011010001001111111111110 387.53 = 00000000100101110110000111111110 24-bit binary representation of 38753 is 000000001001011101100001 8-bit twos complement binary representation of -2 is 11111110

  31. Data Communications • Channel => The message needs some kind of medium to be transmitted. This medium is called channel. For example, telephone or coaxial cable, microwave signal, or optical fibers • Protocol => The rules that establish an orderly transfer of data between the sender and the receiver are called protocols. • Computer software and hardware establish these protocols at the beginning of the transmission, and both computers have to follow the protocols to ensure accurate transfer of data.

  32. Data Communications • The transmission of text, numeric, voice, or video data from one machine to another is called data communications. • For example, Send an electronic mail to your friends around the globe. • The four essential components of data communications are a sender, a receiver, a channel, and a protocol. • Sender => The computer that originates the message is called the sender. • Receiver => The computer at the message’s destination is called the receiver.

  33. Networks • One of the most important types of data communications in the business world is a network connection. • A network connects one computer to another computers and peripheral devices to share data and resources. • There is a number of network configurations. • local area network (LAN) => computers and peripheral devices are located relatively close to each other, generally in the same building. • Client/server networks =>Some networks have file servers (one or more computers) that act as the central storage location for programs and that provide mass storage for most of the data used on the network. A network with a file server is called a client/server networks.

  34. Networks • Peer-to-peer networks => When a network does not have a file server, all the computers essentially are equal, and programs and data are distributed among them. This is called a peer-to-peer network. • Each computer that is part of the network must have a network interface card installed. This device creates a communication channel between the computer and the network. • Network software is also essential to establish the communications protocols. • Standalone computer => A microcomputer that is not connected to a network is called a standalone computer.

  35. Telecommunications • Allows us to send and receive data over telephone lines. • A modem connects a computer to a telephone jack. • At the sending site, modem converts the digital signal from a computer into analog (continuous wave) signals (sound waves) that can traverse ordinary phone lines (modulation). • At the receiving site, a second modem converts the analog signals back into digital signals (demodulation).

  36. Telecommunications

  37. Internet • The internet was originally developed for the government to connect the researchers around the world to share data. • Today, the internet is the largest network in the world that connects millions of people in almost 200 countries. • The use of internet: • electronic mail => This is the capability to send a message from one user’s computer to another user’s computer where it is stored until the receiver opens it. Message passes through electronic links called gateways. • World Wide Web (Web) => Web is a huge database of information that is stored on the network servers in places that allow public access. The information is stored as text files called web pages.

  38. Internet • Hyperlinks => a place on a computer screen that is programmed to connect to a particular file on the same network server, or on a network server on the other side of the globe. • Web browser => communication software that help us navigate the WWW is called web browsing software or web browser.

  39. Computer Software • Software consists of the computer programs that allow us to solve problems by providing sets of instructions. • Examples: • DOS, Windows, Mac. Office family, Lotus, Netscape, Internet Explorer, Virus scans, tax programs, computer games, GUI - Graphical User Interface.

  40. Computer Software • Computer hardware is useless without software. • Software is the set of instructions and associated data that direct the computer to do a task. • Software can be divided into two categories: • system software and application software. • System software helps the computer carry out its basic operating tasks. • Application software helps the user carry out a variety of tasks.

  41. The major types of software System Software Operating Systems Schedules computer events Allocates computer resources Monitor events Application software System software Hardware Language translators Interpreters Compilers Users Application Software Programming languages Assembly language FORTRAN, BASIC, PL/1 PASCAL, C “4th generation “ languages Utility programs Routine operations (e.g. sort, list, print) Manage data (e.g. create files, merge files

  42. System Software • Manages the fundamental operations of the computer, such as • loading programs and data into memory, executing programs, saving data to disks, displaying information on the monitor, and transmitting data through a port to a peripheral device. • Three types of system software: operating systems, utilities, device drivers.

  43. Operating System • Collection of computer programs that control the interaction of the user and the computer hardware. • Responsible for directing all computer operations and managing all computer resources. • Controls basic input and output, allocates system resources, manages storage space, maintains security, and detects equipment failure. • A part of the operating system code is stored in a ROM and the rest of it resides on a disk. • Loading the operating system into memory is called booting the computer.

  44. Responsibilities of an Operating System • Communicate with user, receive and execute commands, show error messages. • Manage allocation of memory, processor time and other resources. • Collect input from keyboard, mouse, and provide data to running programs. • Convey program output to screen, printer, or other output device. • Access data from secondary storage. • Write data to secondary storage.

  45. Utilities • Another category of system software. • Augments the OS by taking over some of its responsibility for allocating hardware resources. • Many utilities come with OS. • Some independent software developers offer utilities for sale separately. • E.g. Norton Utilities by Symantec.

  46. Device driver • Each peripheral device requires a device driver. • Helps the computer communicate with that particular device. • When we add a device to an existing computer, part of its installation includes adding its device driver to the configuration.

  47. Computer programming languages • Programmer uses to write computer instructions. • The instructions are converted into electrical signals that computer can manipulate and process. • E.g. Basic, Visual Basic, C, C++, Cobol, etc.

  48. Command-line & Graphical User Interfaces • Command-line interface systems display a command prompt, then expect the user to type the desired commands. • These systems include UNIX, MS-DOS and VMS. • Graphical user interfaces (GUI) display pictures (icons), menus, and text, which the user may point to with a mouse or other pointing device, then click to select the desired function. • These systems (GUI) include Macintosh OS, Windows 95/98, Windows NT, OS/2 Warp, and Unix with X Windows interface.

  49. Application software • Developed for a specific task , such as word processing( MS Word/ WordPerfect), accounting (Lotus 1-2-3/ Excel), or database management (Access/ dBASE). • Most applications are purchased on diskette or CD-ROM. • They are installed by copying the programs from the diskettes/CD-ROM to the hard disk.

  50. Computer Languages: Machine Language • Machine language: directly understood by a computer since it is a collection of binary numbers (0 and 1). • Disadvantages: It is not standardized, different CPU needs different machine languages.

More Related