operating systems - department of computer science...

22
Operating-System Services and Structure Operating Systems P. Healy CS1-08 Computer Science Bldg. tel: 202727 [email protected] Autumn 2019–2020 P. Healy (University of Limerick) CS4023 Autumn 2019–2020 1 / 22

Upload: others

Post on 24-Mar-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Operating Systems - Department of Computer Science ...garryowen.csisdmz.ul.ie/~cs4023/resources/lect04.pdf · OS Services: Assistance to the User OS Services: Efficient Operation

Operating-System Services and Structure

Operating Systems

P. Healy

CS1-08Computer Science Bldg.

tel: [email protected]

Autumn 2019–2020

P. Healy (University of Limerick) CS4023 Autumn 2019–2020 1 / 22

Page 2: Operating Systems - Department of Computer Science ...garryowen.csisdmz.ul.ie/~cs4023/resources/lect04.pdf · OS Services: Assistance to the User OS Services: Efficient Operation

Operating-System Services and Structure

Outline

1 Operating-System Services and StructureOS Services: Assistance to the UserOS Services: Efficient OperationOS Operations

P. Healy (University of Limerick) CS4023 Autumn 2019–2020 2 / 22

Page 3: Operating Systems - Department of Computer Science ...garryowen.csisdmz.ul.ie/~cs4023/resources/lect04.pdf · OS Services: Assistance to the User OS Services: Efficient Operation

Operating-System Services and StructureOS Services: Assistance to the UserOS Services: Efficient OperationOS Operations

Operating System Definition

Intermediary between a user of a computer and thecomputer hardwareControl program

Controls execution of programs to prevent errors andimproper use of the computer

Resource allocatorManages all resourcesDecides between for efficient and fairresource use

P. Healy (University of Limerick) CS4023 Autumn 2019–2020 3 / 22

Page 4: Operating Systems - Department of Computer Science ...garryowen.csisdmz.ul.ie/~cs4023/resources/lect04.pdf · OS Services: Assistance to the User OS Services: Efficient Operation

Operating-System Services and StructureOS Services: Assistance to the UserOS Services: Efficient OperationOS Operations

Operating System Design

Design and Implementation of OS not “solvable”, but someapproaches have proven successfulInternal structure of different Operating Systems can varywidelyAffected by choice of hardware, type of systemUser goals and System goals

User goals: operating system should be, easy to learn, reliable,

System goals: operating system should be easy to design,implement, and maintain, as well as flexible, reliable,error-free, and efficient

P. Healy (University of Limerick) CS4023 Autumn 2019–2020 4 / 22

Page 5: Operating Systems - Department of Computer Science ...garryowen.csisdmz.ul.ie/~cs4023/resources/lect04.pdf · OS Services: Assistance to the User OS Services: Efficient Operation

Operating-System Services and StructureOS Services: Assistance to the UserOS Services: Efficient OperationOS Operations

A View of Operating System Services

P. Healy (University of Limerick) CS4023 Autumn 2019–2020 5 / 22

Page 6: Operating Systems - Department of Computer Science ...garryowen.csisdmz.ul.ie/~cs4023/resources/lect04.pdf · OS Services: Assistance to the User OS Services: Efficient Operation

Operating-System Services and StructureOS Services: Assistance to the UserOS Services: Efficient OperationOS Operations

Outline

1 Operating-System Services and StructureOS Services: Assistance to the UserOS Services: Efficient OperationOS Operations

P. Healy (University of Limerick) CS4023 Autumn 2019–2020 6 / 22

Page 7: Operating Systems - Department of Computer Science ...garryowen.csisdmz.ul.ie/~cs4023/resources/lect04.pdf · OS Services: Assistance to the User OS Services: Efficient Operation

Operating-System Services and StructureOS Services: Assistance to the UserOS Services: Efficient OperationOS Operations

User Interfaces

User interface (UI)(CLI)

Graphics User Interface (GUI)

P. Healy (University of Limerick) CS4023 Autumn 2019–2020 7 / 22

Page 8: Operating Systems - Department of Computer Science ...garryowen.csisdmz.ul.ie/~cs4023/resources/lect04.pdf · OS Services: Assistance to the User OS Services: Efficient Operation

Operating-System Services and StructureOS Services: Assistance to the UserOS Services: Efficient OperationOS Operations

User Interface – CLI

CLI allowsSometimes several alternatives implemented – shellsPrimarily fetches a command from user and executes it

Sometimes commands built-in, sometimes just names ofprograms

P. Healy (University of Limerick) CS4023 Autumn 2019–2020 8 / 22

Page 9: Operating Systems - Department of Computer Science ...garryowen.csisdmz.ul.ie/~cs4023/resources/lect04.pdf · OS Services: Assistance to the User OS Services: Efficient Operation

