P Part I Overview t I O i C Chapter 2: Operating System - - PowerPoint PPT Presentation

p part i overview t i o i
SMART_READER_LITE
LIVE PREVIEW

P Part I Overview t I O i C Chapter 2: Operating System - - PowerPoint PPT Presentation

P Part I Overview t I O i C Chapter 2: Operating System Structures 2 O i S S 1 Fall 2010 Operating System Services Operating System Services User Interface ( e.g ., command processor shell and GUI Graphical User


slide-1
SLIDE 1

P t I O i Part I Overview

C 2 O i S S Chapter 2: Operating System Structures

1

Fall 2010

slide-2
SLIDE 2

Operating System Services Operating System Services

User Interface (e.g., command processor –shell and GUI – Graphical User Interface) and GUI Graphical User Interface) Program execution I/O operations I/O operations File-system manipulation Communications Communications Error detection Resource allocation Resource allocation Accounting Protection

2

Protection

slide-3
SLIDE 3

System Calls System Calls

System calls provide an interface to the services d il bl b i made available by an operating system. Type of system calls:

Process control (e.g., create and destroy processes) File management (e.g., open and close files) Device management (e.g., read and write operations) Information maintenance (e.g., get time or date) Communication (e.g., send and receive messages)

3

slide-4
SLIDE 4

S t S t C ll M h i 1/2 1/2 Sys ystem em Call ll Mec echan anism: sm: 1/2 1/2

register X syscall 10 X syscall 10 service routine

syscall parameters

Load addr. X Load addr. X syscall 10

4

slide-5
SLIDE 5

S stem tem Call all Mechanism echanism 2/2 2/2 System stem Call Call Mechanism Mechanism: : 2/2 2/2

A system call generates kernel A system call generates an interrupt, actually a trap

interrupt h dl

syscall i

kernel trap. The executing program i d d

handler

services d it h

is suspended. Control is then

mode switch

transferred to the OS. Program continues

syscall 10

g when the system call service completes.

y

5

p

slide-6
SLIDE 6

System Programs System Programs

File management (e.g., create, delete files) Status management (e.g., date/time, available memory and disk space) File modification (e.g., editors) Programming language support (e.g., assemblers, compilers, interpreters) Program loading and execution (e.g., loaders, linkage editors) Communications (e.g., connections between processes, sending/receiving e-mails)

6

slide-7
SLIDE 7

Operating Operating System System Design Design and and Operating Operating-System System Design Design and and Implementation: Implementation: 1/5 1/5

Design Goals Mechanisms and Polices Implementation Implementation

7

slide-8
SLIDE 8

Operating Operating System System Design Design and and Operating Operating-System System Design Design and and Implementation: Implementation: 2/5 2/5

Design Goals

Goals and specifications are affected by hardware and the type of the system (e.g., b t h ti h i l ti t ) batch, time-sharing, real-time, etc) Requirements: user goals and system goals.

User goals: easy of use, reliable, safe, fast System goals: easy to design, implement and maintain and flexible reliable efficient etc maintain, and flexible, reliable, efficient, etc.

There is no unique way to achieve all goals, and some compromises must be taken

8

and some compromises must be taken.

slide-9
SLIDE 9

Operating Operating System System Design Design and and Operating Operating-System System Design Design and and Im Implementation: lementation: 3/5 3/5 p

Mechanisms and Policies: 1/2 Mechanisms and Policies: 1/2

Mechanisms determine how to do something. Policies determine what will be done. Policies and mechanisms are usually separated: the separation of mechanism and policy principle.

9

slide-10
SLIDE 10

Operating Operating-System System Design Design and and Operating Operating System System Design Design and and Implementation: Implementation: 4/5 4/5

Mechanisms and Policies: 2/2

The separation of mechanism and policy: It is for efficiency purpose. Policies are likely to change over time. If l h i i il bl h i If a more general mechanism is available, the impact

  • f changing policy on mechanism is reduced.

Microkernel-based systems implement a basic set of Microkernel-based systems implement a basic set of building blocks, which are almost policy free. Thus, advanced policies and mechanisms can be added to d k l d l user-created kernel modules.

10

slide-11
SLIDE 11

Operating Operating System System Design Design and and Operating Operating-System System Design Design and and Implementation: Implementation: 5/5 5/5

