1 / 54

CSL101: Introduction to Computers and Programming: Lecture 1: Introduction

CSL101: Introduction to Computers and Programming: Lecture 1: Introduction. Instructors Prof Saroj Kaushik Room No : 416, Bharati School building (CSE) Phone Number : 1292 (internal) Email : saroj@ cse.iitd.ernet.in Web Link : http://www.cse.iitd.ac.in/~saroj Prof K K Biswas

ghalib
Download Presentation

CSL101: Introduction to Computers and Programming: Lecture 1: Introduction

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. CSL101: Introduction to Computers and Programming: Lecture 1: Introduction Instructors Prof Saroj Kaushik Room No : 416, Bharati School building (CSE) Phone Number : 1292 (internal) Email : saroj@ cse.iitd.ernet.in Web Link : http://www.cse.iitd.ac.in/~saroj Prof K K Biswas Room No : 313, Bharati School building (CSE) Phone Number : 6010 (internal) Email : kkb@cse.iitd.ac.in Web Link : http://www.cse.iitd.ac.in/~kkb

  2. 1st semester 2011-2012: Time Table

  3. Course contents • Introduction to Computers • Problem solving using computers • Development of algorithms? • Introduction to programming in a high level language: Python • Syntax and semantics • Algorithms for various applications • Advanced features of Python • Number Representations • Sorting algorithms

  4. Course Grading Structure • These weights are indicative, and may change as semester progresses • Minor 1 & 2, each with 15-20% weightage • Major, 30-35% weightage • Quizzes and home assignments, 5-10% weightage • Programming exercises, 20-25% weightage

  5. Submission of lab reports • Labs will be conducted by TAs in CSC. • Lecture slides, Lab exercises will be posted on web or Moodle http://www.cse.iitd.ac.in/~saroj • For each exercise there will be a deadline for submission of report/code. • Be sure that you complete the exercise well before the deadline and submit the report in time. • We will not tolerate excuses (power fail, server down, printer fault, lab closed, etc.). • Heavy penalty for late submission

  6. To pass the course • A student has to pass EACH of the course components indicated above, by getting at least 30% in each. • Student should get minimum 35% overall to pass the course. • Attend all classes and should be above 75%. • Classes will begin on time and entry will not be allowed later than 5 minutes. • Cheating in tests or assignments will result in ‘F’ grade in the course. • Attend the “Special Help sessions” if you have difficulty in the course. • Keep meeting your TA ( Teaching Assistant) for any difficulty in the course outside the lab timings as well.

  7. Text books • For Algorithm: • R. G. Dromey “How to solve it by computer”, Prentice Hall, Indian edition. • Link to an online material on Python Programming: www.greenteapress.com/thinkpython/thinkpython.pdf

  8. Introduction to Computers

  9. What is a Computer? • Electronic device • Capable of performing • arithmetic operations on numbers • logical operations on bits (binary digit) • decision test • retrieval, manipulation and storage of large amount of data at a very high speed

  10. What Does A Computer Do? • Computers can perform four general operations, which comprise the information processing cycle. • Input • Process • Output • Storage • To do each of these computer has devices.

  11. Devices that comprise a computer system Monitor (output) Speaker (output) System unit (processor, memory…) Printer (output) Storage devices (CD-RW, Floppy, Hard disk, zip,…) Mouse (input) Scanner (input) Keyboard (input) 11

  12. Why Is a Computer So Powerful? The ability to perform the information processing cycle with amazing speed. Reliability (low failure rate). Accuracy. Ability to store huge amounts of data and information. Ability to communicate with other computers. 12

  13. How Does a Computer Know what to do? It must be given a detailed list of instructions, called a computer program or software, that tells what exactly it has to do. Before processing a specific job, the computer program corresponding to that job must be created and stored in memory. Once the program is stored in memory the computer can start the operation by executing the program instructions one after the other. 13

  14. Computer System • A computer system is made up of both • Hardware electronic components • Software  Program consisting of set of instruction • Example: Some of the Anology: • Mobile is hardware and corresponding facilities available is software. • CD is hardware and music on it is software.

  15. Hardware Components Of A Computer ? • Input devices. • Output devices. • Central Processing Unit • Memory. • Storage devices.

  16. The Keyboard • The most commonly used input device is the keyboard on which data is entered by manually keying in or typing certain keys. • A keyboard typically has 101 or 105 keys.

  17. The Mouse Is a pointing device which is used to control the movement of a mouse pointer on the screen to make selections from the screen. A mouse has one to five buttons. The bottom of the mouse is flat and contains a mechanism that detects movement of the mouse.

  18. Output Devices Output devices make the information resulting from the processing available for use. The two output devices more commonly used are the printer and the computer screen. The printer produces a hard copy of your output, and the computer screen produces a soft copy of your output.

  19. The Central processing Unit, CPU The CPU contains electronic circuits that cause processing to occur. Does the `work‘ of fetching, storing and manipulating values that are stored in the computers memory. It is considered the “brain” of the computer.

  20. Main Components of CPU • Arithmetic Logic Unit (ALU) • The ALU carries out arithmetic operations (e.g. addition and subtraction) and logical operations (e.g. and, or, not) • Control Unit (CU) • The CU controls the execution of instructions.

  21. Memory • Memory consists of electronic components that store data including numbers, characters, graphics and sound. • It has two types of memory. • Random Access Memory (RAM) • Read only Memory (ROM)

  22. Random Access Memory – RAM • RAM is where programs and data are kept during execution when the processor is actively using them. • RAM is called Main memory or Primary memory. • RAM • Is Volatile - temporary • Has random access to any memory location • Read & write access • Program + data reside in this memory

  23. Main Memory • Main memory is: • very closely connected to the processor. • the contents are quickly and easily changed. • holds the programs and data that the processor is actively working with. • interacts with the processor millions of times per second.

  24. Read only Memory - ROM • Read only Memory (ROM) • Non volatile • Only read access • Permanent programs reside

  25. Cache Memory • A special and very high speed memory used to increase the speed of processing. • Cache is sometimes called CPU cache • Transfer from cache to CPU is very fast as compared to from main memory to CPU. CPU ALU + CU Main Memory Cache

  26. Cache Memory • It lies between CPU and main memory. • The cache is usually filled from main memory when instructions or data are fetched into the CPU. • Often the main memory will supply a wider data word to the cache than the CPU requires, to fill the cache more rapidly. • It is expensive and usually small in size. • Stores only segments of programs currently being executed by CPU. • It is also sometimes called buffer.

  27. Storage Devices- Secondary memory • Connected to main memory • The contents are easily changed, but this is very slow compared to main memory. • It is used for long-term storage of programs and data. • The processor only occasionally interacts with secondary memory. • The most common types of secondary storage used are • Hard disks • CD-ROM drives • Flash Drives (USB, pen drives)

  28. Hard Disk • The hard disk has enormous storage capacity compared to main memory • 300 times the amount of storage in main memory • The hard disk is usually contained in the systems unit of a computer.

  29. Primary memory Fast Expensive Low capacity Connects directly to the processor Secondary memory Slow Cheap Large capacity Not connected directly to the processor Reasons for having two types of storage

  30. Data Representation in Memory • Data is stored inside the memory in the form of 1’s and 0s, Bits (Binary Digits) as shown below (ON/OFF positions). • For example 1100 0111 0011 1111 0101 1110 • One byte consists of 8 bits.

  31. Contd… • How many distinct values can be stored in one byte? • Answer: 28 • Minimum Value: 0  0000 0000 • Maximum value: 28–1  1111 1111

  32. Organization of Main Memory • Main memory consists of a very long list of bytes. • In most modern computers, each byte has an address that is used to locate it. • The picture shows a small part of main memory:

  33. Each row is called memory location that is a single byte and has an address. • The addresses are the integers to the left of the boxes: 0, 1, 2, 3, 4, ... 255 for location of one byte. • The addresses for most computer memory start at 0 and go up in sequence until each byte has an address. • The bits at a memory location are called the contents of that location. • Each location contains a pattern of eight bits, each bit is either 0 or 1. • When people say that a computer has "128 MB of RAM" they are talking about how big its main memory is.

  34. Units of Memory 1 KB (1 KiloByte) contains 1024 Bytes. 1 MB (1 MegaByte) consists of 1024 KB. 1 GB (1 GigaByte) has 1024 MB. 1 TB (1 Terabyte consists of 1024 GB.

  35. Table of units of measurement

  36. Software Computer programmers/users write the codes/ instructions that make-up software applications/programs. Set of instructions is also referred to as lines of code. Without software a computer is useless, just as a car without someone to drive it. To get a computer to perform a specific task, it must be given a sequence of unambiguous instructions called a program written in some programming language.

  37. Types of Programs • There are two categories of programs. • Application programs (usually called just "applications") that people use to get their work done. • Systems programs keep all the hardware and software running together smoothly. • The difference between "application program" and "system program" is fuzzy. • Often it is more a matter of marketing than of logic.

  38. Application Programs Word processors Game programs Spreadsheets Data base packages Graphics programs Web browsers Systems Programs Operating system. Networking system. Database system. Compilers Web site server. Data backup.

  39. Example of Types of Software Application Software Operating system Software

  40. Operating Systems (OS) • OS coordinates the operation of all the hardware and software components of the computer system. • The operating system is responsible for starting application programs running and finding the resources that they need. • When an application program is running, the operating system manages the details of the hardware for it. • It is there in the background managing resources, doing input and output for the application, and keeping everything else running. • The operating system is always present when the computer is running.

  41. Resources managed by OS • OS is a complex collection of many programs that governs the control of various resources such as: • Processor • Main Memory • Secondary storage • I/O devices • Files • The operating system is software; the same hardware can be used with many different operating systems (although only one at a time.)

  42. Various Modules of OS • There are various modules of OS • Processor management • Memory management • Device management • Information management • These modules resolve conflicts, optimize performance and acts as an interface between the user’s program and computer hardware. • Modern operating systems usually come with a user interface that enables users to easily interact with application programs by using windows, buttons, menus, icons, the mouse, and the keyboard.

  43. Examples of operating systems are • DOS, Unix, Windows 98, Windows NT, Linux, Solaris, etc. • There are different OS for different kinds of machines. • Single user machine • Batch processing • Multiprogramming • Time sharing • Real time machines

  44. Programming Languages

  45. Machine Language • Consider machine of 16-bits Opcode (4-bits) Address (12-bits) • There are 16 possible opcodes (Hypothetical example) Opcode Action 0000 Load accumulator (ACC)from memory 0001 Store accumulator in memory 0010 Add the contents of Acc with specified location and leave the result in ACC 1111 stop

  46. Instructions Load ACC from Loc 10 Add ACC with contents of Loc 20 Store ACC contents in Loc 30 Stop Machine language 0000 0000 0000 1010 0010 0000 0001 1010 0001 0000 0001 1110 1111 0000 0000 0000 M/L program

  47. Assembly Language Load X Add Y Store Z Print Z Stop High level Language (pascal, C, C++, Java) Input X, Y Z = X+Y Output Z Stop • One assembly instruction is equivalent to machine instruction • One high level inst corresponds to many machine instruction

  48. All CPUs have an instruction set (or language) that they understand. • Eventually all assembly level / high level programs must be translated (or compiled) into instructions from this set. • Roughly speaking, all processors have the same sort of instructions available to them. • An executable program is machine language program that runs on a CPU and is always represented as a series of binary digits. • This is achieved by compiling (translating) a high-level program with a special piece of software called a compiler. • Compilers are incredibly complicated programs that accept other programs as input and generate a binary executable object file as output.

  49. Types of Files • As far as the hard disk is concerned, all files are the same and are named collections of bytes. Of course, what the files are used for is different. • The OS can take a • program file, copy it into main memory, and start it running. • data file, and supply its information to a running program when it asks. • Often then last part of a file's name (the extension) shows what the file is expected to be used for. For example, • "mydata.txt" the ".txt" means that the file is expected to be used as a collection of text, that is, characters. • “netscape.exe" the ".exe" means that the file is an "executable," that is, a program that is ready to run. • "program1.java" the ".java" means that the file is a source program in the language java (there will be more about source programs later on in these notes.) • To the hard disk, each of these files is the same sort of thing: a collection of bytes.

  50. Example Problem : Consider the problem of converting F (Fahrenheit) to C (Centigrade) which is suitable for solution by computer. Formula: C = 5 * (F – 32) / 9 • Set of possible high level instructions: Input : F (given parameters) Output: C (output parameters) read F C = 5 * (F – 32 ) / 9 print C end

More Related