Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Compiled by : S. Agarwal, Lecturer & Systems Incharge St. Xavier’s Computer Centre, St. Xavier’s College Kolkata. March-2003 WHAT IS PROGRAM A program is a sequence of instructions that a computer can interpret and execute. It is developed using high level computer languages. WHAT IS SOFTWARE Software is computer program or a set of programs, which provides the instructions which enable the computer hardware to work. Two main types of software are system software (operating systems), which control the workings of the computer, and applications, such as word processing programs, spreadsheets, and databases. Types of Languages Used to Write a Software Machine Language Assembly Language High Level Language Machine Language • A set of machine instructions written using binary code that a processor can understand. • A processor interprets and translates machine instructions into HW signals. Example: the instruction to add 2 numbers stored in registers A and B might look like this: 00000011 11000011 Problems: Binary representation of instructions and data are not easily generated, manipulated, or understood by humans. The languages are machine dependent. Writing program in machine language requires the knowledge of the internals of the computer. Assembly Language • A symbolic form of machine language • Allows alphabetic mnemonics for operation codes and storage locations • There exists one-to-one correspondence between assembly instructions and machine instructions. Example: M. L. Instruction: Equivalent A.L. Instruction: 00000011 11000011 ADD A, B Advantages …. Ease: Because of the use of mnemonics it is more understandable and easy to remember than a machine language code.. Speed: programs in AL run faster than those written in high level languages. Compactness: routines include only code that programmers want to include. Versatility: anything that can be done with a computer can be done with AL Problems …. Big programs in assembly language : harder to write and error prone. The languages are machine dependent. The programmer must still be aware of the internal architecture of the target machine. High Level Language Use English like codes that are easier to remember. Generally machine (architecture) independent. Provides language constructs for specifying and manipulating complex data structures. Supports a variety of programming styles (i.e. linear, object oriented) Hides the low level architectural details from the programmer i. e. dose not normally require the knowledge of the internal architecture of the computers. Example : C, C++, Pascal, COBOL, Java Binary codes Some binary codes used to represent information in a digital computer: 1) BCD Code 2) ASCII Code 3) Gray Code 4) EBCDIC Code 5) Excess-3 Code BCD CODE BCD stands for Binary-Coded Decimal. A BCD number is a four-bit binary group that represents one of the ten decimal digits 0 through 9. Example: Decimal number 4926 4 9 2 6 8421 BCD coded number 0100 1001 0010 0110 THE ASCII CODE ASCII is acronym for American Standard Code for Information Interchange Represents numbers, letters, punctuation marks and control characters Standard ASCII is a 7-bit code (127 characters) Extended ASCII (IBM ASCII), an 8-bit code, is also very popular Extended ASCII adds graphics and math symbols to code (total of 256 symbols) ASCII : Example ….. BIT PATTERN 01000001 01100001 00110001 00101011 00100000 00101101 00011100 00101100 ASCII CODE 65 97 49 43 32 45 28 44 CHARACTER A a 1 + ( , 0x000000 00100111101111011111111111100000 0x000004 10101111101111110000000000010100 0x000008 10101111101001000000000000100000 0x00000c 10101111101001010000000000100100 0x000010 10101111101000000000000000011000 0x000014 10101111101000000000000000011100 Used to translate other 0x000018 10001111101011100000000000011100 forms of languages00000001110011100000000000011001 into 0x00001c 0x000020 00000000000000000111100000010010 machine language. 0x000024 10001111101110000000000000011000 0x000028 00000011000011111100100000100001 0x00002c 10101111101010000000000000011100 0x000030 00100101110010000000000000000001 Three types of commonly 0x000034 10101111101110010000000000011000 00101001000000010000000001100101 used0x000038 translators are : 0x00003c 00010100001000001111111111110111 1) Assembler 00111100000001000001000000000000 0x000040 0x000044 00110100100001000000010000110000 2) Compiler 0x000048 10001111101001010000000000011000 3) Interpreter00001100000100000000000011101100 0x00004c 0x000050 00000000000000000001000000100001 0x000054 10001111101111110000000000010100 0x000058 00100111101111010000000000100000 0x00005c 00000011111000000000000000001000 Translators Assembler • A program that converts assembly code into machine code • After translation creates object module i.e. the machine language representation of a program How does an assembler work ? Compiler Translates high-level code into machine language code. Produces object code (Translated Instructions ready for computer ) by translating the source code ( high-level language instruction ). Object code is stored in the machine and can be used repeatedly. SOURCE CODE PROGRAM TRANSLATION PROCESS COMPILER OBJECT CODE LINKAGE EDITOR LOAD MODULE OTHER OBJECT CODE MODULES Digital Computer as a Multilevel Machine Applications Level Translation (Compiler) Assembly Language Level Machine code Operating System Level Machine code Translation (Assembler) Partial Interpretation, Partial Pass-through Interpretation (microprogram) Microprogram Level Directly executed by hardware Hardware Machine Language Level Digital Logic Level Software High Level Language Level Interpreter Like compiler translates a high level language into machine language. Unlike compiler translates the program at the time of executing the program instruction by instruction. The translated code is not stored permanently in computer’s memory, hence before each execution interpretation becomes necessary. As object code is not stored in the computer, execution of the program becomes slower because of the need for interpretation before each execution. Normally it is easier to design an interpreter than a compiler. Generations of Languages 1st. Since 1940s. MACHINE LANGUAGE: binary code. 2nd. Since early ’50s. ASSEMBLY LANGUAGE: mnemonics for numeric code. 3rd. Since mid ‘50s. HIGH-LEVEL LANGUAGES: procedural in nature. e.g. C, C++, COBOL 4th. Since late ‘70s. MODERN APPLICATION PACKAGES: non-procedural in nature. e.g. Structured Query Language (SQL) SYSTEM SOFTWARE The system softwares are programs specially designed for controlling the computer hardware, ensuring the proper utilization of the computer resources and providing a convenient environment to the users of the computer to work with. Example: Operating system, Compiler, Interpreter, Loader, Linker APPLICATION SOFTWARE These are programs developed by the users of the computer to perform a specific task. They can be of two types: a) Ready Made: These are programs developed by software companies for general purpose applications. These programs can be bought and can be installed for performing some predefined job. Examples : MS-WORD, FACT, TALLY, FOXPRO etc. b) Customized or Tailor made : These are programs developed for SPECIFIC USER REQUIREMENT within an organization. These programs are developed by programmers as per the user requirements. Example: Library Management System, Hotel Management System, Railway Reservation System SOFTWARE LAYERS APPLICATION SOFTWARE OPERATING SYSTEM: SYSTEM SOFTWARE SCHEDULED COMPUTER EVENTS ALLOCATES COMPUTER RESOURCES HARDWARE MONITORS EVENTS LANGUAGE TRANSLATORS: INTERPRETERS COMPILERS UTILITY PROGRAMS: ROUTINE OPERATIONS PROGRAMMING LANGUAGES: MANAGE DATA ASSEMBLY LANGUAGE; FORTRAN; COBOL; PL / 1; QBASIC; PASCAL; C; C++; FOURTH GENERATION LANGUAGES Operating System A system software that acts as an intermediary between the user and the computer and works as Interface manager • Human interaction made easy • interfacing, abstraction, control and sharing Resource manager • Efficient use of resources System and data security and protection provider. Control program that prevents the system from improper use and takes care of error situations Jobs of an O.S. : Providing User Interface …… Operating system provides these facilities for the user: • Program creation : editors, debuggers, other development tools. • Program execution : load, files, IO operations. • Access to IO devices: Read and writes. • Controlled access to files: protection mechanisms, abstraction of underlying device. • System access: Controls who can access the system. Jobs of an O.S. : As a Resource Manager……. Processors : Allocation of processes to processors, preemption, scheduling. Memory: Allocation of main memory. IO devices : when to access io devices, which ones etc. Files: Partitions, space allocation and maintenance. Process : Applications, Data, objects. Jobs of an O.S. : Providing Protection and Security …….. When sharing resources, protection of the systems and user resources from intentional as well as inadvertent misuse. Protection generally deals with access control. Ex: Read only file Security deals usually with threats from outside the system that affects the integrity and availability of the system and information with the system. Example: username, password to access system. Data encryption to protect information. Evolution of Operating System… Serial Processing Batch Processing Multiprogramming Time Sharing Parallel System Distributed System Real Time System Serial Processing (Early 1950’s) Typical setup: • Users would sign up for a time slot (e.g., 2am-3am) • During that slot, had exclusive use of the computer • Must load program into memory space, overwriting old conten Drawbacks: • Inconvenient for user • Wasteful of computer time (computer was idle during setup, debugging Batch Processing ( Mid 1950s) Typical setup: • Users would submit jobs on cards/tape to computer operator • Operator would combine multiple jobs into a single batch job and load into card/tape reader • Each user job would be executed in turn • Users received output after all jobs finished the primitive operating system in charge of executing the batch job was called a resident monitor it resided permanently in memory it monitored the execution of each job in succession Multiprogramming (Early 1960s) Typical setup: •Users submitted jobs to computer operator •Jobs were loaded into separate memory partitions •Computer would begin executing first job •During idle period, could switch to another job •User could receive output as soon as their job terminated Advantages and Drawbacks … Advantages: • Interactive ness is restored. • CPU is kept busy. Disadvantages: • Hardware and O.S. required become significantly more complex Content of Primary Memory in Single/Multi program systems PROGRAM 1 UNUSED MEMORY MULTIPROGRAMMING ENVIRONMENT OPERATING SYSTEM OPERATING SYSTEM TRADITIONAL SINGLEPROGRAM SYSTEM PROGRAM 1 PROGRAM 2 PROGRAM 3 UNUSED MEMORY Time Sharing (Mid 1960s) Typical setup: 7.11 Many users share large capacity CPU: Time in CPU divided into slices ( e.g.,2 milliseconds) Each user has access to CPU during slice. If the job is not completed within the given time slice, it is preempted and the next job gets the CPU. The preempted jobs gets the CPU back after all other jobs get a chance to get the CPU New computer architectures new demands Multiprocessor Systems ( parallel systems or tightly coupled systems) • More than one processor in close communication, share bus and clock, other resources • Can increase throughput, save on shared resources, provide greater reliability Distributed systems ( loosely coupled systems) Distribute the computation among several processors, each with its own memory & resources Processors communicate via communications lines, e.g., high-speed buses or phone lines Similar benefits as multiprocessor, but generally simpler, cheaper, more scaleable but slower. New architectures (cont.) Real-time systems Some systems impose well-defined, fixed-time constraints where large number of events external to the system are required to be taken care of. e.g., control for scientific experiments, medical imaging systems, industrial control systems. Hard real-time: Critical tasks must be completed in specified time Secondary storage limited or absent, data stored in short term memory or ROM Not compatible with timesharing Soft real-time: Critical tasks are given priority over other tasks, but no guarantees Limited utility in industrial control of robotics