A Levels Computing 9691 Revision Notes

21
Page | 1 Computing (9691) Revision Guide Topic 4.1 Operating systems PC operating systems and their main features; boot file; file allocation table Features · Error reporting · …so you can be told about problems · Memory management · …so RAM is used efficiently · Resources management · …so resources are used efficiently · I/O management · …to look after the inputs and outputs to the computer · Device management · …so peripherals can be used · Interrupt management · . .so that interrupts can be serviced · User interface · …so you can communicate with the computer Boot files · Used to start the system · load operating system · Allows access to personal settings · Execute automatically when starts or restart the computer · Checks status of hardware File Allocation Table (FAT) · A map of where files are stored in backing store (sectors, grouped in clusters) · Provides addresses/pointers to start of files · Has a linked list · Holds file names · Identifies free space · Stores access right · Is updated by operating system/is used when files are saved

Transcript of A Levels Computing 9691 Revision Notes

Page 1: A Levels Computing 9691 Revision Notes

P a g e | 1

Computing (9691) Revision GuideTopic4.1 Operating systemsPC operating systems and their main features; boot file; file allocation table Features· Error reporting· …so you can be told about problems· Memory management· …so RAM is used efficiently· Resources management· …so resources are used efficiently· I/O management· …to look after the inputs and outputs to the computer· Device management· …so peripherals can be used· Interrupt management· . .so that interrupts can be serviced· User interface· …so you can communicate with the computerBoot files· Used to start the system· load operating system· Allows access to personal settings· Execute automatically when starts or restart the computer· Checks status of hardwareFile Allocation Table (FAT)· A map of where files are stored in backing store (sectors, grouped in clusters)· Provides addresses/pointers to start of files· Has a linked list· Holds file names· Identifies free space· Stores access right· Is updated by operating system/is used when files are saved or deletedBasic functions of file management· Allocate space on disk/storage device· Deleting files· Copying files· Moving files· Control file access rights· Map logical file addresses to physical address on disk

Page 2: A Levels Computing 9691 Revision Notes

P a g e | 2

· Creating shortcutsWhat are the main functions of an operating system?· Making sure all the parts of the computer can work together· Making sure that the user can interact with the computer by providing an interface· Ensuring that any errors in the computer are reported to the user, usually with messages on the VDU· Managing files on the hard drive and in memory and allowing the user to manage files by providing a file management utility program· Providing utility programs such as FORMAT DISK, or DEFRAG· ‘Scheduling’. The OS provides programs that ensure the resources of the computer such as CPU time, are used as efficiently as possible by all the different users and the different jobs.Memory management (including virtual memory, paging, segmentation, threshing)Purpose of Memory Management· Allocate memory to allow separate processes to run at the same time· Deals with allocation when paging· Reallocates memory when necessary· Protects processes from each other· Protects the operating system· Enables memory to be sharedVirtual memory· Use of backing store…· As if it were additional memory· Uses paging/fixed size units· Swap pages between memory & backing store…· …to make space for pages needed· Holds part of program not in use· Allows programs to run that need more memory than is availablePaging and segmentation· Similaro Splitting a (large) program into smaller sectionso Only part of program needs to be in memoryo Some of program can stay on disko Allows program to run when there is insufficient memoryo Virtual memoryo Splitting memory into smaller sectionso Both need indexingo Sections of program need not be all together· Differences

Page 3: A Levels Computing 9691 Revision Notes

P a g e | 3

o Segments may be variable size, pages are fixed sizeo Pages are smallerDisk threshing· occurs when moving pages between memory & disk· disk is relatively slow· high rate of disk access· more time spent transferring pages than on processingScheduling to make efficient use of resources; job queues, priorities Purpose· efficient use of processor time· efficient use of resources· maximise number of users· no apparent delay for users· maximise throughput of CPU.Round robin· Each task allocated a time slice in turnSystem of priorities· Highest priority firstInterrupts· a signal…· that causes a break in the execution of the current routine/requests processing time· the current routine can be resumed after the interruptPriorities for interrupts· more than one interrupt can occur at a time· deal with the more urgent interrupt first…· because a more urgent interrupt has a higher priority· to avoid loss of dataInterrupt in I/O bound and processor bound· Program A is Processor bound· …has low priority· Program B is I/O bound· …has high priority· Program B starts· Once data is being printed, program A has processor time…· … until an interrupt requests more data for printing· Program B is given processor time…· …as it has higher priority· This is repeated until one program is complete· Otherwise if program A had priority it would stop B from running… · Interrupt in FDE cycle· Interrupt flag is set

