System Software - University Of Technology, Iraq

Transcription

1System SoftwareThere are two broad categories of software:System SoftwareApplication SoftwareSystem Software is a set of programs that manage theresources of a compute system. System Software is a collection ofsystem programs that perform a variety of functions.File EditingResource AccountingI/O ManagementStorage, Memory Management access management.System Software can be broadly classified into three types as:System control programs controls the execution of programs,manage the storage & processing resources of the computer &perform other management & monitoring function. The mostimportant of these programs is the operating system. Otherexamples are database management systems (DBMS) &communication monitors.System support programs provide routine service functions tothe other computer programs & computer users: E.g. Utilities,libraries, performance monitors & job accounting.System development programs assists in the creation of applicationprograms. E.g., language translators such as BASIC interpreter &application generators.Application Software:It performs specific tasks for the computer user. Applicationsoftware is a program which program written for, or, by, a user toperform a particular job.Languages already available for microcomputers include Clout, Q &A and Savvy ret rival (for use with Lotus 1-2-3).The use of natural language touches on expert systems,computerized collections of the knowledge of many human expertsin a given field, and artificial intelligence, independently smartcomputer systems – two topics that are receiving much attentionand development and will continue to do so in the future.Dr.shaimaa H.Shaker

21.Operating System SoftwareStorage ManagerProcess ManagerFile – System ManagerI/O Control SystemCommunication Manager2. Standard System SoftwareLanguage ProcessorLoadersSoftware Tools3. Application SoftwareSort/Merge PackagePayroll/Accounting selectronicspreadsheet has a wide variety of applications. Specific – purposeapplication s/w such as payroll & sales analysis is used for theapplication for which it is designedApplication programmer writes these programs. Applicationprogrammer writes these programs.Generally computer users interact with application software. Application andsystem software act as interface between users & computer hardware. Anapplication & system software become more capable, people find computereasier to use.The Interaction between Users, ApplicationSoftware, System Software & Computer Hardware:System Software controls the execution of the application software& provides other support functions such as data storage. E.g. whenyou use an electronic spreadsheet on the computer, MS-DOS, thecomputer’s Operating System, handles the storage of the worksheetfiles on disk.The language translators and the operating system are themselvesprograms. Their function is to get the users program, which isDr.shaimaa H.Shaker

3written, in a programming language to run-on the computersystem.All sucl. Programs, which help in the execution of user programs,are called system programs (SPs). The collection of such SPs is the“System Software” of a particular computer system.Mast computer systems have support software, called UtilityPrograms, which perform routine tasks. These programs sort data,copy data from one storage medium to another, o/p data from astorage medium to printer & perform other tasks.the execution at a specified starting address.Dr.shaimaa H.Shaker

4Dr.shaimaa H.Shaker

5Dr.shaimaa H.Shaker

6Dr.shaimaa H.Shaker

7System Development Software:System Development Software assists a programmer of user indeveloping & using an application program.E.g. Language TranslatorsLinkage EditorsApplication generatorsLanguage Translators:A language translator is a computer program that converts aprogram written in a procedural language such as BASIC intomachine language that can be directly executed by the computer.Computers can execute only machine language programs. Programswritten in any other language must be translated into a machinelanguage load module, which is suitable for loading directly intoprimary storage.Subroutine or subprograms, which are stored on the systemresidence device to perform a specific standard function. E.g. if aprogram required the calculation of a square root,Programmer would not write a special program. He would simplycall a square root, subroutine to be used in the program.Translators for a low-level programming language were assemblersLanguage processorsLanguage Processing ActivitiesLanguage Processing activities arise due to the differences betweenthe manner in which a software designer describes the ideasconcerning the behaviour of a software and the manner in whichthese ideas are implemented in a computer system.the interpreter is a language translator. This leads to manysimilarities between areTranslators and interpreters. From a practical viewpoint manydifferences also existbetween translators and interpreters.The absence of a target program implies the absence of an outputinterface the interpreter. Thus the language processing activities ofan interpreter cannot be separated from its program executionactivities. Hence we say that an interpreter 'executes' a programwritten in a PL.Dr.shaimaa H.Shaker

