Silberschatz and Galvin Chapter 3 Operating System Structures CPSC - - PDF document

silberschatz and galvin
SMART_READER_LITE
LIVE PREVIEW

Silberschatz and Galvin Chapter 3 Operating System Structures CPSC - - PDF document

CPSC 410--Richard Furuta 1/21/991/21/99 Silberschatz and Galvin Chapter 3 Operating System Structures CPSC 410-Richard Furuta 01/19/99 1 Different actors view OS differently Operating system designers -- systems components and


slide-1
SLIDE 1

CPSC 410--Richard Furuta 1/21/991/21/99 1

CPSC 410-Richard Furuta 01/19/99 1

Silberschatz and Galvin

Chapter 3 Operating System Structures

CPSC 410-Richard Furuta 01/19/99 2

Different ÒactorsÓ view OS differently

¥ Operating system designers--systemÕs components and their interconnections ¥ Users--services provided by the operating system ¥ Programmers--interface provided (i.e., system calls), their organization, and other abstractions

slide-2
SLIDE 2

CPSC 410--Richard Furuta 1/21/991/21/99 2

CPSC 410-Richard Furuta 01/19/99 3

Common system components

¥ Process Management ¥ Main-Memory Management ¥ Secondary-Storage Management ¥ File Management ¥ I/O System Management ¥ Protection System ¥ Networking ¥ Command-Interpreter System

CPSC 410-Richard Furuta 01/19/99 4

Process management

¥ A process is a unit of work in a system. ¥ A process is a program in execution. A process needs certain resources, including CPU time, memory, files, and I/O devices, to accomplish its task. ¥ A program is passive; a process is dynamic

slide-3
SLIDE 3

CPSC 410--Richard Furuta 1/21/991/21/99 3

CPSC 410-Richard Furuta 01/19/99 5

Process management

¥ The operating system is responsible for the following process management activities

Ð process creation and deletion. Ð process suspension and resumption. Ð provision of mechanisms for:

¥ process synchronization ¥ process communication ¥ deadlock handling

CPSC 410-Richard Furuta 01/19/99 6

Main memory management

¥ Main memory is

Ð large array of words or bytes, each with its own address Ð repository of quickly accessible data shared by CPU and I/O devices Ð volatile

slide-4
SLIDE 4

CPSC 410--Richard Furuta 1/21/991/21/99 4

CPSC 410-Richard Furuta 01/19/99 7

Main memory management

¥ The operating system must

Ð Keep track of which parts of memory are currently being used and by whom. Ð Decide which processes to load when memory space becomes available. Ð Allocate and deallocate memory space as needed.

CPSC 410-Richard Furuta 01/19/99 8

Secondary storage management

¥ Persistent storage; larger capacity than primary storage ¥ Generally disks in modern systems ¥ Operating system responsibilities:

Ð Free-space management Ð Storage allocation Ð Disk scheduling

slide-5
SLIDE 5

CPSC 410--Richard Furuta 1/21/991/21/99 5

CPSC 410-Richard Furuta 01/19/99 9

File management

¥ Logical storage unit: file (an abstract concept that is mapped onto a physical implementation) ¥ Operating system responsibilities:

Ð creation and deletion of files and directories Ð primitives for manipulating files and directories Ð mapping files onto secondary storage Ð backup of files on stable storage media

CPSC 410-Richard Furuta 01/19/99 10

I/O System management

¥ Hides details of hardware devices from user ¥ I/O subsystem consists of

Ð memory management component: buffering, caching, and spooling Ð general device-driver interface Ð drivers for specific hardware devices

slide-6
SLIDE 6

CPSC 410--Richard Furuta 1/21/991/21/99 6

CPSC 410-Richard Furuta 01/19/99 11

Protection system

¥ Protection refers to a mechanism for controlling access by programs, processes,

  • r users to both system and user resources.

¥ The protection mechanism must:

Ð distinguish between authorized and unauthorized usage. Ð specify the controls to be imposed. Ð provide a means of enforcement.

CPSC 410-Richard Furuta 01/19/99 12

Networking

¥ Distributed system: collection of processors that do not share memory, peripheral devices, or a clock (they have local memory and clock) ¥ Communicate through a communications network (many different routing and connection strategies) ¥ Provides user access to (heterogeneous) system resources ¥ Allows computation speedup, increased data availability, and enhanced reliability

slide-7
SLIDE 7

CPSC 410--Richard Furuta 1/21/991/21/99 7

CPSC 410-Richard Furuta 01/19/99 13

Command-interpreter system

¥ Interface between user and operating system ¥ Some systems put into kernel; others treat as a program (e.g., Unix and MS-DOS) ¥ Control-statement-driven systems also called

Ð control-card interpreter Ð command-line interpreter Ð shell

¥ Function: Get next command and execute it

CPSC 410-Richard Furuta 01/19/99 14

Command-interpreter system

¥ Control statements may deal with:

Ð process creation and management Ð I/O handling Ð secondary-storage management Ð main-memory management Ð file-system access Ð protection Ð networking

slide-8
SLIDE 8

CPSC 410--Richard Furuta 1/21/991/21/99 8

CPSC 410-Richard Furuta 01/19/99 15

UsersÕ view Operating system services

¥ Program execution Ð system capability to load a program into memory and to run it. ¥ I/O operations Ð since user programs cannot execute I/O operations directly, the operating system must provide some means to perform I/O. ¥ File-system manipulation Ð program capability to read, write, create, and delete files.

CPSC 410-Richard Furuta 01/19/99 16