Page 4: A Levels Computing 9691 Revision Notes

P a g e | 4

· Current instruction/cycle is completed· Interrupt is identified· Interrupt priority is compared with current task· High priority· So current values are placed on a stack· Start address of interrupt service routine is placed in PC· ISR (Interrupt Service Routine) is run· To avoid loss of data/store dataSpooling· Output data· To slow peripheral/disk drive· E.g. for printing later/when appropriate…· …when processor is not busy/after interrupt· To avoid delays· Some peripherals (e.g.) printers) are relatively slow/speed mismatch· References to jobs stored in a queue/buffer…· …each job called by its reference· jobs can be prioritised.Network operating systems and their main features; transparency, directory services, security, network printingNetwork Operating System (NOS)· is an operating system that gives computers the ability to communicate with other computers on a network.Features· Controls communication between workstations themselves and between workstations and servers· Allows and manages file sharing· Allows and manages printing and other resources· Controls internet access amongst stations· Manages user accounts· Manage security· Manages automate system back-ups· Manage and reports on the use of the system’s resources, such as each user’s hard disk allocation and how many prints they are allowed to do· Provides a number of different user interfaces.Transparency· Users are unaware of the hardware actions· Users are unaware of the software actions· Users do not need to understand the NOS tasks· Each user is unaware of other usersPrivacy

Page 5: A Levels Computing 9691 Revision Notes

P a g e | 5

· restrict data access to certain people.· Maintaino passwords (accessing system; accessing files)o physical protection (some data at certain terminals only)o allow authorised access…o …according to access rightso encryption.Security Risks· Hardware failure· Fire· Theft· Disgruntled employees· Hackers trying to break into the system· Computer virusesMethods for safety· Backups· Physical security· Passwords· Anti-virusNetwork Printing· Packets from different users…· …arrive at the print server· …and are stored in different files for different users· Spooling (as above)· When a file is complete…· …it is added to the print queue· …and files are printed in turn4.2 Translators (Compilers and interpreters)Compilers and interpretersTranslator· (Convert) from high level language/source code/language used by people…· …to low level object code/machine code/binary/language used by computerInterpreter· software…· that translates & executes a program…· one instruction at a time/line by line· each time the program is run / without generating an executableprogram· stops at first error found· Find erroro Used during program development

Page 6: A Levels Computing 9691 Revision Notes

P a g e | 6

o …to debug (sections of) codeo Translates one line…o …then allows it to be run before translation of next lineo Errors found more easily/quicklyo Starts to run program from any point Compiler· Used when program is completed· Executable program runs quickly· Executable program prevents purchaser from re-using code· Translates the whole program as a unit…· …and creates an executable programAdvantages of using an interpreter rather than a compiler· Errors are reported as they occur…· …rather than together· …easier to correct errors· Less memory is needed…· … as only the object code from a single source code instruction in use isheld· …interpreters are usually smaller programs than compilers· Program can be restarted from any point…· …after correcting an error· Can insert breakpoints (for debugging)· …to halt the program· Can trace variable values· …which are displayed as the program is running· Can set variable values· …while running the program Disadvantages· the user needs an interpreter / the program runs more slowly· because the program has to be translated each time it is runthe stages : lexical analysis, syntax analysis; How are errors detected and reported?Lexical -> Syntax -> Code generationLexical analysis· Reserved words/standard components are replaced by tokens· a token is a string of binary digits· of fixed length· Variable names are checked· Variable names are entered in the symbol table· Constants are entered in the symbol table· Data type (/space) required is entered in the symbol table· Error reporting occurs· Unnecessary characters (white space, comments) are removed

Page 7: A Levels Computing 9691 Revision Notes

P a g e | 7