Operating-System Services and StructureOS Services: Assistance to the UserOS Services: Efficient OperationOS Operations

User Interface – GUI

User-friendly interface (desktop metaphor)Usually mouse, keyboard, and monitorIcons represent folders, files, programs, actions, etc.Various mouse buttons over objects in the interface causevarious actions

Many systems now include both CLI and GUI interfacesLinux, like all UNIXs has CLI and has additional GUIinterfaces: KDE, Gnome, XfceMicrosoft Windows is GUI with CLI “command” shellApple Mac OS X has “Aqua” GUI interface with UNIX kernelunderneath and shells availableSolaris is CLI with optional GUI interfaces (Java Desktop)

P. Healy (University of Limerick) CS4023 Autumn 2019–2020 9 / 22

Page 10: Operating Systems - Department of Computer Science ...garryowen.csisdmz.ul.ie/~cs4023/resources/lect04.pdf · OS Services: Assistance to the User OS Services: Efficient Operation

Operating-System Services and StructureOS Services: Assistance to the UserOS Services: Efficient OperationOS Operations

Further OS Services (Assistance)

Program execution: OS must be able to load a programinto memory, run that program, and end execution (eithernormally or abnormally)I/O operations: A running program (process) may requireI/O, which may involve a file or an I/O deviceFile-system manipulation:

File system is of particular interestProcesses need to

read and write files and directoriescreate and delete themsearch themlist file information

P. Healy (University of Limerick) CS4023 Autumn 2019–2020 10 / 22

Page 11: Operating Systems - Department of Computer Science ...garryowen.csisdmz.ul.ie/~cs4023/resources/lect04.pdf · OS Services: Assistance to the User OS Services: Efficient Operation

Operating-System Services and StructureOS Services: Assistance to the UserOS Services: Efficient OperationOS Operations

Further OS Services (Assistance) (contd.)

MultiprogrammingThe CPU always has ; when thecurrently running process needs to wait (e.g., for I/O), OSallocates the CPU to another job

Time-sharing (multitasking)Logical extension to multiprogramming; the CPU switchesprocesses so frequently that users can interact with eachprocess while it is running, creating interactive computing

P. Healy (University of Limerick) CS4023 Autumn 2019–2020 11 / 22

Page 12: Operating Systems - Department of Computer Science ...garryowen.csisdmz.ul.ie/~cs4023/resources/lect04.pdf · OS Services: Assistance to the User OS Services: Efficient Operation

Operating-System Services and StructureOS Services: Assistance to the UserOS Services: Efficient OperationOS Operations

Further OS Services (Assistance) (contd.)

Communications: Processes may exchange information,on the same computer or over a network

Communications may be via or throughmessage passing

Error detection: OS needs to be constantly aware ofpossible errors

May occur in the CPU and memory hardware, in I/Odevices, in user programFor each type of error, OS should take the appropriateaction to ensure correct and consistent computing

P. Healy (University of Limerick) CS4023 Autumn 2019–2020 12 / 22

Page 13: Operating Systems - Department of Computer Science ...garryowen.csisdmz.ul.ie/~cs4023/resources/lect04.pdf · OS Services: Assistance to the User OS Services: Efficient Operation

Operating-System Services and StructureOS Services: Assistance to the UserOS Services: Efficient OperationOS Operations

A Political Struggle

Some of the great political thinkers of our time: here

P. Healy (University of Limerick) CS4023 Autumn 2019–2020 13 / 22

Page 14: Operating Systems - Department of Computer Science ...garryowen.csisdmz.ul.ie/~cs4023/resources/lect04.pdf · OS Services: Assistance to the User OS Services: Efficient Operation

Operating-System Services and StructureOS Services: Assistance to the UserOS Services: Efficient OperationOS Operations

Outline

1 Operating-System Services and StructureOS Services: Assistance to the UserOS Services: Efficient OperationOS Operations

P. Healy (University of Limerick) CS4023 Autumn 2019–2020 14 / 22

Page 15: Operating Systems - Department of Computer Science ...garryowen.csisdmz.ul.ie/~cs4023/resources/lect04.pdf · OS Services: Assistance to the User OS Services: Efficient Operation

Operating-System Services and StructureOS Services: Assistance to the UserOS Services: Efficient OperationOS Operations

OS Services to Maintain Efficient Operation

Resource allocation: When multiple users or multiplejobs running concurrently, resources must be allocated toeach of them

Many types of resources: some (such as CPU cycles, mainmemory, and file storage) may have special allocationprotocol (specialist algorithms)Others (such as I/O devices) may have general request andrelease protocol

