This action might not be possible to undo. Are you sure you want to continue?
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 or deleted Basic 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 Creating shortcuts What 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 shared Virtual 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 available Paging and segmentation Similar o Splitting a (large) program into smaller sections o Only part of program needs to be in memory o Some of program can stay on disk o Allows program to run when there is insufficient memory o Virtual memory o Splitting memory into smaller sections o Both need indexing o Sections of program need not be all together
Differences o Segments may be variable size, pages are fixed size o Pages are smaller Disk threshing occurs when moving pages between memory & disk disk is relatively slow high rate of disk access more time spent transferring pages than on processing Scheduling 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 turn System of priorities Highest priority first Interrupts a signal… that causes a break in the execution of the current routine/requests processing time the current routine can be resumed after the interrupt Priorities 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 data Interrupt 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 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 data Spooling 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 printing Network 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 users Privacy restrict data access to certain people. Maintain o passwords (accessing system; accessing files) o physical protection (some data at certain terminals only) o allow authorised access… o …according to access rights o encryption. Security Risks Hardware failure Fire Theft Disgruntled employees Hackers trying to break into the system Computer viruses Methods for safety Backups Physical security Passwords Anti-virus Network 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 turn 4.2 Translators (Compilers and interpreters) Compilers and interpreters Translator (Convert) from high level language/source code/language used by people… …to low level object code/machine code/binary/language used by computer Interpreter software… that translates & executes a program… one instruction at a time/line by line each time the program is run / without generating an executable
program stops at first error found Find error o Used during program development o …to debug (sections of) code o Translates one line… o …then allows it to be run before translation of next line o Errors found more easily/quickly o 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 program Advantages 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 is held …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 run the stages : lexical analysis, syntax analysis; How are errors detected and reported? Lexical -> Syntax -> Code generation Lexical 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 Program is formatted ready for the next stage/syntax analysis Syntax analysis The stream of tokens is split up (or parsed) into expressions Check the database of the syntax rules Check the semantics Syntax 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 calculated Optimisation Makes code as efficient as possible Speed of processing is improved Number of instruction is reduced Source 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 language Linkers and loaders Linker combines modules/library routines… that are already compiled/in object code/in executable form 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 purposes The 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 interrupt Features 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 cons Parallel processor system Multiple processors used together/simultaneously… To perform a single job/different parts of the same program (at the same time) Program may be split into a number of tasks… …each of which may be processed by any available processor Pros o Increased processing speed/multiple instructions processed at the same time o Different parts of program performed at the same time o Performs complex tasks efficiently Cons o Not suitable for all programs o 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) Cons o Change in instruction sequence/e.g. jump instruction: requires pipe to be cleared 4.4 Data representation, data structures and manipulation All 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 pointers Queue FIFO One pointer Add Check for full queue Error if it is full Move rear pointer to point to new item… …insert data at rear of queue Delete
P a g e | 10
Check for empty queue Error if it is empty Take data pointed to by front pointer …and move front pointer to next item Tree In-order traverse left subtree visit root traverse right subtree Delete 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) Static Pros Storage needed is known Easier to write program Fewer errors Cons Size restricted (to that declared when structure is created) May waste memory Searching binary, serial Serial Search Start at the first item Look at each item in turn Until it is found Binary Search Look at middle word Repeated halving Until it is found Pros o Faster for large set of data/fewer values need to be checked Cons o Data must be in order/more complex algorithm Sorting insertion*, quick* Insertion Sort Start with the second item If it is smaller the than number one, swap
P a g e | 11
Go to the third item, insert it into the correct position Repeat until all items in the list have been inserted into the correct positions Quick 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 item Merging* * algorithms needed ** error at start of algorithm Check empty (underflow) or full(overflow) 4.5 Programming paradigms Pseudocode for writing algorithms The nature and purpose of 3rd and 4th generation languages (?) Third Generation Imperative (The programmer must) give a step by step description of problem Fourth Generation Declarative Knowledge base/facts and rules User can state what they want to achieve … without giving detailed steps Programming paradigms : low-level, object-oriented, declarative, functional. Explain with examples how they are typically used. 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 Object-oriented If must contain objects that have methods and data, with the accessible via the methods The objects must be instantiate from a class, making use of Procedural
procedural, Low level
code data only being polymorphism
P a g e | 12
3rd generation step by step instructions to solve a problem to explain how to solve the problem Declarative 4th generation state what to achieve… without giving detailed steps uses facts and rules Functional Breaking a maths problem down to the smallest possible units …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 Characteristics o An instruction set geared towards handling maths problems o Being excellent at handling recursion o You can write mathematically-reliable programs Structured 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 instruction Parameter An item of data/value (of a variable)… …supplied to a function or procedure Top-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 procedures Local variable
P a g e | 13
Restricted to one procedure Same variable name may be used for different values … in different procedures Problems 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 independent How is the stack used? (return addresses, variables) Passing parameters between modules Values… 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 Recursion Object-oriented languages : data encapsulation, classes and derived classes, inheritance Data 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 behaviour Object An object is one instance of a class • . . is an actual real-world entity Inheritance Class has its own attributes and methods … and those from its super class Derived 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 class Declarative languages: backtracking, instantiation, predicate logic, satisfying goals
P a g e | 14
Declarative language • A programming language uses facts and rules • Fact o Predicate… o …which may have arguments o Something that is always (unconditionally) true • Rule o May be used to define a relationship between facts o Simple statement store in knowledge base o A rule is true depending on a given condition • Goal o a query to be solved • E.g. expert system/medical diagnosis/equipment fault-finding/oil exploration/robot control • Reasons: o Further data can be added when available o Large amount of information o Order of storage irrelevant o 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 goal Instantiation If B is an instant of A, then A is instantiated to B Functional languages: list processing, head and tail recursion See Programming paradigms Tail recursion The function call is at the end of the expression Low-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…
P a g e | 15
… to compensate for different speeds Program 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 constant Direct addressing E.g. Store the contents of the accumulator at address 0101 Cons o uses fixed memory location/not relocatable/limited address range Indirect addressing go to vector address …which holds location of the real address needed Indexed addressing modifies the address… …by adding the number… …from the index register Pros o easy to alter the index register o 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 variable e.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 Databases Types 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 structures Relational Is kept as a number of related tables Hierarchical Using a tree structure
P a g e | 16
Get more detailed information as you go to a lower level Network Records are cross-linked as well as linked above and below in a network database Design 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 data Third 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 Design forms for input, deletion, modification, querying of database RDBMS 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 reports RDBMS 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 keys Entity A thing about which there is a need to record data Attribute A property of an entity Primary Key Unique value
P a g e | 17
To indentify a record Foreign Key Primary key from one table… …used as an attribute in another table Used to link tables Access 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 temporarily o Data may become read only… o …while being used/updated by another user o …to avoid inconsistent updates …to avoid attempts to sell the same car twice Structure of a RDBMS : data dictionary, data description language, data manipulation language Information 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 data Data 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/4GL manipulation language (DML) high level language/4GL part of DBMS To access/query data To store data To update data
This action might not be possible to undo. Are you sure you want to continue?
We've moved you to where you read on your other device.
Get the full title to continue reading from where you left off, or restart the preview.