360 likes | 503 Views
Topic 6 : Introduction to Operating Systems. Book Details:. We will use two different books for this course. “Fundamentals of Operating Systems”, A. M. Lister and R. D. Eager, Fifth Edition, Macmillan Computer Science Series, ISBN. 0-333-59848-2, £13.99.
E N D
Book Details: • We will use two different books for this course. • “Fundamentals of Operating Systems”, A. M. Lister and R. D. Eager, Fifth Edition, Macmillan Computer Science Series, ISBN. 0-333-59848-2, £13.99. • “Operating Systems Design and Implementation”, A. S. Tanenbaum, Prentice-Hall International, ISBN. 0-13-630195-9, about £29.99.
Introduction to Operating Systems L & E: Pages 1-19 Tanenbaum: Pages 1-5, 15-17
Operating SystemsProvide a Virtual Machine Machine Specific Interface Hardware
Operating SystemsProvide a Virtual Machine Operating System Specific Interface O/S Hardware
Operating Systems Also Manage Resources • Share resources between multiple programs and multiple users. • Orderly and controlled allocation of resources • E.g. coordination of printing • Protection • Ensure use of resources is optimised. • E.g Performing useful work when performing slow I/O based tasks.
Applications Software (e.g. packages) System Software (e.g. operating systems) Computer Hardware (e.g. CPU, memory, I/O devices) Operating Systems in Context
Remember the G&L Machine? • Minimal computer built from scratch using logic gates and busses. • Controlled using microcode. • Could run machine code by writing an interpreter in microcode. • E.g interpreting an ADD instruction
A Simple Machine Code Program • This program calculates x*x where x is initially in location 5. Main Memory Address Machine Language Instruction LOAD 5 1 0 0 5 1 MULT 5 0 0 5 2 5 2 0 0 5 5 STORE 3 F F F F 4 STOP 0 0 0 3 5
A Quick Recap on Addressing ... • Four main addressing modes. Load Immediate 1000 Address Contents Load Direct 1000 1000 1234 1050 8765 Load Indexed 1000 1234 5432 Load Indirect 1000 assume index register contains 50
Base and Limit Registers • Effective address is calculated by:- eff. address = address specified + contents of base register • Following assertion must hold for address to be valid:- eff. address < contents of limit register
Shortcomings of Our Machine • Very machine specific code. • No I/O support for programs or data. • No support for multiple users. • No support for multiple programs.
Adding Operating System Support Operating System Specific Interface O/S Hardware
Tackling the Problem of Loading Programs – the Dispatcher • Basic idea is to load the program from disk and start it executing. • When its finished start executing another one. • During its period of execution the program is called a process.
Basic Approach • Sit in a loop waiting for a program to be ready to run. • Load the specified program from disk into memory. • Use base and limit registers to make sure program addresses work. • When the program has finished go back to the loop and wait for another to be ready.
0 1 2 3 4 5 6 7 8 Program to Start Processes JUMP IDLE STARTIT: LDBASE BASETABLE+ IDLE: LDA PTE JNZ DISPATCH JUMP IDLE DISPATCH: STI JUMPSUB LOADIT LDLIMIT LIMITTABLE+ JUMP STARTIT
Supporting Data Structures BASETABLE: 100 200 300 LIMITTABLE: 199 299 330
Application Programs Main Memory Address Machine Language Instruction NULL 0 #0 LDBASE 1 LOAD 6 2 MULT 6 3 6 4 STORE 5 1 JUMP 6 10
0 1 2 3 4 5 6 7 8 PTE = 0 Base = 0 Limit = 9999 Index = 0 Demo Acc = 0 JUMP IDLE STARTIT: LDBASE BASETABLE+ IDLE: LDA PTE JNZ DISPATCH JUMP IDLE DISPATCH: STI JUMPSUB LOADIT LDLIMIT LIMITTABLE+ JUMP STARTIT
0 1 2 3 4 5 6 7 8 PTE = 0 Base = 0 Limit = 9999 Index = 0 Demo Acc = 0 JUMP IDLE STARTIT: LDBASE BASETABLE+ IDLE: LDA PTE JNZ DISPATCH JUMP IDLE DISPATCH: STI JUMPSUB LOADIT LDLIMIT LIMITTABLE+ JUMP STARTIT
0 1 2 3 4 5 6 7 8 PTE = 0 Base = 0 Limit = 9999 Index = 0 Demo Acc = 0 JUMP IDLE STARTIT: LDBASE BASETABLE+ IDLE: LDA PTE JNZ DISPATCH JUMP IDLE DISPATCH: STI JUMPSUB LOADIT LDLIMIT LIMITTABLE+ JUMP STARTIT
0 1 2 3 4 5 6 7 8 PTE = 0 Base = 0 Limit = 9999 Index = 0 Demo Acc = 0 JUMP IDLE STARTIT: LDBASE BASETABLE+ IDLE: LDA PTE JNZ DISPATCH JUMP IDLE DISPATCH: STI JUMPSUB LOADIT LDLIMIT LIMITTABLE+ JUMP STARTIT
0 1 2 3 4 5 6 7 8 PTE = 1 Base = 0 Limit = 9999 Index = 0 Demo Acc = 1 JUMP IDLE STARTIT: LDBASE BASETABLE+ IDLE: LDA PTE JNZ DISPATCH JUMP IDLE DISPATCH: STI JUMPSUB LOADIT LDLIMIT LIMITTABLE+ JUMP STARTIT
0 1 2 3 4 5 6 7 8 PTE = 1 Base = 0 Limit = 9999 Index = 0 Demo Acc = 1 JUMP IDLE STARTIT: LDBASE BASETABLE+ IDLE: LDA PTE JNZ DISPATCH JUMP IDLE DISPATCH: STI JUMPSUB LOADIT LDLIMIT LIMITTABLE+ JUMP STARTIT
0 1 2 3 4 5 6 7 8 PTE = 1 Base = 0 Limit = 9999 Index = 1 Demo Acc = 1 JUMP IDLE STARTIT: LDBASE BASETABLE+ IDLE: LDA PTE JNZ DISPATCH JUMP IDLE DISPATCH: STI JUMPSUB LOADIT LDLIMIT LIMITTABLE+ JUMP STARTIT
0 1 2 3 4 5 6 7 8 PTE = 1 Base = 0 Limit = 9999 Index = 1 Demo Acc = 1 JUMP IDLE STARTIT: LDBASE BASETABLE+ IDLE: LDA PTE JNZ DISPATCH JUMP IDLE DISPATCH: STI JUMPSUB LOADIT LDLIMIT LIMITTABLE+ JUMP STARTIT
0 1 2 3 4 5 6 7 8 PTE = 1 Base = 0 Limit = 299 Index = 1 Demo Acc = 1 JUMP IDLE STARTIT: LDBASE BASETABLE+ IDLE: LDA PTE JNZ DISPATCH JUMP IDLE DISPATCH: STI JUMPSUB LOADIT LDLIMIT LIMITTABLE+ JUMP STARTIT
0 1 2 3 4 5 6 7 8 PTE = 1 Base = 0 Limit = 299 Index = 1 Demo Acc = 1 JUMP IDLE STARTIT: LDBASE BASETABLE+ IDLE: LDA PTE JNZ DISPATCH JUMP IDLE DISPATCH: STI JUMPSUB LOADIT LDLIMIT LIMITTABLE+ JUMP STARTIT
0 1 2 3 4 5 6 7 8 PTE = 1 Base = 200 Limit = 299 Index = 1 Demo Acc = 1 JUMP IDLE STARTIT: LDBASE BASETABLE+ IDLE: LDA PTE JNZ DISPATCH JUMP IDLE DISPATCH: STI JUMPSUB LOADIT LDLIMIT LIMITTABLE+ JUMP STARTIT
Base = 200 Limit = 299 Index = 1 Demo Acc = 10 Main Memory Address Machine Language Instruction NULL 200 #0 LDBASE 201 LOAD 6 202 MULT 6 203 6 204 STORE 205 1 JUMP 206 10
Base = 200 Limit = 299 Index = 1 Demo Acc = 100 Main Memory Address Machine Language Instruction NULL 200 #0 LDBASE 201 LOAD 6 202 MULT 6 203 6 204 STORE 205 1 JUMP 206 10
Base = 200 Limit = 299 Index = 1 Demo Acc = 100 Main Memory Address Machine Language Instruction NULL 200 #0 LDBASE 201 LOAD 6 202 MULT 6 203 6 204 STORE 205 1 JUMP 206 100
Base = 200 Limit = 299 Index = 1 Demo Acc = 100 Main Memory Address Machine Language Instruction NULL 200 #0 LDBASE 201 LOAD 6 202 MULT 6 203 6 204 STORE 205 1 JUMP 206 100
Base = 0 Limit = 299 Index = 1 Demo Acc = 100 Main Memory Address Machine Language Instruction NULL 200 #0 LDBASE 201 LOAD 6 202 MULT 6 203 6 204 STORE 205 1 JUMP 206 100
0 1 2 3 4 5 6 7 8 Base = 0 Limit = 299 Index = 1 Demo Acc = 100 JUMP IDLE STARTIT: LDBASE BASETABLE+ IDLE: LDA PTE JNZ DISPATCH JUMP IDLE DISPATCH: STI JUMPSUB LOADIT LDLIMIT LIMITTABLE+ JUMP STARTIT
Summary • It is possible to write a simple program to load programs and start them running as processes. • This forms part of a machine’s operating system which aims to provide abstraction over the basic machine hardware.