· Program is formatted ready for the next stage/syntax analysisSyntax analysis· The stream of tokens is split up (or parsed) into expressions· Check the database of the syntax rules· Check the semanticsSyntax error· During syntax analysis· Statements are checked against the rules of the language· Uses symbol table· (if statements are not valid) errors are reported…· To alert the user/programmer

Code generation and optimization Code generation· Produces machine code/executable code· Several instructions for each high level language instruction· All variables are given addresses· All constants are given addresses· Relative addresses are calculatedOptimisation· Makes code as efficient as possible· Speed of processing is improved· Number of instruction is reducedSource code· High level language (version of program)· Written by user· Easy for people to understand· Translated by (input to) compiler (accept translator)Object code· Low level/machine code/binary code· Used by computer· Runs without further translation/executable· Produced by (output from) compiler (accept translator)Executable code· a complete program…• ..that the computer can run…· without further translation/has been compiled· machine code / low level languageLinkers and loadersLinker· combines modules/library routines…· that are already compiled/in object code/in executable form

Page 8: A Levels Computing 9691 Revision Notes

P a g e | 8

Loader· copies modules into memory· from backing store· ready for execution· completes address links to program.4.3 Computer Architectures and the fetch-execute cycle (see also 4.5)What is Von Neumann Architecture? Why are registers needed? Von Neumann· Instructions and data stored together..· …in the same format· Instructions fetched and executed one after another· A single processor (control unit)Registers· Locations used for specific purposesThe fetch-decode-execute-reset cycle and the use of registers Registers using in a FDE cycle· Program counter holds address of next instruction· MAR points to the data/instruction to be used· MDR holds data/instruction when copying from/to memory· CIR (Current Instruction Register) hold a copy of the instruction to be executed· Copy contents of PC to MAR· Increment PC· Load instruction pointed to by the MAR to MDR· Copy instruction from MDR to CIR· Decode instruction (in CIR)· Execute instruction· Check for interruptFeatures of a processor that determine its performance· (Clock) speed/pulse rate/in MHz…· …more instructions executed at faster clock speed· Word size…· …number of bits processed together· Bus size…· …(data bus) number of bits processed/transferred together· Architecture…· …e.g. single or multiple processor/pipelining· Cache size…· …to allow faster access (to part of program and data)Other machine architectures (eg parallel processor systems), pros and consParallel processor system· Multiple processors used together/simultaneously…· To perform a single job/different parts of the same program (at the same time)

Page 9: A Levels Computing 9691 Revision Notes

P a g e | 9

· Program may be split into a number of tasks…· …each of which may be processed by any available processor· Proso Increased processing speed/multiple instructions processed at the same timeo Different parts of program performed at the same timeo Performs complex tasks efficiently· Conso Not suitable for all programso Program may need to be rewritten· E.g. Weather forecasting/expert system

Pipelining· processor is split into parts· each part handles one of…· fetch, decode, execute (reset)· Conso Change in instruction sequence/e.g. jump instruction: requires pipe to be cleared4.4 Data representation, data structures and manipulationAll topics from 1.4, plus floating point binary representation using mantissa and exponent; normalisation; the trade-off between accuracy and range data structures: (for each, how to add, change, delete) list (linear, linked?)Stack· LIFO· Two pointersQueue· FIFO· One pointerAdd· Check for full queue· Error if it is full· Move rear pointer to point to new item…· …insert data at rear of queueDelete· Check for empty queue· Error if it is empty· Take data pointed to by front pointer· …and move front pointer to next itemTreeIn-order· traverse left subtree· visit root

Page 10: A Levels Computing 9691 Revision Notes

P a g e | 10

· traverse right subtreeDelete· traverse tree until item is found..…and remove elements below item… …store them· delete item (accept only if in correct place)· transfer stored items back onto tree(static and dynamic implementation of the above, pros and cons) StaticPros· Storage needed is known· Easier to write program· Fewer errorsCons· Size restricted (to that declared when structure is created)· May waste memorySearching binary, serial Serial Search· Start at the first item· Look at each item in turn· Until it is foundBinary Search· Look at middle word· Repeated halving· Until it is found· Proso Faster for large set of data/fewer values need to be checked· Conso Data must be in order/more complex algorithmSorting insertion*, quick*Insertion Sort· Start with the second item· If it is smaller the than number one, swap· Go to the third item, insert it into the correct position· Repeat until all items in the list have been inserted into the correct positionsQuick Sort· Select an item at random, the pivot· Create two new lists, one with all items less than pivot, other with items greater than pivot· Repeat until lists only have one itemMerging** algorithms needed