8ProblemOrientedLanguages:andProcedureOrientedThe three consequences of the semantic gap mentioned at thestart of this section are in fact the consequences of aspecification gap. Software systems are poor in quality andrequire large amounts of time and effort to develop due todifficulties in bridging the specification gap. A classical solution isto develop a PL such that the PL domain is very close or identicalto the application domain.Such PLs can only be used for specific applications; hence they arecalled problem-oriented languages. They have large execution gaps,however this is acceptable because the gap is bridged by thetranslator or interpreter and does not concern the softwaredesigner.A procedure-oriented language provides general purpose facilitiesrequired in most application domains. Such a language isindependent of specific application domains.The fundamental language processing activities can be divided intothose that bridge the specification gap and those that bridge theexecution gap. We name these activities as1. Program generation activities2. Program execution activities.A program generation activity aims at automatic generation of aprogram. The source languages specification language of anapplication domain and the target language is typically a procedureoriented PL. A Program execution activity organizes the execution ofa program written in a PL on computer system. Its source languagecould be a procedure-oriented language or a problem orientedlanguage.Program GenerationThe program generator is a software system which accepts thespecification of a program to be generated, and generates aprogram in the target PL. In effect, the program generatorDr.shaimaa H.Shaker

9introduces a new domain between the application and PL domainswe call this the program generator domain. The specification gap isnow the gap between the application domain and the programgenerator domain. This gap is smaller than the gap between theapplication domain and the target PL domain.Reduction in the specification gap increases the reliability of thegenerated program. Since the generator domain is close to theapplication domain, it is easy for the designer or programmer towrite the specification of the program to be generated.The harder task of bridging the gap to the PL domain is performedby the generator.This arrangement also reduces the testing effort. Proving thecorrectness of the program generator amounts to proving the correctness of thetransformation .This would be performed while implementing the generator. To testan application generated by using the generator, it is necessary toonly verify the correctness of the specification input to the programgenerator. This is a much simpler task than verifying correctness ofthe generated program. This task can be further simplified byproviding a good diagnostic (i.e. error indication) capability in theprogram generator, which would detect inconsistencies in thespecification.It is more economical to develop a program generator than todevelop a problem-oriented language. This is because a problemoriented language suffers a very large execution gap between thePL domain and the execution domain whereas the programgenerator has a smaller semantic gap to the target PL domain,which is the domain of a standard procedure oriented language. Theexecution gap between the target PL domain and the executiondomain is bridged by the compiler or interpreter for the PL.Program ExecutionTwo popular models for program execution are translation andinterpretation.Program translationThe program translation model bridges the execution gap bytranslating a program written in a PL, called the source program(SP), into an equivalent program in the machine or assemblylanguage of the computer system, called the target program (TP)Characteristics of the program translation model are:A program must be translated before it can be executed. The translated program may be saved in a file. The savedprogram may be executed repeatedly. A program must be retranslated following modifications.Dr.shaimaa H.Shaker

10Program interpretationThe interpreter reads the source program and stores it in itsmemory. During interpretation it takes a source statement,determines its meaning and performs actions which implement it.This includes computational and input-output actions.The CPU uses a program counter (PC) to note the address of thenext instruction to be executed. This instruction is subjected to theinstruction execution cycle consisting of the following steps:1. Fetch the instruction.2. Decode the instruction to determine the operation to beperformed, and also its operands.3. Execute the instruction.At the end of the cycle, the instruction address in PC is updated andthe cycle is repeated for the next instruction. Program interpretationcan proceed in an analogous manner. Thus, the PC can indicatewhich statement of the source program is to be interpreted next.This statement would be subjected to the interpretation cycle, whichcould consist of the following steps:Fetch the statement.Analyze the statement and determine its meaning, viz. thecomputation to be performed and its operands.Execute the meaning of the statement.From this analogy, we can identify the following characteristics ofinterpretation:The source program is retained in the source form itself, i.e. notarget program form exists, A statement is analyzed during itsinterpretation.ComparisonA fixed cost (the translation overhead) is incurred in the use of the programtranslation model. If the source program is modified, the translation cost mustbe incurred again irrespective of the size of the modification. However,execution of the target program is efficient since the target program is in themachine language. Use of the interpretation model does not incur thetranslation overheads. This is advantageous if a program is modified betweenexecutions, as in program testing and debugging.Dr.shaimaa H.Shaker

