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
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment