Scheduling - The OS has to arrange the order of tasks to be done either: 1. to make maximum use of the CPU 2. To give one program priority Program A making calculations = Processor hungry = Processor bound Program B Printing Wahe slips = I/o hungry = I/O Bound If Program B is given priority the it shares the time more efficiently and more throughput is achieved. The objective of scheduling are to Maximise the use of the computer be fair to all users Provide a reasonable response time to all users, whether they are on-line users or a batch processing user Prevent the system failing if it is becoming overloaded Make sure that the system is consistent by always giving similar response times to similar activities from day to day The following is a list of criteria which may be used to determine a schedule which will achieve the previous objectives Priority - Give some jobs a priority to the CPU I/O or processor bound? - Give priority to I/O bound tasks as Processor Bound would hog the CPU Type of job - Batch processing, on-line and real time all erquire different response times Resourse requirements - The amount of time needed to complete the job, the memory required, I/o and processor time Resources used so far - The amount of processor time used so far, how much I/o used so far. Waiting time - The time the job has been waiting to use the system. Scheduling Policies FIrst Come First Served - First to the ready queue will be the first to the running state Shortest Job First - Jobs are sorted in the Ready queue in order of the time they will take. New jobs slot into their correct position Round Robin - Each job gets set a 'time slice' with the processor and at the end of the 'slice' it returns to the back of the Ready Queue. If a job finishes during a slice it leaves the system Shortest Remaining time - The ready queue is sorted by job that has the least time remaining and 2 more... A job joins a duifferent queue depending on how important the job is. A job in a lower priority queue has to wait until the queues above are clear before it gets processor time. MFQ - MFQ use the same system but also apply Tim Slices and if the job doesn't finish during the slice then it is moved to a lowere queue, the last of which is a Round Robin. Spooling - Preventing speed mismatch by settting up a cueing system. The details of an output are witten to a file e.g name, location, size, fonts, images The info file is placed in a queue OS Organising Memory Reasons Programs loaded in different orders Multi Users on one app with individual sets of data Apps simultaneously controlling multiple sets of data for multiple users or apps = reentrant Interrupts I/o interrupt - From I/o device e/g Printer out of paper Timer interrupt - From internal clock because processor has time critical activities to do. - OS' have to allocate certain time to certain processes. Switches to other processes because a certain activity is taking too long. Hardware error - Power failiure = OS must attempt to close safely Program interrupt - Program error e.g trying to use OS memory Interrupts and interrupting interrupts - Register - Holds the info that is being executed and is the CPU's own form of 'RAM'. While also storing data while interrupts are occurring as interrupts happen first. So an activity is happening, then is interrupted, so the activity is stored in the register till the interrupt is finished. Memory Management A job is made up from instructions Jobs sit in main memory when they are queueing to use the processor If Job C finishes ,the OS needs to re-address the other jobs to Job E and The OS loads jobs and recalculates memory addresses to fit new jobs in. The Loader does both these tasks A calculation must be done for each instruction's address so a job can be moved Relative addressing is when each instruction's new address is decided relative to where the first instruction was moved to. Segmentation Variable lengths blocks - Programmers divide jobs into segments Segments = Sub-routines/ groups of subs/ data Addressing The segment table must include the start position and size of the segment Virtual Memory Dividing programs up into pages or segments means that only parts being ued need to be loaded Disk threshing = Memory full forces constant page swapping from processor What gets replaced in memory? Page idle the longest, First in First out The OS flags each Page with a 0. data must not be paged out so when the data changes in is flagged with a 1. Paging Memory addressing becomes a big issue A paging table is kept to record which Job page in which memory page Virtual memory is a designated slice of the hard drive and it swaps entire pages around? Used when RAM isn't available Desktop PC OPerating Systems File allocation Table (FAT) Uses a linked list to point to where files are on the disk. Disk is FORMATTED - Divides the disk radially and concentrically (Circle)
Wednesday, 22 June 2011
3.10-3.11
3.13
Accumulator holds the results within in an event so the results can be dealt within one procedure (So it doesn't have to leave RAM)
Buses are 'wires', communication wire (E.g USB). Address Bus is information about the receiver Control Bus - Controls the communication to all parts of the system from the CPU. Wires that come out of the CPU. Co Processor - Graphics Card Parallel Processor - Dedicate a processor to a particular task which makes it faster. 2 instructions can happen at once. Operating system must be programmed to use 2 processors. E.g Facebook server, Delegation of task. E.g One processor deals with internet requests, others deal with something else etc. Array Processor - Deal with repetitive tasks
3.12
3.12 Assembly language is machine code short hand (E.g + = 011001001). Kinda like how the keyboard works. Press the 'z' character and an assembler takes the mnemomics and shows a 'z' It's short hand machine code An interpreter takes one sentence at a time, translates it and runs the instruction when it goes through a computer, it interprets the next instruction. It is used when not enough memory to hold compiled propgram (Multiple instructions) Used by come languages (VB) to debug Error can be reported per line of execution, this makes error checking easier. A compiler is when all instructions are translated simultaneously. A program is compiled into 1 file and has been translated beforehand so it can be read straightaway. It's faster to load but requires more memory. Lexical analysis - Prepares the translator/compiler if your sentence makes sense. Looks up in it's 'dictionary' if your sentence makes sense. E.g Sentence should be = Dim 'variable' as (Assignment, same as equal sign) 'Data taype'. Keyword = Token The dictionary is stored in each of the programs. Syntax analysis - Sentence is checked horizontally to see if it makes sense Intermediate code - Code that has been checked and is halfway through execution Linkers - Loaders do the loading Library routines - DLL Files - Littles slices of code, modules. Seperately saved files that contain a set of instructions Von Neumann - Came up with the idea of Apps, 'Stored program using the same memory space where instructions where stored with data. A queue of info is put through a register which then puts the data into Memory address register. 1. Load the address from (PC) into Mar (Memory address register) 2. Increment the (PC) by 1 Load the instruction from the MAR address into the MDR Load this instruction from MRP into CIR Decode the instruction that is in the CIR If the instructions is a jump instruction then a. Load the address part of the instruction into the PC, b. Reset by going to step 1 else step 7 7. Execute the instruction 8. Reset by going to step 1. CIR - Current instruction register. MDR - memory data register PC - Program counter
Subscribe to:
Posts (Atom)