11FUNDAMENTALS OF LANGUAGE PROCESSINGDefinitionLanguage Processing Analysis of SP Synthesis of TP.Definition motivates a generic model of language processingactivities.We refer to the collection of language processor componentsengaged in analyzing a source program as the analysis phase of thelanguage processor. Components engaged in synthesizing a targetprogram constitute the synthesis phase.A specification of the source language forms the basis of sourceprogram analysis. The specification consists of three components:1. Lexical rules, which govern the formation of valid lexical units inthe source language.2. Syntax rules which govern the formation of valid statements inthe source language.3. Semantic rules which associate meaning with valid statements ofthe language.The analysis phase uses each component of the source languagespecification to determine relevant information concerning astatement in the source program. Thus, analysis of a sourcestatement consists of lexical, syntax and semantic analysis.The synthesis phase is concerned with the construction of targetlanguage statement(s) which have the same meaning as a sourcestatement. Typically, this consist of two main activities: Creation of data structures in the target program Generation of target code.We refer to these activities as memory allocation and codegeneration, respectivelyLexical Analysis (Scanning)Lexical analysis identifies the lexical units in a source statement. Itthen classifies the units into different lexical classes e.g. id’s,constants etc. and enters them into different tables. Thisclassification may be based on the nature ofstring or on thespecification of the source language. (For example, while an integerconstant is a string of digits with an optional sign, a reserved id isan id whose name matches one of the reserved names mentioned inthe language specification.) Lexical analysis builds a descriptor,called a token, for each lexical unit. A token contain two fields—class code, and number in class, class code identifies the class towhich a lexical unit belongs, number in class is the entry number ofthe lexical unit in the relevant table.Syntax Analysis (Parsing)Syntax analysis processes the string of tokens built by lexicalanalysis to determine the statement class, e.g. assignmentstatement, if statement, etc. It then builds an IC which representsDr.shaimaa H.Shaker

12the structure of the statement. The IC is passed to semanticanalysis to determine the meaning of the statement.Semantic analysisSemantic analysis of declaration statements differs from thesemantic analysis of imperative statements. The former results inaddition of information to the symbol table, e.g. type, length anddimensionality of variables. The latter identifies the sequence ofactions necessary to implement the meaning of a source statement.In both cases the structure of a source statement guides theapplication of the semantic rules. When semantic analysisdetermines the meaning of a sub tree in the IC. It adds informationa table or adds an action to the sequence. It then modifies the IC toenable further semantic analysis. The analysis ends when the treehas been completely processed.“FUNDAMENTALS OF LANGUAGE SPECIFICATIONA specification of the source language forms the basis of sourceprogram analysis. In this section, we shall discuss important lexical,syntactic and semantic features of a programming language.Programming Language GrammarsThe lexical and syntactic features of a programming language arespecified by its grammar. This section discusses key concepts andnotions from formal language grammars. A language L can beconsidered to be a collection of valid sentences.Each sentence can be looked upon as a sequence of words, andeach word as a sequence of letters or graphic symbols acceptable inL. A language specified in this manner is known as a. formallanguage. A formal language grammar is a set of rules whichprecisely specify the sentences of L. It is clear that naturallanguages are not formal languages due to their rich vocabulary.However, PLs are formal languages.Terminal symbols, alphabet and stringsThe alphabet of L, denoted by the Greek symbol Z, is the collectionof symbols in its character set. We will use lower case letters a, b,c, etc. to denote symbols in Z.A symbol in the alphabet is known as a terminal symbol (T) of L.The alphabet can be represented using the mathematical notation ofa set, e.g. Σ {a, b, .z, 0,1.9}Here the symbols {, ',' and} are part of the notation. We call themmet symbols to differentiate them from terminal symbols.Throughout this discussion we assume that met symbols are distinctfrom the terminal symbols. If this is not the case, i.e. if a terminalsymbol and a met symbol are identical, we enclose the terminalsymbol in quotes to differentiate it from the metasymbol. ForDr.shaimaa H.Shaker