Implementation

The assembly vs. high-level language issue

Advantages of high-level languages: easy to use and i t i d il bl i t l maintain, and more available programming tools Disadvantages of high-level languages: slower and more space more space

Many systems were written in both with a small percentage (e.g., 10%) of assembly language for percentage (e.g., 10%) of assembly language for the most speed demanding low level portion. Better data structures and algorithms are more

11

Better data structures and algorithms are more important than tweaking assembly instructions.

slide-12
SLIDE 12

Operating-System Structures Operating-System Structures

Simple Structure Layered Approach Layered Approach Microkernels Modules

12

slide-13
SLIDE 13

Simple Structure Simple Structure

Simple structure systems do not have well-defined

MS-DOS structure

structures Unix only had a limited application programs structure: kernel and system programs resident sys program Everything between the system call interface and physical hardware is the

ROM BIOS device driver MS-DOS device drivers

physical hardware is the kernel.

ROM BIOS device driver

13

slide-14
SLIDE 14

Layered Approach: Layered Approach: 1/4 1/4

The operating system is broken up into a number of layers (or levels) each on top of number of layers (or levels), each on top of lower layers. Each layer is an implementation of an abstract y p

  • bject that is the encapsulation of data and
  • perations that can manipulate these data.

Th b tt l (l 0) i th h d d The bottom layer (layer 0) is the hardware, and the highest one is the user interface. The main advantage of layered approach is The main advantage of layered approach is modularity.

14

slide-15
SLIDE 15

L d L d A h 2/4 2/4 Layere ayered Approac pproach: : 2/4 2/4

The lowest layer is process The lowest layer is process management. Each layer only uses the Users Each layer only uses the

  • perations provided by lower

layers and does not have to file system

  • de

y know their implementation. Each layer hides the communication I/O & Device

sor mo

y existence of certain data structures, operations and I/O & Device virtual mem

upervis

hardware from higher-level

  • layers. Think about OO.

h d process

su

15

hardware

slide-16
SLIDE 16

La La ered ered Approach Approach Probs Probs 3/4 3/4 La Layered ered Approach Approach Probs Probs: : 3/4 3/4

It is difficult to organize the system in It is difficult to organize the system in layers, because a layer can use only layers below it Example: virtual layers below it. Example: virtual memory (lower layer) uses disk I/O (upper layer) (upper layer). Layered implementations tend to be less efficient than other types. Example: there may be too many calls going down the layers: user to I/O layer to memory layer to process scheduling layer.

16

slide-17
SLIDE 17

La La ered ered Approach Approach Probs Probs 4/4 4/4 La Layered ered Approach Approach Probs Probs: : 4/4 4/4

The layered approach

layer n: user interface

The layered approach may also represented as a set of concentric rings

n

a set of concentric rings. The first OS based on th l d h

1

the layered approach was THE, developed by E Dijk t

  • E. Dijkstra.

17

layer 0: hardware

slide-18
SLIDE 18

Microkernels: Microkernels: 1/5 1/5

Only absolutely essential core OS functions should be in the kernel. Less essential services and applications are built on the kernel and run in user are built on the kernel and run in user mode. Many functions that were in a traditional Many functions that were in a traditional OS become external subsystems that interact ith the kernel and ith each interact with the kernel and with each

  • ther.

18

slide-19
SLIDE 19

Microkernels: Microkernels: 2/5 2/5 Microkernels: Microkernels: 2/5 2/5

The main function The main function

  • f the microkernel is

to provide

pro virtu f dev clie

to provide communication facility between the

cess ser ual mem file serv vice dri ent pro

facility between the client programs and various services.

rver mory ver ivers

  • cess

various services. Communication is provided by provided by message passing. hardware

microkernel

19

hardware

slide-20
SLIDE 20

Mi Mi k l 3/5 3/5 Mi Micro crokerne ernels: s: 3/5 3/5

Uniform interfaces: message passing Uniform interfaces: message passing Extensibility: adding new services is easy i i i i i i Flexibility: existing services can be taken out easily to produce a smaller and more efficient implementation implementation Portability: all or at least most of the processor specific code is in the small kernel specific code is in the small kernel. Reliability: A small and modular designed kernel can be tested easily kernel can be tested easily Distributed system support: client and service processes can run on networked systems

