cmput101(c) vadim bulitko, jia you1 chapter 6.4 : operating systems outline: – functions of an os...

24
CMPUT101 (c) Vadim Bulitko, Jia Yo u 1 Chapter 6.4 : Chapter 6.4 : Operating Operating Systems Systems Outline: Outline: Functions of an OS Functions of an OS Historical Overview Historical Overview The Future The Future

Post on 22-Dec-2015

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CMPUT101(c) Vadim Bulitko, Jia You1 Chapter 6.4 : Operating Systems Outline: – Functions of an OS – Historical Overview – The Future

CMPUT101 (c) Vadim Bulitko, Jia You 1

Chapter 6.4 : Chapter 6.4 : Operating SystemsOperating Systems

Chapter 6.4 : Chapter 6.4 : Operating SystemsOperating Systems

Outline:Outline: – Functions of an OSFunctions of an OS

– Historical OverviewHistorical Overview

– The FutureThe Future

Page 2: CMPUT101(c) Vadim Bulitko, Jia You1 Chapter 6.4 : Operating Systems Outline: – Functions of an OS – Historical Overview – The Future

2(c) Vadim Bulitko, Jia YouCMPUT101

System SoftwareSystem Software

HardwareHardwareHardwareHardware

Machine interfaceMachine interface

Virtual machine Virtual machine interfaceinterface

Virtual machineVirtual machine (or virtual environment(or virtual environment))

Page 3: CMPUT101(c) Vadim Bulitko, Jia You1 Chapter 6.4 : Operating Systems Outline: – Functions of an OS – Historical Overview – The Future

CMPUT101 (c) Vadim Bulitko, Jia You 3

Typical Types of System Typical Types of System SoftwareSoftware

Typical Types of System Typical Types of System SoftwareSoftware

• Language translatorLanguage translator - assemblers, compilers, interpreters, …- assemblers, compilers, interpreters, …• Memory managerMemory manager - allocate space for program execution- allocate space for program execution• File systemFile system - storage and retrieval for mass storage devices- storage and retrieval for mass storage devices• SchedulerScheduler - select a task to run- select a task to run• UtilitiesUtilities - a collection of programs that provide services - a collection of programs that provide services

Page 4: CMPUT101(c) Vadim Bulitko, Jia You1 Chapter 6.4 : Operating Systems Outline: – Functions of an OS – Historical Overview – The Future

CMPUT101 (c) Vadim Bulitko, Jia You 4

Operating System Operating System FunctionsFunctions

Operating System Operating System FunctionsFunctions

• User InterfaceUser Interface

• System Security & ProtectionSystem Security & Protection

• Efficient Allocation of Resources (including file Efficient Allocation of Resources (including file

system)system)

• Safe Use of ResourcesSafe Use of Resources

Page 5: CMPUT101(c) Vadim Bulitko, Jia You1 Chapter 6.4 : Operating Systems Outline: – Functions of an OS – Historical Overview – The Future

CMPUT101 (c) Vadim Bulitko, Jia You 5

User TasksUser TasksUser TasksUser Tasks

• Word-processingWord-processing• ProgrammingProgramming• File managementFile management• GamesGames• NetworkingNetworking• Etc….Etc….

Page 6: CMPUT101(c) Vadim Bulitko, Jia You1 Chapter 6.4 : Operating Systems Outline: – Functions of an OS – Historical Overview – The Future

CMPUT101 (c) Vadim Bulitko, Jia You 6

OS User InterfaceOS User InterfaceOS User InterfaceOS User Interface

• Word-Word-processingprocessing

• ProgrammingProgramming

• File File managementmanagement

• GamesGames

• NetworkingNetworking

• Etc….Etc….

OS OS UserUser

InterfaceInterface

Word-ProcessorWord-Processor

C++C++

File SystemFile System

GamesGames

E-mailE-mail

Page 7: CMPUT101(c) Vadim Bulitko, Jia You1 Chapter 6.4 : Operating Systems Outline: – Functions of an OS – Historical Overview – The Future

CMPUT101 (c) Vadim Bulitko, Jia You 7

