53
Mi Jung Choi [email protected] Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 perating System Principles Chapter 2: Operating-System Structures

Mi Jung Choi [email protected] Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

Embed Size (px)

Citation preview

Page 1: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

Mi Jung [email protected]

Dept. of Computer Science

Silberschatz, Galvin and Gagne ©2006Operating System Principles

Chapter 2: Operating-System Structures

Page 2: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 2 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

Chapter 2: Operating-System Structures Operating System Services User Operating System Interface System Calls Types of System Calls System Programs

Operating System Design and Implementation Operating System Structure Virtual Machines

Page 3: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 3 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

Objectives To describe the services an operating system provides to

users, processes, and other systems

To discuss the various ways of structuring an operating system

Page 4: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 4 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

Operating System Services

To whom: Users, Processes, other systems

With What: Memory, Storage, Devices, CPU

One set of OS services provides functions that are helpful to the user

Another set of OS functions exists for ensuring the efficient operation of the system itself via resource sharing

Page 5: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 5 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

Operating System Services One set of OS services provides functions that are helpful

to the user:

User Interface Almost all operating systems have a user interface (UI) Varies between Command-Line Interface (CLI), Graphical User

Interface (GUI), Batch Interface

Program Execution The system must be able to load a program into memory and to

run that program, end execution either normally or abnormally (indicating error)

Page 6: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 6 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

Operating System Services One set of OS services provides functions that are helpful

to the user:

I/O Operations A running program may require I/O, which may involve a file or

an I/O device.

File-system Manipulation The file system is of particular interest. Process needs to

– read and write files and directories– create and delete them– search them– list file Information

permission management is also required.

Page 7: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 7 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

Operating System Services One set of OS services provides functions that are helpful

to the user:

Communications Processes may exchange information, on the same computer

or between computers over a network Communications may be via shared memory or through

message passing (packets moved by the OS)

Error Detection OS needs to be constantly aware of possible errors

– may occur in the CPU and memory, in I/O devices, in user program

For each type of error, OS should take the appropriate action to ensure correct and consistent computing

Debugging facilities can greatly enhance the user’s and programmer’s abilities to efficiently use the system

Page 8: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 8 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

Operating System Services Another set of OS functions exists for ensuring the

efficient operation of the system itself via resource sharing

Resource allocation When multiple users or multiple jobs running concurrently,

resources must be allocated to each of them Many types of resources

– Some (such as CPU cycles, main memory, and file storage) may have special allocation code.

– Others (such as I/O devices) may have general request and release code.

Accounting To keep track of which users use how much and what kinds of

computer resources

Page 9: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 9 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

Operating System Services Another set of OS functions exists for ensuring the

efficient operation of the system itself via resource sharing

Protection and security in a multi-user computer system The owners of information may want to control use of that

information Concurrent processes should not interfere with each other

Protection involves ensuring that all access to system resources is controlled

Security of the system from outsiders requires user authentication,

– extends to defending external I/O devices from invalid access attempts

Page 10: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 10 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

User Operating System Interface - CLI CLI allows direct command entry

Command Line Interface (CLI)

Sometimes implemented in kernel, Sometimes by systems program

Sometimes multiple flavors are implemented – shells BASH (Bourne-Again SHell ), CSH (C SHell), KSH (Korn

SHell), TCSH on Linux CMD on windows XP

Primarily fetches a command from user and executes it Sometimes commands built-in, Sometimes just names of programs

– adding new features doesn’t require shell modification

Page 11: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 11 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

User Operating System Interface - GUI User-friendly desktop metaphor interface

Usually mouse, keyboard, and monitor Icons represent files, programs, actions, etc Various mouse buttons over objects in the interface cause various

actions provide information, options, execute function, open directory

Invented at Xerox PARC

Many systems now include both CLI and GUI interfaces Microsoft Windows is GUI with CLI “command” or “cmd” shell Apple Mac OS X as “Aqua” GUI interface with UNIX kernel

underneath and shells available Linux is CLI with optional GUI interfaces (GNOM, KDE)

Page 12: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 12 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

System CallsThe only way that a process communicate with OS

It provides an interface to the service made available by an OS

Page 13: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 13 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

System Calls Programming interface to the services provided by the OS

Typically written in a high-level language (C or C++) Sometimes written using assembly-language instructions.

Mostly accessed by programs via a high-level Application Program Interface (API) rather than direct system call use Each API consists of one or more systems calls. APIs are OS specific.

Three most common APIs are Win32 API, Win64 API for Windows, POSIX API for POSIX-based systems (including UNIX, Linux, Mac OS X) Java API for the Java virtual machine (JVM)

Why use APIs rather than system calls? To provide a simplified method of the use of system calls and hide the

implementation details.

Page 14: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 14 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

Example of System Calls System call sequence to copy the contents of one file to

another file

scanf(infile)

scanf(outfile)

fopen(“r”);

fopen(“w”);

fgetc();

fputc();

fclose(infile);

fclose(outfile);

exit();

Page 15: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 15 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

