1 / 81

Topic 6 : Introduction to Operating Systems

Topic 6 : Introduction to Operating Systems. L & E: Pages 1-19, 17-29 Tanenbaum: Pages 1-5, 15-16, 50-53. Book Details Reminder:. We will use two different books for this course.

Download Presentation

Topic 6 : Introduction to Operating Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Topic 6 : Introduction to Operating Systems L & E: Pages 1-19, 17-29 Tanenbaum: Pages 1-5, 15-16, 50-53

  2. Book Details Reminder: • 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. • www.comp.lancs.ac.uk/computing/staff/kc/keiths_teaching.html

  3. Operating SystemsProvide a Virtual Machine Operating System Specific Interface O/S • An OS is responsible for: • Sharing resources • Ensuring optimisation of resources Hardware

  4. Wrote a minimal 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.

  5. Approach for Simple Dispatcher • 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.

  6. This Lecture…. • Doing many things at the same (or apparently the same) time…

  7. Some Simple Definitions • Sequential = doing things one at a time. • Concurrent = doing things (apparently) at the same time. • Parallel = doing things really at the same time.

  8. Example Programs • Two programs to be run. Begin putline (“A”); putline (“B”); putline (“C”); End. Begin putline (“1”); putline (“2”); putline (“3”); End.

  9. Sequential Execution Output Job One Job Two

  10. Sequential Execution Output Job One Job Two 1 2 3

  11. Sequential Execution Output Job One Job Two 1 2 3 A B C

  12. Concurrent Execution Output Job One Job Two

  13. Concurrent Execution Output Job One Job Two 1

  14. Concurrent Execution Output Job One Job Two 1 A

  15. Concurrent Execution Output Job One Job Two 1 A 2

  16. Concurrent Execution Output Job One Job Two 1 A 2 B

  17. Concurrent Execution Output Job One Job Two 1 A 2 B 3

  18. Concurrent Execution Output Job One Job Two 1 A 2 B 3 C

  19. Parallel Execution Output Job One Job Two

  20. Parallel Execution Output Job One Job Two 1 A

  21. Parallel Execution Output Job One Job Two 1 A 2 B

  22. Parallel Execution Output Job One Job Two 1 A 2 B 3 C

  23. Summary of Execution Patterns Sequential Concurrent Parallel

  24. Extending Our Dispatcher to Deal With Concurrency • Load programs into different parts of memory. • Make each program save its data and where it is when it wants to temporarily stop running (c.f. interrupts). • Modify the dispatcher so it can jump to these saved points.

  25. Why Multiple Programs? • Support multiple tasks by users. • Allow tasks to proceed in background. • Allow programs to be structured as independent tasks. • Support multiple users.

  26. The Old Application Program 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

  27. The New Application Program Main Memory Address STB 3 0 #0 LDBASE 1 JUMP @3 2 # PC Stored Here 4 3 LDA #8 4 STPC+2 B 12 JUMP 0 13

  28. The New Dispatcher • Sit in a loop waiting for a program to be ready to run. • If it’s a new program load the specified program from disk into memory and jump to the start. • If it’s an old program ... restore the registers and jump back via stored PC.

  29. 0 1 2 3 4 5 PTE = 0 Base = 0 Limit = 0 Index = 0 The New Dispatcher Acc = 0 JUMP IDLE STARTIT: LDBASE BASETABLE+ JUMPSUB SAVE_IT IDLE: LDA PTE JNZ DISPATCH JUMP IDLE

  30. PTE = 0 Base = 0 Limit = 0 Index = 0 The New Dispatcher Acc = 0 6 DISPATCH: STI LDA BASE_TABLE+ JNZ RESTORE_IT JUMPSUB LOADIT LDLIMIT LIMITTABLE+ JUMP STARTIT 7 8 9 10 11

  31. PTE = 0 Base = 0 Limit = 0 Index = 0 The New Dispatcher Acc = 0 12 SAVE_IT: STA ACC_TABLE+ RETURN RESTORE_IT LDA ACC_TABLE+ LDLIMIT LIMIT_TABLE+ JUMP START_IT 13 14 15 16

  32. Supporting Data Structures BASETABLE: 0 0 0 LIMITTABLE: 0 0 0 ACCTABLE: 0 0 0

  33. 0 1 2 3 4 5 PTE = 0 Base = 0 Limit = 0 Index = 0 Demo Acc = 0 JUMP IDLE STARTIT: LDBASE BASETABLE+ JUMPSUB SAVE_IT IDLE: LDA PTE JNZ DISPATCH JUMP IDLE

  34. 0 1 2 3 4 5 PTE =1 Base = 0 Limit = 0 Index = 0 Demo Acc = 1 JUMP IDLE STARTIT: LDBASE BASETABLE+ JUMPSUB SAVE_IT IDLE: LDA PTE JNZ DISPATCH JUMP IDLE

  35. 0 1 2 3 4 5 PTE = 1 Base = 0 Limit = 0 Index = 0 Demo Acc = 1 JUMP IDLE STARTIT: LDBASE BASETABLE+ JUMPSUB SAVE_IT IDLE: LDA PTE JNZ DISPATCH JUMP IDLE

  36. PTE = 1 Base = 0 Limit = 0 Index = 1 Demo Acc = 1 6 DISPATCH: STI LDA BASE_TABLE+ JNZ RESTORE_IT JUMPSUB LOADIT LDLIMIT LIMITTABLE+ JUMP STARTIT 7 8 9 10 11

  37. PTE = 1 Base = 0 Limit = 0 Index = 1 Demo Acc = 0 6 DISPATCH: STI LDA BASE_TABLE+ JNZ RESTORE_IT JUMPSUB LOADIT LDLIMIT LIMITTABLE+ JUMP STARTIT 7 8 9 10 11

  38. PTE = 1 Base = 0 Limit = 0 Index = 1 Demo Acc = 0 6 DISPATCH: STI LDA BASE_TABLE+ JNZ RESTORE_IT JUMPSUB LOADIT LDLIMIT LIMITTABLE+ JUMP STARTIT 7 8 9 10 11

  39. PTE = 1 Base = 0 Limit = 0 Index = 1 Demo Acc = 0 6 DISPATCH: STI LDA BASE_TABLE+ JNZ RESTORE_IT JUMPSUB LOADIT LDLIMIT LIMITTABLE+ JUMP STARTIT 7 8 9 10 11 Assume LOADIT finds some space in memory and fixes the base and limit registers accordingly.

  40. Supporting Data Structures BASETABLE: 0 100 0 LIMITTABLE: 0 199 0 ACCTABLE: 0 0 0

  41. PTE = 1 Base = 0 Limit = 199 Index = 1 Demo Acc = 0 6 DISPATCH: STI LDA BASE_TABLE+ JNZ RESTORE_IT JUMPSUB LOADIT LDLIMIT LIMITTABLE+ JUMP STARTIT 7 8 9 10 11

  42. PTE = 1 Base = 0 Limit =199 Index =1 Demo Acc = 0 6 DISPATCH: STI LDA BASE_TABLE+ JNZ RESTORE_IT JUMPSUB LOADIT LDLIMIT LIMITTABLE+ JUMP STARTIT 7 8 9 10 11

  43. 0 1 2 3 4 5 PTE = 1 Base = 100 Limit = 199 Index = 1 Demo Acc = 0 JUMP IDLE STARTIT: LDBASE BASETABLE+ JUMPSUB SAVE_IT IDLE: LDA PTE JNZ DISPATCH JUMP IDLE

  44. PTE =0 Base = 100 Limit = 199 Index = 1 Demo Acc = 0 Main Memory Address STB 3 100 #0 LDBASE 101 JUMP @3 102 # PC Stored Here 4 103 LDA #8 104 STPC+2 B 112 JUMP 0 113

  45. PTE = 0 Base = 100 Limit =199 Index =1 Demo Acc = 8 Main Memory Address STB 3 100 #0 LDBASE 101 JUMP @3 102 # PC Stored Here 4 103 LDA #8 104 STPC+2 B 112 JUMP 0 113

  46. PTE = 0 Base = 100 Limit = 199 Index = 1 Demo Acc =9 Main Memory Address STB 3 100 #0 LDBASE 101 JUMP @3 102 # PC Stored Here 4 103 LOAD #8 104 program instructions leading to it wanting to halt temporarily STPC+2 B 112 JUMP 0 113

  47. PTE = 0 Base = 100 Limit = 199 Index = 1 Demo Acc = 8 B = 14 Main Memory Address STB 3 100 #0 LDBASE 101 JUMP @3 102 # PC Stored Here 4 103 LOAD 8 104 STPC+2 B 112 JUMP 0 113

  48. PTE = 0 Base = 100 Limit = 199 Index = 1 Demo Acc = 8 B = 14 Main Memory Address STB 3 100 #0 LDBASE 101 JUMP @3 102 # PC Stored Here 4 103 LOAD 8 104 STPC+2 B 112 JUMP 0 113

  49. PTE = 0 Base = 100 Limit = 199 Index = 1 Demo Acc = 8 B = 14 Main Memory Address STB 3 100 #0 LDBASE 101 JUMP @3 102 # PC Stored Here 14 103 LOAD 8 104 STPC+2 B 112 JUMP 0 113

  50. PTE = 0 Base = 0 Limit = 199 Index = 1 Demo Acc = 8 B = 14 Main Memory Address STB 3 100 #0 LDBASE 101 JUMP @3 102 # PC Stored Here 14 103 LOAD 8 104 STPC+2 B 112 JUMP 0 113

More Related