20

processes can run on networked systems.

slide-21
SLIDE 21

Mi Mi k l 4/5 4/5 Mi Micro crokerne ernels: s: 4/5 4/5

B t i k l d h bl But, microkernels do have a problem:

As the number of system functions increases,

  • verhead increases and performance reduces.

Most microkernel systems took a hybrid

  • s

c o e e sys e s oo yb d approach, a combination of microkernel and something else (e.g., layered). g ( g , y )

21

slide-22
SLIDE 22

Mi Mi k l 5/5 5/5

Microkernel vs. Layered Approach Microkernel vs. Layered Approach

Mi Micr croker erne nels: s: 5/5 5/5

Users

pro virt de cli

file system

  • de
  • cess se

ual me file ser evice dr ient pro

communication I/O & Device

sor mo erver mory rver rivers

  • cess

I/O & Device virtual mem

upervis

h d process

su

hardware

microkernel

22

hardware hardware

slide-23
SLIDE 23

M d l M d l 1/2 1/2 Modules: es: 1/2 1/2

Th OO t h l The OO technology may be used to create a modular

scheduling

create a modular kernel. The kernel has a set

scheduling device/bus drivers file system

  • f core components

and dynamically

core Solaris kernel

  • ther

loadable

links in additional services either during boot time or

modules syscalls

during boot time or during run time.

STREAMS modules executable format

23

slide-24
SLIDE 24

Module: Module: 2/2 2/2

The module approach looks like the layered h h d l h i d fi i i approach as each module has a precise definition; however, the module approach is more flexible in th t d l ll th d l that any module can call any other module. The module approach is also like the microkernel approach because the core module only includes the core functions. However, the module approach is more efficient because no message passing is required.

24

slide-25
SLIDE 25

Virtual Machines: Virtual Machines: 1/5 1/5

A virtual machine, VM, is a software between the kernel and hardware between the kernel and hardware. A VM provides all functionalities of a CPU with software simulation. A user has the illusion that s/he has a real A user has the illusion that s/he has a real processor that can run a kernel.

25

slide-26
SLIDE 26

Virt Virt al al Machines Machines 2/5 2/5 Virt Virtual al Machines Machines: : 2/5 2/5

processes processes processes processes p kernel kernel kernel kernel kernel kernel kernel VM1 VM2 VM3 hardware e e hardware hardware VM implementation

26

slide-27
SLIDE 27

Virt Virt al al Machines Machines 3/5 3/5 Virt Virtual al Machines Machines: : 3/5 3/5

S lf Vi t li d VM th VM i id ti l t th Self-Virtualized VM: the VM is identical to the

  • hardware. Example: IBM’s VM/370 and

VM ( ti VM d Li t VMware (creating a VM under Linux to run Windows). Non-Self-Virtualized VM: the VM is not identical to the hardware. Example: Java Virtual Machine JVM and SoftWindow. It can be proved that all third-generation CPUs p g can be virtualized.

27

slide-28
SLIDE 28

Vi Vi t l M hi 4/5 4/5 Vi Virtua ual Mac achi hines: nes: 4/5 4/5

VM’s are difficult to implement because they VM s are difficult to implement because they must duplicate all hardware functions. Benefits: Benefits: VM provides a robust level of security VM permits system development to be done VM permits system development to be done without disrupting normal system operation. VM allows multiple operating systems to run VM allows multiple operating systems to run

  • n the same machine at the same time.

VM can make system transition/upgrade VM can make system transition/upgrade much easier

28

slide-29
SLIDE 29

Virtual Machines: Virtual Machines: 5/5 5/5

VMware Java VM

29

slide-30
SLIDE 30

Bootstrap Bootstrap or IPL PL Bootstrap Bootstrap or

  • r IPL

IPL

When the system is powered on a small When the system is powered on, a small program, usually stored in ROM (i.e., read only memory) is executed This initial program is memory), is executed. This initial program is usually referred to as a bootstrap program or an Initial Program Loader (IPL). g ( ) The bootstrap program reads in and initializes the operating system. The execution is then p g y transferred to the OS

30

slide-31
SLIDE 31

Th E d The End

31