Example of Standard API Consider the ReadFile() function in the Win32 API

reads data from a file, and starts at the position that the file pointer indicates.

You can use this function for both synchronous and asynchronous operations.

A description of the parameters passed to ReadFile() hFile - [in] A handle to the file to be read.

lpBuffer - [out] A pointer to the buffer that receives the data read from a file.

nNumberOfBytesToRead - [in] The maximum number of bytes to read. lpNumberOfBytesRead - [out] A pointer to the variable that receives the

number of bytes read.

lpOverlapped - [in] A pointer to an OVERLAPPED structure.

Page 16: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 16 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

System Call Implementation Typically, a number associated with each system call

System-call interface maintains a table indexed according to these numbers

The system call interface invokes intended system call in OS kernel and returns status of the system call and any return values

The caller needs to know nothing about how the system call is implemented Just needs to obey API and understand what OS will do as a result

of the call Most details of OS interface hidden from programmer by API

Page 17: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 17 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

API – System Call – OS Relationship

Page 18: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 18 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

Standard C Library Example C program invoking

printf() library call, which calls write() system call

Page 19: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 19 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

System Call Parameter Passing Often, more information is required than simple identity of

desired system call Exact type and amount of information vary according to OS and

system call

Three general methods used to pass parameters to the OS Simplest: pass the parameters in registers

In some cases, may be more parameters than registers Parameters stored in a block, or table, in memory, and address of

block passed as a parameter in a register This approach taken by Linux and Solaris

Parameters placed, or pushed, onto the stack by the program and popped off the stack by the operating system

Block and stack methods do not limit the number or length of parameters being passed

Page 20: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 20 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

Parameter Passing via Table

Page 21: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 21 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

Types of System Calls Five types of system calls

Process control File management Device management Information maintenance Communications

Page 22: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 22 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

Types of System Calls Process control

end, abort load, execute create process, terminate process get process attributes, set process attributes wait for time wait event, signal event allocate and free memory

File management create file, delete file open, close read, write, reposition (move, rename, etc.)

Page 23: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 23 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

Types of System Calls Device management

request device, release device read, write, reposition get device attributes, set device attributes logically attach or detach devices

Information maintenance get time or date, set time or date get system data, set system data get process, file, or device attributes set process, file, or device attributes

Page 24: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 24 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

Types of System Calls Communications

Create, delete communication connection send, receive messages transfer status information attach or detach remote devices

Page 25: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 25 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

MS-DOS execution

(a) At system startup (b) running a program

Page 26: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 26 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

FreeBSD Running Multiple Programs

Page 27: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 27 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

System Programs System programs provide a convenient environment for

program development and execution. Some of them are simply user interfaces to system calls; others

are considerably more complex

They can be divided into: File manipulation Status information File modification Programming language support Program loading and execution Communications

Most users’ view of the operation system is defined by system programs, not the actual system calls

Page 28: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 28 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

System Programs File management

create, delete, copy, rename, print, dump, list, and generally manipulate files and directories

Status information Some programs ask the system for info.

date, time, amount of available memory, disk space, number of users.

detailed performance, logging, and debugging information.

Typically, these programs format and print the output to the terminal, other output devices, files.

Some systems implement a registry - used to store and retrieve configuration information.

Page 29: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 29 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

System Programs (cont’d) File modification

Text editors to create and modify files Special commands to search contents of files or perform

transformations of the text

Programming-language support Compilers, assemblers, debuggers and interpreters sometimes

provided

Page 30: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 30 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

System Programs (cont’d) Program loading and execution

Once a program is assembled or compiled, it must be loaded into memory to be executed.

Absolute loaders, re-locatable loaders, linkage editors, and overlay-loaders, debugging systems for higher-level and machine language

Communications provide the mechanism for creating virtual connections among

processes, users, and computer systems allow users to send messages to one another’s screens, browse

web pages, send electronic-mail messages, log in remotely, transfer files from one machine to another

Page 31: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 31 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

OS Design and Implementation

Page 32: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 32 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

Operating System Design and Implementation Design and Implementation of OS is not “solvable”

but some approaches have proven successful

Internal structure of different OS can vary widely

Defining goals and specifications Affected by choice of hardware, type of system

batch, multiprogramming, multitasking single user, multi-user distributed, real-time, general purpose.

User goals and System goals User goals – operating system should be convenient to use, easy to learn,

reliable, safe, and fast System goals – operating system should be easy to design, implement,

and maintain, as well as flexible, reliable, error-free, and efficient

Page 33: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 33 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

Operating System Design and Implementation Important principle to separate

Policy: What will be done? Mechanism: How to do it?

Mechanisms determine how to do something. Policies decide what will be done.

The separation of policy from mechanism is a very important principle,

it allows maximum flexibility if policy decisions are to be changed later

Once an operating system is designed, it must be implemented Traditionally, written in assembly language. Now, written in high-level languages (C: Linux and Windows)

Page 34: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 34 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

Operating System Structure 1. Simple Structure

2. Layered Structure

3. Microkernel System Structure