Page 11: A Levels Computing 9691 Revision Notes

P a g e | 11

** error at start of algorithmCheck empty (underflow) or full(overflow)4.5 Programming paradigmsPseudocode for writing algorithmsThe nature and purpose of 3rd and 4th generation languages (?)

Third Generation· Imperative· (The programmer must) give a step by step description of solution to

problemFourth Generation· Declarative· Knowledge base/facts and rules· User can state what they want to achieve· … without giving detailed stepsProgramming paradigms : low-level, object-oriented, declarative, procedural, functional. Explain with examples how they are typically used. Low level language· close to design of computer/lack of portability· machine-oriented language· assembly language· used for tasks connected with running the computer· uses mnemonics for instructions· uses variable names for addresses· uses labels· 1-1 correspondence between low-level language and machine code Object-

oriented· If must contain objects that have methods and data, with the data only being accessible via the methods· The objects must be instantiate from a class, making use of polymorphism

Procedural· 3rd generation· step by step instructions to solve a problem· to explain how to solve the problemDeclarative· 4th generation· state what to achieve…· without giving detailed steps· uses facts and rulesFunctional· Breaking a maths problem down to the smallest possible units

Page 12: A Levels Computing 9691 Revision Notes

P a g e | 12

· …then writing a set of functions for those units· Each function then receives parameters from outside the function, manipulates

the parameters mathematically and then outputs parameters to other functions· Characteristicso An instruction set geared towards handling maths problemso Being excellent at handling recursiono You can write mathematically-reliable programsStructured programming techniques : use of functions and procedures; use of Jackson Structured Programming and Top-Down Design (Stepwise refinement)Procedure· A subprogram that performs a task· …is given an identifier… • . .the identifier can be used as a program instructionParameter· An item of data/value (of a variable)…· …supplied to a function or procedureTop-down· Successively break task into simpler tasks…· …until tasks can be programmed· Clear program structure· Easier to write program…· … as a series of modules· Identify common or standard modules· Tasks can be shared between many programmers…· …according to their expertise· easier to de-bug.How are parameters (value and variable) and variables (global and local) used?Global variable· May be used throughout program· …including all proceduresLocal variable· Restricted to one procedure· Same variable name may be used for different values· … in different proceduresProblems with global variables· Difficult to trace errors…· …not sure which module has changed a value or conflict between variables· Different programmers may change them independently· Modules are not independentHow is the stack used? (return addresses, variables) Passing parameters between modules· Values…

Page 13: A Levels Computing 9691 Revision Notes

P a g e | 13

· Addresses…· …pushes on to stack…· …when module is called· Popped off stack…· ,…by called module· Need to be popped in reverse order (last in, first out)…· …to allow successive calls· RecursionObject-oriented languages : data encapsulation, classes and derived classes, inheritanceData encapsulation· Data can only be accessed via methods provided by objects.Class· Describes shared attributes and methods· A template for …· A set of objects· …that have state and behaviourObject· An object is one instance of a class • . . is an actual real-world entityInheritance· Class has its own attributes and methods· … and those from its super classDerived class· A class has all the features of its superclass…/class it’s come from· … and has additional features of its own· Inheritance· A class that uses another classDeclarative languages: backtracking, instantiation, predicate logic, satisfying goalsDeclarative language

• A programming language uses facts and rules• Fact

o Predicate…o …which may have argumentso Something that is always (unconditionally) true

• Ruleo May be used to define a relationship between factso Simple statement store in knowledge baseo A rule is true depending on a given condition

• Goalo a query to be solved

• E.g. expert system/medical diagnosis/equipment fault-finding/oilexploration/robot control

• Reasons:

Page 14: A Levels Computing 9691 Revision Notes

P a g e | 14