User InterfaceUser InterfaceUser InterfaceUser Interface

StartStart

Is it legal?Is it legal?

Request from userRequest from user

Software package neededSoftware package needed

Schedule it to run on computerSchedule it to run on computer

YesYes

Print an error Print an error

messagemessageNoNo

Page 8: CMPUT101(c) Vadim Bulitko, Jia You1 Chapter 6.4 : Operating Systems Outline: – Functions of an OS – Historical Overview – The Future

CMPUT101 (c) Vadim Bulitko, Jia You 8

Types of User InterfacesTypes of User InterfacesTypes of User InterfacesTypes of User Interfaces

• Command language (e.g. Unix)Command language (e.g. Unix) by a prompt characterby a prompt character

• Graphical user interface (e.g. Windows)Graphical user interface (e.g. Windows) uses icons, pull-down menus, scrolling windowsuses icons, pull-down menus, scrolling windows

• Which one is superior?Which one is superior?

> cd /usr/prof/you/cmput101> cd /usr/prof/you/cmput101

Page 9: CMPUT101(c) Vadim Bulitko, Jia You1 Chapter 6.4 : Operating Systems Outline: – Functions of an OS – Historical Overview – The Future

CMPUT101 (c) Vadim Bulitko, Jia You 9

System Security & System Security & ProtectionProtection

System Security & System Security & ProtectionProtection

• Log in permissions Log in permissions

• File permissionsFile permissions

• System access System access

levelslevels

• EncryptionEncryption

Page 10: CMPUT101(c) Vadim Bulitko, Jia You1 Chapter 6.4 : Operating Systems Outline: – Functions of an OS – Historical Overview – The Future

CMPUT101 (c) Vadim Bulitko, Jia You 10

EncryptionEncryptionEncryptionEncryption• You may see it, but you don’t know what it is.You may see it, but you don’t know what it is.

A text can be encrypted by performing some sequence of A text can be encrypted by performing some sequence of mathematical operationsmathematical operations

E.g. E.g.

01000001 01000010 0100001101000001 01000010 01000011

A B CA B CAfter some operations, e.g. left-shifting, they will become somethingAfter some operations, e.g. left-shifting, they will become something

else other than ABC. One must know what operations have been else other than ABC. One must know what operations have been

performed in order to know what the original text is.performed in order to know what the original text is.

Page 11: CMPUT101(c) Vadim Bulitko, Jia You1 Chapter 6.4 : Operating Systems Outline: – Functions of an OS – Historical Overview – The Future

CMPUT101 (c) Vadim Bulitko, Jia You 11

Why Encryption Works Why Encryption Works (in theory)(in theory)

Why Encryption Works Why Encryption Works (in theory)(in theory)

• Without a key, a correct guess is almost impossibleWithout a key, a correct guess is almost impossible

E.g. Given an extremely large number N that is the multiplicationE.g. Given an extremely large number N that is the multiplication of two prime numbers, of two prime numbers,

- if we know one of the prime numbers, its easy to figure out - if we know one of the prime numbers, its easy to figure out the otherthe other - otherwise it can take millions of years for the fast computer to - otherwise it can take millions of years for the fast computer to generate the two prime numbers.generate the two prime numbers.

• In reality, no matter how sophisticated an encryption algorithm is, it seems someone could break it.In reality, no matter how sophisticated an encryption algorithm is, it seems someone could break it.

numbers.numbers.

Page 12: CMPUT101(c) Vadim Bulitko, Jia You1 Chapter 6.4 : Operating Systems Outline: – Functions of an OS – Historical Overview – The Future

CMPUT101 (c) Vadim Bulitko, Jia You 12

Efficient Resource Efficient Resource AllocationAllocation

Efficient Resource Efficient Resource AllocationAllocation

• Consider the following code:Consider the following code:While j < 10While j < 10

While (PrinterStatus == ‘busy’) While (PrinterStatus == ‘busy’) WaitWait

Print pagePrint pagejj

j = j + 1j = j + 1

• Processor time for the loop is Processor time for the loop is 1/10001/1000 second second• Printing time for a page is Printing time for a page is 11 minute minute• How much idling will the processor do?How much idling will the processor do?