4. Modular Kernel Structure - Modern OS

Page 35: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 35 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

1. Simple Structure MS-DOS

Policy - to provide the most functionality in the least space

Not divided into modules

Although MS-DOS has some structure, its interfaces and levels of functionality are not well separated

Page 36: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 36 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

MS-DOS Layer Structure

Page 37: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 37 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

2. Layered Approach The operating system is divided into a number of layers

(levels), each built on top of lower layers. The bottom layer (layer 0), is the hardware; The highest (layer N) is the user interface.

With modularity, layers are selected such that each uses functions (operations) and services of only lower-level layers A typical OS layer (layer M) consists of data structure and a set of

routines that can be invoked by higher-level layers. Layer M, in tern, can invoke operations on lower-level layers.

Page 38: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 38 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

Layered Operating System

Page 39: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 39 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

Layered Approach Advantage

Simplicity of construction and debugging

The design and implementation is simplified. Each layer is implemented with only those operations provided by

lower-level layers. A layer does not need to know how these operations are

implemented.

Disadvantage Appropriately defining the various layers

Because a layer can use only lower-level layers, careful planning is necessary.

Page 40: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 40 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

The UNIX OS consists of two separable parts Systems programs

The kernel Consists of everything below the system-call interface and

above the physical hardware

Provides the file system, CPU scheduling, memory management, and other operating-system functions; a large number of functions for one level

As UNIX expanded, the kernel became large.

UNIX

Page 41: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 41 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

UNIX System Structure

Page 42: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 42 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

3. Microkernel System Structure Make the kernel as light as possible.

moves as much from the kernel into “user” space Communication takes place between user modules using message

passing Mach OS from Carnegie Mellon Univ.

Advantage Easier to extend a microkernel Easier to port the operating system to new architectures More reliable (less code is running in kernel mode) and secure

Disadvantage Performance overhead of user space to kernel space

communication

Page 43: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 43 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

4. Modular Kernel Structure Most modern operating systems implement kernel

modules The kernel has a set of core components and dynamically links to

additional services either during boot time or during run time.

uses object-oriented approach Each core component is separate Each talks to the others over known interfaces Each is loadable as needed within the kernel

Overall, similar to layers but with more flexible

Page 44: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 44 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

Solaris Modular Approach

Page 45: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 45 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

Modular Kernel Structure The Modular kernel approach is similar to the Layered

approach The modular kernel approach requires subsystems to interact with

each other through carefully constructed interfaces

However, the Modular kernel approach differs from the Layered approach The layered kernel imposes a strict ordering of subsystems such

that subsystems at the lower layers are not allowed to invoke operations corresponding to the upper-layer subsystems.

There are no such restrictions in the modular-kernel approach, wherein modules are free to invoke each other without any constraints.

Page 46: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 46 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

Virtual Machine

Page 47: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 47 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

Virtual Machines A virtual machine takes the layered approach to its logical

conclusion.

It treats hardware and the operating system kernel as though they were all hardware

A virtual machine provides an interface identical to the underlying bare hardware

The operating system creates the illusion of multiple processes, each executing on its own processor with its own (virtual) memory

The resources of the physical computer are shared among the virtual machines

Page 48: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 48 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

Virtual Machines

(a) Nonvirtual machine (b) virtual machine

Non-virtual Machine Virtual Machine

Page 49: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 49 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

The virtual-machine concept provides complete protection of system resources since each virtual machine is isolated from all other virtual machines. This isolation, however, permits no direct sharing of resources.

A virtual-machine system is a perfect vehicle for operating-systems research and development. System development is done on the virtual machine, instead of on a physical machine and so does not disrupt normal system operation.

The virtual machine concept is difficult to implement due to the effort required to provide an exact duplicate to the underlying machine

Virtual Machines

Page 50: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 50 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

VMware Architecture

http://www.vmware.com/

Page 51: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 51 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

The Java Virtual Machine

http://java.sun.com/

Page 52: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

- 52 -CSIE301 Operating System Fall 2009

Ch2. Operating-System Structures

Summary OS provides a number of services

Functions that are helpful to the user user interface, program execution, I/O operation file system manipulation, communications, error detection

Functions that ensure the efficient operation of the system resource allocation , accounting, protection and security

Three types of user interface from OS CLI, GUI, Batch Interface

System calls allow a process to make requests to the OS. To send a request, program use system APIs or standard library functions which are

translated into a sequence of system calls. Three methods of parameter passing in system call

Register, Block, Stack The separation of policy from mechanism is a very important principle in the

design of OS Four types of OS structures

Simple, Layered, Microkernel, Modular Virtual machine is an illusion of a computer system with own CPU, memory

and I/O, which is created on top of host OS.

Page 53: Mi Jung Choi mjchoi@kangwon.ac.kr Dept. of Computer Science Silberschatz, Galvin and Gagne ©2006 Operating System Principles Chapter 2: Operating-System

Mi Jung [email protected]

Dept. of Computer Science

Silberschatz, Galvin and Gagne ©2006Operating System Principles

End of Chapter 2