o Further data can be added when availableo Large amount of informationo Order of storage irrelevanto Can explain how they have arrived at their solution Backtracking· Follow rules…· …towards goal· If goal fails…· …go back to previous match and…· …start again· …from this point…· …towards an alternative goalInstantiation· If B is an instant of A, then A is instantiated to BFunctional languages: list processing, head and tail recursion See Programming paradigmsTail recursion· The function call is at the end of the expressionLow-level languages: use of accumulator(s), registers, program counter, direct, indirect and indexed addressing of memory Accumulator· temporary storage (in the ALU)· holds data being processed/result of calculation· deals with the input and output in the processor Memory address register (MAR)· Address…· …of the data (instruction) to be fetched/of the next location to be accessed

Memory data register (MDR)· Temporary store …· … for data/instruction being transferred to/from memory· Acts as a buffer…· … to compensate for different speedsProgram counter· Address of next instruction· increment to address of next instruction…· every time an instruction is fetched· change to address part of instruction…/change to start of ISR· when it is a jump instruction/when an interrupt occurs Immediate addressing· Using constantDirect addressing· E.g. Store the contents of the accumulator at address 0101· Conso uses fixed memory location/not relocatable/limited address range Indirect addressing· go to vector address

Page 15: A Levels Computing 9691 Revision Notes

P a g e | 15

· …which holds location of the real address needed Indexed addressing· modifies the address…· …by adding the number…· …from the index register· Proso easy to alter the index registero easy to access a range of memory locations(eg for an array)Backus-Naur form and syntax diagrams. How are they used? BNF:::= is defined by| means or< > means the meta variablee.g.<digit>::=0|1 |2|3|4|5|6|7|8|9<sign>::==+|-The terminal symbols are symbols which cannot be broken down any further

4.6 DatabasesTypes of database : flat-file, network, hierarchical, relational; (all the rest is on relational database management systems - RDBMS)Flat-file· all the records are held in one table· each row in the table corresponds to one record· each column in the table corresponds to a different field.· Tables are two-dimensional structuresRelational· Is kept as a number of related tablesHierarchical· Using a tree structure· Get more detailed information as you go to a lower levelNetwork· Records are cross-linked as well as linked above and below in a network databaseDesign a simple (?) relational database to 3rd normal form, defining tables and views, and drawing Entity-relationship models and entity life histories Normalisation· many-many relationships are not allowed· avoid duplicate dataThird normal form· Contains no functional dependencies between attributes…· … other than the primary key (or a candidate key)· Limits duplication of data· Removes multi-valued attributes

Page 16: A Levels Computing 9691 Revision Notes

P a g e | 16

Design forms for input, deletion, modification, querying of databaseRDBMS compared to flat-file Flat-file· Duplicate data stored…· …so storage wasted/data redundancy· Inconsistent data…· …more than one version of the data item· Program-data dependence…· …so difficult to change data format· Change of data…· …may require rewriting file· Lack of flexibility…· …difficult to obtain new types of reportsRDBMS· avoid data duplication· avoid inconsistent data· easier to change data· easier to change data format· data can be added easily· easier to control access to data.Primary, secondary and foreign keysEntity· A thing about which there is a need to record dataAttribute· A property of an entityPrimary Key· Unique value· To indentify a recordForeign Key· Primary key from one table…· …used as an attribute in another table· Used to link tablesAccess to the database for different users, at different times Access rights· Security…· …senior staff update data, others have read only access· Privacy…· …financial data not seen by all staff· Access data needed for their job…· …e.g. financial data only seen by those who need to· Why it may change temporarilyo Data may become read only…

Page 17: A Levels Computing 9691 Revision Notes

P a g e | 17

o …while being used/updated by another usero …to avoid inconsistent updates…to avoid attempts to sell the same car twice

Structure of a RDBMS : data dictionary, data description language, data manipulation languageInformation stored in the data dictionary· Names of tables/columns· Characteristics of data (e.g. length, data type)· Restrictions on values in columns· Meaning of data columns· Relationships between data· Which programs can access dataData Definition Language (DDL)· A language used to define the data structure (for a database)

Defines the schema Create attributes Define data types Define primary/foreign keys Define validation rules HLL/4GLmanipulation language (DML) high level language/4GL part of DBMS To access/query data To store data To update data