Operating system services

¥ Communications Ð exchange of information between processes executing either on the same computer or on different systems tied together by a network. Implemented via shared memory or message passing. ¥ Error detection Ð ensure correct computing by detecting errors in the CPU and memory hardware, in I/O devices, or in user programs.

slide-9
SLIDE 9

CPSC 410--Richard Furuta 1/21/991/21/99 9

CPSC 410-Richard Furuta 01/19/99 17

Operating system services

¥ Services that ensure the efficient operation of the system

Ð Resource allocation: allocating resources to multiple users or multiple jobs running at the same time. Ð Accounting: keep track of and record which users use how much and what kinds of computer resources for account billing or for accumulating usage statistics. Ð Protection: ensuring that all access to system resources is controlled.

CPSC 410-Richard Furuta 01/19/99 18

ProgrammerÕs view System calls

¥ Interface between process and operating system ¥ Generally called by assembly-language programs but may be available to higher- level language programmers in some systems (e.g., C, Bliss, BCPL, etc.)

slide-10
SLIDE 10

CPSC 410--Richard Furuta 1/21/991/21/99 10

CPSC 410-Richard Furuta 01/19/99 19

System calls

¥ Three general methods are used to pass parameters between a running program and the operating system:

Ð Pass parameters in registers. Ð Store the parameters in a table in memory, and the table address is passed as a parameter in a register. Ð Push (store) the parameters onto the stack by the program, and pop off the stack by the operating system.

CPSC 410-Richard Furuta 01/19/99 20

System calls

¥ Major categories of system calls:

Ð Process control Ð File manipulation Ð Device manipulation Ð Information maintenance Ð Communications

slide-11
SLIDE 11

CPSC 410--Richard Furuta 1/21/991/21/99 11

CPSC 410-Richard Furuta 01/19/99 21

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

CPSC 410-Richard Furuta 01/19/99 22

System calls File manipulation

create file, delete file

  • pen, close

read, write, reposition get file attributes, set file attributes

slide-12
SLIDE 12

CPSC 410--Richard Furuta 1/21/991/21/99 12

CPSC 410-Richard Furuta 01/19/99 23

System calls Device manipulation

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

CPSC 410-Richard Furuta 01/19/99 24

System calls 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

slide-13
SLIDE 13

CPSC 410--Richard Furuta 1/21/991/21/99 13

CPSC 410-Richard Furuta 01/19/99 25

System calls Communications

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

CPSC 410-Richard Furuta 01/19/99 26

System structure Simple approach

¥ MS-DOS Ð written 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

slide-14
SLIDE 14

CPSC 410--Richard Furuta 1/21/991/21/99 14

CPSC 410-Richard Furuta 01/19/99 27

System structure Simple approach

¥ Unix Ð limited by hardware functionality, the

  • riginal Unix operating system had limited
  • structuring. 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.

CPSC 410-Richard Furuta 01/19/99 28

System structure Layered approach

¥ The operating system is divided into a number of layers (levels), each built on top

  • f 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.

slide-15
SLIDE 15

CPSC 410--Richard Furuta 1/21/991/21/99 15

CPSC 410-Richard Furuta 01/19/99 29

System structure Layered approach

¥ A layered design was first used in the THE

  • perating system (Dijkstra, 1968). Its six layers

are as follows:

Ð layer 5: user programs Ð layer 4: buffering for input and output devices Ð layer 3: operator-console device driver Ð layer 2: memory management Ð layer 1: CPU scheduling Ð layer 0: hardware

CPSC 410-Richard Furuta 01/19/99 30

System structure 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.

slide-16
SLIDE 16

CPSC 410--Richard Furuta 1/21/991/21/99 16

CPSC 410-Richard Furuta 01/19/99 31

System structure Virtual machines

¥ The resources of the physical computer are shared to create the virtual machines.

Ð CPU scheduling can create the appearance that users have their own processor. Ð Spooling and a file system can provide virtual card readers and virtual line printers. Ð A normal user time-sharing terminal serves as the virtual machine operatorÕs console.

¥ (Example, IBM VM)

CPSC 410-Richard Furuta 01/19/99 32

Virtual machines advantages and disadvantages

¥ The virtual-machine concept provides complete protection

  • f 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

  • perating-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

  • peration.

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

slide-17
SLIDE 17

CPSC 410--Richard Furuta 1/21/991/21/99 17

CPSC 410-Richard Furuta 01/19/99 33

System design 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.

CPSC 410-Richard Furuta 01/19/99 34

Mechanism and policy

¥ 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.

slide-18
SLIDE 18

CPSC 410--Richard Furuta 1/21/991/21/99 18

CPSC 410-Richard Furuta 01/19/99 35

System implementation

¥ OS used to be written exclusively in assembly language ¥ Now some are written in higher-level languages (e.g., C); assembly-language routines (e.g., for identified bottlenecks) provide speed for key functions ¥ Advantage: faster development, easier to understand and debug, easier to port ¥ Disadvantage: reduced speed and increased storage requirements

CPSC 410-Richard Furuta 01/19/99 36

System Generation (SYSGEN)

¥ Configure for a particular machine in a class and/or for peripheral configurations

Ð CPU to be used Ð Amount of memory available Ð Available devices Ð Operating system options desired, e.g., what job mix is expected, etc.

¥ Bootstrap program (bootstrap loader): stored in ROM; locates kernel, loads it into main memory; starts execution ¥ Alternately fetches more complex boot program and transfers control to it (two step process)