Download presentation
Presentation is loading. Please wait.
1
Operating Systems Brian Farrimond
2
Topics Introduction Overview of operating system tasks Operating systems in detail
3
Topics Introduction Overview of operating system tasks Operating systems in detail
4
Computers run software Computers –built to run software Software –consists of sets of instructions (programs)
5
Need for system software Computers very complex Come with large bundles of software to help the non-specialist this software is called system software
6
Types of software System software –operating systems –language translators Applications software –special purpose programs –e.g. Word, Paintbrush, Internet Explorer Focus of this course
7
Topics Introduction Overview of operating system tasks Operating systems in detail
8
Operating system tasks managing files running programs memory management control of peripherals utility programs
9
Operating system tasks managing files running programs memory management control of peripherals utility programs
10
Managing files Programs and data saved on disc as files Operating System file manager –organises files –enables user to add, update delete files –controls file ownership in shared system e.g. network, mainframe
11
Operating system tasks managing files running programs memory management control of peripherals utility programs
12
Running programs User requests a program –mouse click –program name at command line This triggers a sequence of actions –ensure program is in main memory –start fetch execute –manage program’s file access
13
Operating system tasks managing files running programs memory management control of peripherals utility programs
14
Memory management Managing space Simultaneous programs –must not interfere with each other’s space Large programs –possible to only load required parts –may use use overlays e.g. Word with little used menu options
15
Operating system tasks managing files running programs memory management control of peripherals utility programs
16
Control of peripherals Operating system –consists of kernel drivers Drivers –plug and play
17
Operating system tasks managing files running programs memory management control of peripherals utility programs
18
Utility programs Editors Compilers Clock Calculator Calendar
19
Topics Introduction Overview of operating system tasks Operating systems in detail
20
MS-DOS filing system Managing disc storage Multiprogramming –sharing the processor –sharing memory
21
Operating systems in detail MS-DOS filing system Managing disc storage Multiprogramming –sharing the processor –sharing memory
22
MS-DOS Filing System Micro Soft Disc Operating System –operating system for first PCs –Windows was a layer on top of the MS-DOS –Now Windows replaces MS-DOS Shares characteristics of Unix (Linux) –directory structure –command line
23
MS-DOS Directories Access to files is through a directory –Example: –LETTER.TXT, POEM.TXT, JOKE.TXT Directory also records: file size, date last changed Directory is same as a Windows folder
24
Organise with directory structure directory can hold: –file names –sub-directory names root is top level directory
25
File names Local name –CHAPTR1 Full name –\BOOKS\LOSTLOVE\CHAPTR1 Path Local name
26
Current directory User is always “in a directory” This is the Current Directory Example –opening a file –file dialog’s starting directory
27
Changing directory cd Example using full path –cd \LETTERS\LOVELETT
28
Using short cuts with cd cd.. –.. refers to parent directory
29
Operating systems in detail MS-DOS filing system Managing disc storage Multiprogramming –sharing the processor –sharing memory
30
Managing Disc Storage Two main types of secondary (permanent) storage –magnetic disc floppy disc hard disc –optical disc CD-ROM DVD
31
Magnetic disc flat circular disc (platter) coated with magnetizable material same technology as –audio cassettes –video tape
32
Disc pack Several platters on same spindle
33
Formatted magnetic disc concentric tracks each track divided into sectors
34
Old Disc statistics FormatSurfacesTracksSectors / track Capacity DD (floppy)2809720 Kb HD (floppy)280181.44 Mb IBM PS/275833670 Mb
35
Storing files on disc Two alternative strategies for allocating sectors to a file –contiguous allocation file stored on adjacent sectors –non-contiguous allocation file scattered across disc
36
Contiguous allocation Advantages –simple to implement –fast Problems –need to find large enough slot on disc –difficult to add to file –fragmentation on deletion
37
Non-contiguous allocation The most common approach Method: –files chopped up into fixed size blocks –blocks need not be stored in adjacent sectors
38
Non-contiguous allocation Disadvantages –more complex to implement –increased access time –most files waste space in incompletely filled blocks Advantage –increased flexibility
39
Block size How big should blocks be ? –too big then too much space wasted –too small then considerable effort needed to retrieve file MS-DOS –block = 2 x 512 byte sectors –known also as a cluster
40
Storing a file operating system... –obtains a free block –starts filling it with data –when full, obtains another block –continue until all file is stored Problems to solve: –recording sequence of blocks making up a file –keeping track of free blocks
41
The MS-DOS Solution File Allocation Table (FAT)Directory Entry A directory
42
Operating systems in detail MS-DOS filing system Managing disc storage Multiprogramming –sharing the processor –sharing memory
43
Multiprogramming First machines –single user More modern machines –multiple users e.g. bank system –each user perhaps running several programs at same time e.g. Windows PC
44
Achieving multiprogramming Single CPU –Concurrent execution –CPU continually switches between programs –C.f. chess grandmaster playing lots of club players “simultaneously” Multiple CPUs –Parallel execution –Each program runs on a separate CPU
45
Virtual machines Each user sharing a machine appears to have machine to themselves One real machine -> many virtual machines Two main issues: –Sharing the processor –Sharing main memory
46
Sharing the processor Original problem: –expensive, fast CPU waiting for slow peripherals – uneconomic Solution –have CPU run another program while waiting
47
Other advantages Carry out tasks simultaneously –E.g. control central heating and word process Share peripherals –Mainframe and minis can centralise printers etc –Dumb terminals are cheap Share data –Users can access same files Concurrent programs on same machine –This is how we use Windows
48
Disadvantages Breakdowns affect everybody Portability – need link to central machine Expense – but getting cheaper Security risks
49
Switching between programs Done by the kernel (part of operating system) Known as a context switch Each program needs a control block –Preserves program’s state CPU register contents Which data files are opened
50
Strategies for switching When program finished or blocked –Simple to implement –But, programs can hog the processor At regular intervals (time slicing) –Programs cannot hog processor –But, complex to control so time overhead –This is the strategy in common use
51
Time slicing Each interval is a time slice Blocked programs (waiting for a peripheral) are not allocated time slices Scheduling – deciding which program runs next
52
Running programs are “processes” Processes consist of: –The program (set of instructions) –Current state of data structures –Current state of CPU registers –Which I/O devices currently open –Which files are currently open
53
Process states Running –During its timeslice Ready –While some other process is running Blocked –Unable to proceed e.g. waiting for input device
54
Context switching with interrupts Interrupt –Signal to CPU to stop what it is doing and execute an interrupt routine –Clock interrupt generated by clock at fixed intervals
55
Operating systems in detail MS-DOS filing system Managing disc storage Multiprogramming –sharing the processor –sharing memory
56
Sharing the Memory Programs need to be in main memory when executing May not all fit in
57
Sharing by swapping Program and data –copied into memory at beginning of each time slice –copied back to disc at end of time slice All main memory available to program But, high overhead of swapping time
58
Sharing by paging Divide program and data into pages Only swap in the pages needed during time slice Memory divided into pageframes –One page per pageframe
59
Loading pages Pages can be loaded in any order Use a page table to keep track
60
Translating addresses Given an instruction like JMP 314 314 means 314 locations from beginning of program Assume each page 100 locations long JMP 314 means – page 3 offset 14 Where is the location in real memory ?
61
Carrying out the translation JMP 314 Page number Real memory address: 2514
62
Page fault Interrupt generated when required page not in main memory Causes –Required page to be fetched from disc –Page table updated –Program continues
63
Thrashing Page faults are too frequent Most time spent swapping pages Caused by: –Bad program design –Too many programs attempting to run concurrently
64
Paging strategies Fetch strategy –When to fetch a page Replacement strategy –When to swap page out
65
Fetch strategies Demand fetch Anticipatory fetch
66
Replacement strategies Optimal page replacement Longest resident Least recently used Least frequently used
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.