Page 13: CMPUT101(c) Vadim Bulitko, Jia You1 Chapter 6.4 : Operating Systems Outline: – Functions of an OS – Historical Overview – The Future

CMPUT101 (c) Vadim Bulitko, Jia You 13

SolutionSolutionSolutionSolution

• Execute another program while the first Execute another program while the first program waits for the printerprogram waits for the printer

• The same approach is used for all The same approach is used for all input/output (I/O) waits: printer, display, input/output (I/O) waits: printer, display, hard-drives, network, etc.hard-drives, network, etc.

Page 14: CMPUT101(c) Vadim Bulitko, Jia You1 Chapter 6.4 : Operating Systems Outline: – Functions of an OS – Historical Overview – The Future

CMPUT101 (c) Vadim Bulitko, Jia You 14

Time SharingTime SharingThere are many programs that need to run at a given There are many programs that need to run at a given

time:time:

E.g. Editing using Microsoft WordE.g. Editing using Microsoft Word

Surfing the net using a browserSurfing the net using a browser

Compiling a C++ programCompiling a C++ program

But there is only one processor on a computerBut there is only one processor on a computer

Page 15: CMPUT101(c) Vadim Bulitko, Jia You1 Chapter 6.4 : Operating Systems Outline: – Functions of an OS – Historical Overview – The Future

CMPUT101 (c) Vadim Bulitko, Jia You 15

Program QueuesProgram QueuesProgram QueuesProgram QueuesPrograms that are requested to run are divided intoPrograms that are requested to run are divided into

RunningRunning:: the program executing on processor the program executing on processor

ReadyReady:: programs that are loaded to RAM and ready to run programs that are loaded to RAM and ready to run

Waiting:Waiting: programs that cannot run, waiting for I/Oprograms that cannot run, waiting for I/O or some other time consuming eventor some other time consuming event

E.g. in C++ when your program containsE.g. in C++ when your program contains cin >> A; cin >> A; processor won’t sit idle waiting for the user to enter something,processor won’t sit idle waiting for the user to enter something, if there are other tasks to runif there are other tasks to run

Page 16: CMPUT101(c) Vadim Bulitko, Jia You1 Chapter 6.4 : Operating Systems Outline: – Functions of an OS – Historical Overview – The Future

CMPUT101 (c) Vadim Bulitko, Jia You 16

Safe Resource Allocation Safe Resource Allocation & Deadlocks& Deadlocks

Safe Resource Allocation Safe Resource Allocation & Deadlocks& Deadlocks

Yield…Yield… Yield…Yield…

DEADLOCKDEADLOCKDEADLOCKDEADLOCK

Page 17: CMPUT101(c) Vadim Bulitko, Jia You1 Chapter 6.4 : Operating Systems Outline: – Functions of an OS – Historical Overview – The Future

CMPUT101 (c) Vadim Bulitko, Jia You 17

Deadlock: another Deadlock: another exampleexample

Deadlock: another Deadlock: another exampleexample

• John borrowed book A from the library.John borrowed book A from the library.

- - John is holding book A but also needs book B to John is holding book A but also needs book B to complete his assignmentcomplete his assignment

• Marry borrowed book B from the library.Marry borrowed book B from the library. - Marry is holding book B but also needs book A to- Marry is holding book B but also needs book A to complete her homeworkcomplete her homework

This is a deadlock situation. As a result, no one can This is a deadlock situation. As a result, no one can complete his/her work.complete his/her work.

Page 18: CMPUT101(c) Vadim Bulitko, Jia You1 Chapter 6.4 : Operating Systems Outline: – Functions of an OS – Historical Overview – The Future

CMPUT101 (c) Vadim Bulitko, Jia You 18

DeadlockDeadlock DeadlockDeadlock

A set of programs each of which is waiting for an event toA set of programs each of which is waiting for an event to

Occur before it may proceed, but that event can be Occur before it may proceed, but that event can be caused only by another waiting program in the set.caused only by another waiting program in the set.

Example.Example.