Accounting: To keep track of which users use how muchand what kinds of computer resources

P. Healy (University of Limerick) CS4023 Autumn 2019–2020 15 / 22

Page 16: Operating Systems - Department of Computer Science ...garryowen.csisdmz.ul.ie/~cs4023/resources/lect04.pdf · OS Services: Assistance to the User OS Services: Efficient Operation

Operating-System Services and StructureOS Services: Assistance to the UserOS Services: Efficient OperationOS Operations

OS Services to Maintain Efficient Operation (contd.)

Protection and security: to control use of shared data (ona multiuser system or a network)

Protection involves ensuring that all access to systemresources is controlledSecurity of the system from outsiders requires userauthentication, extends to defending external I/O devicesfrom invalid access attemptsIf a system is to be protected and secure, precautions mustbe instituted throughout – chain is only as strong as itsweakest link

P. Healy (University of Limerick) CS4023 Autumn 2019–2020 16 / 22

Page 17: Operating Systems - Department of Computer Science ...garryowen.csisdmz.ul.ie/~cs4023/resources/lect04.pdf · OS Services: Assistance to the User OS Services: Efficient Operation

Operating-System Services and StructureOS Services: Assistance to the UserOS Services: Efficient OperationOS Operations

Outline

1 Operating-System Services and StructureOS Services: Assistance to the UserOS Services: Efficient OperationOS Operations

P. Healy (University of Limerick) CS4023 Autumn 2019–2020 17 / 22

Page 18: Operating Systems - Department of Computer Science ...garryowen.csisdmz.ul.ie/~cs4023/resources/lect04.pdf · OS Services: Assistance to the User OS Services: Efficient Operation

Operating-System Services and StructureOS Services: Assistance to the UserOS Services: Efficient OperationOS Operations

Supporting Typical OS Operations

The interrupt mechanism:Supports several of the typical operations an OS mustsupport:

making a system callmanaging a timer

Interrupt driven by hardwareSoftware error or request creates exception or trap

Division by zero, request for operating system serviceOther process problems including

infinite loopstack overflowprocesses modifying each other or the operating system

P. Healy (University of Limerick) CS4023 Autumn 2019–2020 18 / 22

Page 19: Operating Systems - Department of Computer Science ...garryowen.csisdmz.ul.ie/~cs4023/resources/lect04.pdf · OS Services: Assistance to the User OS Services: Efficient Operation

Operating-System Services and StructureOS Services: Assistance to the UserOS Services: Efficient OperationOS Operations

Interrupts: System calls

Dual-mode operation allows OS to protect itself and othersystem components

User mode and kernel modeMode bit provided by hardware

Provides ability to distinguish when system is running usercode or kernel codeSome instructions designated as privileged, only executablein kernel modeSystem call changes mode to kernel, return from call resetsit to user

Excellent discussion of dual mode here

P. Healy (University of Limerick) CS4023 Autumn 2019–2020 19 / 22

Page 20: Operating Systems - Department of Computer Science ...garryowen.csisdmz.ul.ie/~cs4023/resources/lect04.pdf · OS Services: Assistance to the User OS Services: Efficient Operation

Operating-System Services and StructureOS Services: Assistance to the UserOS Services: Efficient OperationOS Operations

Making a System CallTransition from User to Kernel Mode

P. Healy (University of Limerick) CS4023 Autumn 2019–2020 20 / 22

Page 21: Operating Systems - Department of Computer Science ...garryowen.csisdmz.ul.ie/~cs4023/resources/lect04.pdf · OS Services: Assistance to the User OS Services: Efficient Operation

Operating-System Services and StructureOS Services: Assistance to the UserOS Services: Efficient OperationOS Operations

Interrupts: Timer

Timer to prevent infinite loop / process hogging resourcesSet interrupt after specific periodOperating system decrements counterWhen counter zero generate an interruptSet up before scheduling process to regain control orterminate program that exceeds allotted time

P. Healy (University of Limerick) CS4023 Autumn 2019–2020 21 / 22

Page 22: Operating Systems - Department of Computer Science ...garryowen.csisdmz.ul.ie/~cs4023/resources/lect04.pdf · OS Services: Assistance to the User OS Services: Efficient Operation

Operating-System Services and StructureOS Services: Assistance to the UserOS Services: Efficient OperationOS Operations

Hierarchical Protection DomainsProtection Rings

Hierarchical ProtectionDomains, also known asprotection ringsHardware supported ringswere introduced by MulticsHowever, mostgeneral-purpose UNIXsystems use only tworings, even if the hardwareit runs on provides moreCPU modes than that

Privilege rings for X86processor family

P. Healy (University of Limerick) CS4023 Autumn 2019–2020 22 / 22