13example, the set of punctuation symbols of English can be definedas {:,;’,’-,.} Where ',' denotes the terminal symbol 'comma'.A string is a finite sequence of symbols. We will represent strings byGreek symbols-α β γ, etc. Thus α axy is a string over Σ . Thelength of a string is the Number of symbols in it. Note that theabsence of any symbol is also a string, the null string . Theconcatenation operation combines two strings into a single string.“To evaluate an HLL program it should be converted into the Machinelanguage. A compiler performs another very important function.This is in terms of the diagnostics.I.e. error – detection capability.The important tasks of a compiler are:Translating the HLL program input to it.Providing diagnostic messages whenever specifications of the HLLCompilersDr.shaimaa H.Shaker

14 A compiler is a program that translates a sentencea. from a source language (e.g. Java, Scheme, LATEX)b. into a target language (e.g. JVM, Intel x86, PDF)c. while preserving its meaning in the process Compiler design has a long history (FORTRAN 1958)a.b.c.lots of experience on how to structure compilerslots of existing designs to study (many freely available)take CS 152: Compiler Design for some of the details. . .Dr.shaimaa H.Shaker

15Dr.shaimaa H.Shaker

16Dr.shaimaa H.Shaker

17Dr.shaimaa H.Shaker

18Dr.shaimaa H.Shaker

19Dr.shaimaa H.Shaker

20Dr.shaimaa H.Shaker

21Dr.shaimaa H.Shaker

22Dr.shaimaa H.Shaker

23Dr.shaimaa H.Shaker

24Dr.shaimaa H.Shaker

25Dr.shaimaa H.Shaker

26Dr.shaimaa H.Shaker

27Assemblers & compilersAssembler is a translator for the lower level assembly language of computer,while compilers are translators for HLLs.An assembly language is mostly peculated to a certain computer, while anHLL is generally machined independent & thus portable.Overview of the compilation process:The process of compilation is:Analysis of Synthesis of Translation of Source Text Target Text ProgramSource text analysis is based on the grimmer of the source of the sourcelanguage.The component sub – tasks of analysis phase are:Syntax analysis, which determine the syntactic structure of the sourcestatement.Semantic analysis, which determines the meaning of a statement,once its grammatical structures become known.The analysis phaseThe analysis phase of a compiler performs the following functions.Lexical analysisSyntax analysisSemantic analysisSyntax analysis determines the grammatical or syntactic structureor the input statement & represents it in an intermediate form fromwhich semantic analysis can be performed.A compiler must perform two major tasks:The Analysis of a source program & the synthesis of its corresponding objectprogram.The analysis task deals with the decomposition of the source program into itsbasic parts using these basic parts the synthesis task builds their equivalentobject program modules. A source program is a string of symbols each ofwhich is generally a letter, a digit or a certain special constants, keywords &operators. It is therefore desirable for the compiler to identify these varioustypes as classes.Dr.shaimaa H.Shaker

28The source program is input to a lexical analyzer or scanner whosepurpose is to separate the incoming text into pieces or tokens such asconstants, variable name, keywords & operators.In essence, the lexical analyzer performs low- level syntax analysisperforms low-level syntax analysis.For efficiency reasons, each of tokens is given a unique internalrepresentation number.TEST: If A B then X Y;The lexical analyzer supplies tokens to the syntax analyzer.The syntax analyzer is much more complex then the lexical analyzer itsfunction is to take the source program from the lexical analyzer &determines the manner in which it is to be d

Programs, which help in the execution of user programs, are called system programs (SPs). The collection of such SPs is the “System Software” of a particular computer system. Mast computer systems have support software, called Utility Programs, which perform