Program A Program BProgram A Program B

Holds Get disk drive Get laser printerHolds Get disk drive Get laser printer

Requests Get laser printer Get disk driveRequests Get laser printer Get disk drive

Page 19: CMPUT101(c) Vadim Bulitko, Jia You1 Chapter 6.4 : Operating Systems Outline: – Functions of an OS – Historical Overview – The Future

CMPUT101 (c) Vadim Bulitko, Jia You 19

DeadlocksDeadlocksDeadlocksDeadlocks

Word Word

ProcessorProcessor

WebWeb

browserbrowser

has has exclusive exclusive access ofaccess of

has has exclusive exclusive access ofaccess of

needsneeds

needsneeds

Page 20: CMPUT101(c) Vadim Bulitko, Jia You1 Chapter 6.4 : Operating Systems Outline: – Functions of an OS – Historical Overview – The Future

CMPUT101 (c) Vadim Bulitko, Jia You 20

Deadlock could occur in Deadlock could occur in telecommunicationtelecommunication

Deadlock could occur in Deadlock could occur in telecommunicationtelecommunication

E-mailE-mail

ClientClient

E-mailE-mail

ServerServer

acknowledgementacknowledgementAA

message message AA

acknowledgementacknowledgementBB

message message BB

Page 21: CMPUT101(c) Vadim Bulitko, Jia You1 Chapter 6.4 : Operating Systems Outline: – Functions of an OS – Historical Overview – The Future

CMPUT101 (c) Vadim Bulitko, Jia You 21

Deadlock SolutionsDeadlock SolutionsDeadlock SolutionsDeadlock Solutions• PreventionPrevention - - Give every program all resources or noneGive every program all resources or none

• Deadlock RecoveryDeadlock Recovery - - If a program cannot get all it needs, it must If a program cannot get all it needs, it must give up all resources it currently ownsgive up all resources it currently owns

• In the example of telecommunication, resend In the example of telecommunication, resend messages if no acknowledgement is received messages if no acknowledgement is received within so many secondswithin so many seconds

Page 22: CMPUT101(c) Vadim Bulitko, Jia You1 Chapter 6.4 : Operating Systems Outline: – Functions of an OS – Historical Overview – The Future

CMPUT101 (c) Vadim Bulitko, Jia You 22

OS HistoryOS HistoryOS HistoryOS History

• 11stst generation (1945-1955): generation (1945-1955): nonenone

• 22ndnd generation (1955-1965): generation (1955-1965): batch OSbatch OS

• 33rdrd generation (1965-1985): generation (1965-1985): multi-prog. OSmulti-prog. OS

• 44thth generation (1985-now): generation (1985-now): network OS, network OS,

GUIGUI

Page 23: CMPUT101(c) Vadim Bulitko, Jia You1 Chapter 6.4 : Operating Systems Outline: – Functions of an OS – Historical Overview – The Future

CMPUT101 (c) Vadim Bulitko, Jia You 23

The Future of OS…The Future of OS…The Future of OS…The Future of OS…

• Extensive multimedia InterfacesExtensive multimedia Interfaces (sound, graphics, (sound, graphics,

video, 3D, voice-recognition, tactile input devices, video, 3D, voice-recognition, tactile input devices,

etc.)etc.)

• Parallel processingParallel processing (a multitude of processors on a (a multitude of processors on a

single computer)single computer)

• Massively and transparently distributedMassively and transparently distributed (extensive (extensive

networking, wireless, fiber-optics)networking, wireless, fiber-optics)

Page 24: CMPUT101(c) Vadim Bulitko, Jia You1 Chapter 6.4 : Operating Systems Outline: – Functions of an OS – Historical Overview – The Future

CMPUT101 (c) Vadim Bulitko, Jia You 24

Summary Summary Summary Summary

• OS is a part of system softwareOS is a part of system software• Functions:Functions:

– User InterfaceUser Interface– System Security & ProtectionSystem Security & Protection– Efficient Allocation of ResourcesEfficient Allocation of Resources– Safe Use of ResourcesSafe Use of Resources

• History of OSHistory of OS• The Future…The Future…