Silberschatz, Galvin and Gagne 2002 3.1 Operating System Concepts Common OS Components Process...
-
Upload
jodie-briggs -
Category
Documents
-
view
218 -
download
0
Transcript of Silberschatz, Galvin and Gagne 2002 3.1 Operating System Concepts Common OS Components Process...
Silberschatz, Galvin and Gagne 20023.1Operating System Concepts
Common OS Components
Process Management Memory Management File Management I/O System Management Disk Management Networking Protection System
Silberschatz, Galvin and Gagne 20023.2Operating System Concepts
Operating System Software
Kernel – the one program running at all times (all else being application programs).
System Software - Applications to support OS activities, e.g., linker, ????
Silberschatz, Galvin and Gagne 20023.3Operating System Concepts
Process Management
A process is a program in execution A process is active, at a point specified by its PC. A program
is passive. A process needs certain resources, including CPU time,
memory, files, and I/O devices, to accomplish its task. The operating system is responsible for.
Process creation and deletion. Process suspension and resumption. Mechanisms for synchronization and communication
Silberschatz, Galvin and Gagne 20023.4Operating System Concepts
Memory Management
Memory is a large array of words or bytes, each with its own address. Main memory is a volatile storage device.
Accessed for instructions and data The operating system is responsible for :
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
Silberschatz, Galvin and Gagne 20023.5Operating System Concepts
File Management
A file is a collection of related information, defined by its creator, e.g., source code, binaries, data
The operating system is responsible for: File creation and deletion. Directory creation and deletion. Support of primitives for accessing and manipulating files
and directories File security Mapping files onto secondary storage Hiding differences between storage types
Silberschatz, Galvin and Gagne 20023.6Operating System Concepts
I/O System Management
The I/O system consists of: Drivers for specific hardware devices A general device-driver interface A buffer-caching system
The operating system is responsible for: Servicing requests to use IO devices Sharing devices between users and processes Hiding device peculiarities using device drivers Optimizing device performance IO error handling Buffering and caching
Silberschatz, Galvin and Gagne 20023.7Operating System Concepts
Disk Management
Disks are used for non-volatile and large storage The operating system is responsible for:
Free space management and disk space allocation Disk scheduling for optimized use Bad block management Swap space Disk reliability
DMA Used for I/O devices that transfer at close to memory speeds. Transfers blocks directly between device controller and main
memory. Only one interrupt is generated per block Must cooperate with other RAM usage
Silberschatz, Galvin and Gagne 20023.8Operating System Concepts
Networking (Distributed Systems)
A distributed system is a collection processors that do not share memory. The processors are connected through a communication network.
Operating system must support Communication Access security Process/load distribution Sharing of resources
Silberschatz, Galvin and Gagne 20023.9Operating System Concepts
Protection System
Protection refers to a mechanism for internally controlling access by programs, processes, and users to 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
Different from security
Silberschatz, Galvin and Gagne 20023.10Operating System Concepts
OS Services for the User
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.
Communications – exchange of information between processes executing either on the same computer or on different systems tied together by a network.
Error detection – ensure correct computing by detecting errors in the CPU and memory hardware, in I/O devices, or in user programs.
Silberschatz, Galvin and Gagne 20023.11Operating System Concepts
OS Services for the Programmer
System calls provide the interface between a running program and the operating system. Generally available as assembly language instructions. Languages defined to replace assembly language for
systems programming allow system calls to be made directly (e.g., C, C++)
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 operating system.
Silberschatz, Galvin and Gagne 20023.12Operating System Concepts
Passing of Parameters As A Table
Silberschatz, Galvin and Gagne 20023.13Operating System Concepts
OS Services for the OS
Additional functions exist not for helping the user, but rather for ensuring efficient system operations. 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.
Silberschatz, Galvin and Gagne 20023.14Operating System Concepts
OS Software for the User
System programs provide a convenient environment for program development and execution. They can be divided into: File manipulation (cd, rm, cat) Status information (ls, ps, lpstat) File modification (vi) Programming language support (g++, gdb, gprof) Program loading and execution (shell, exec) Communications (ssh, scp) Application programs (netscape, mud)
Most users’ views of the operation system are defined by system programs
Silberschatz, Galvin and Gagne 20023.15Operating System Concepts
Command Interpreter
The program that reads and interprets control statements is called variously: Command line interpreter Shell (in UNIX)
Its function is to get and execute the next command A shell fulfills commands in two ways
Built in functionality Loading and running a program
Silberschatz, Galvin and Gagne 20023.16Operating System Concepts
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.
Silberschatz, Galvin and Gagne 20023.17Operating System Concepts
Simple System Structure
Not divided into modules E.g., MS-DOS – written to provide the most functionality
in the least space Although MS-DOS has some structure, its interfaces and
levels of functionality are not well separated
Silberschatz, Galvin and Gagne 20023.18Operating System Concepts
Layered System Structure
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.
Layers use services of only lower-level layers. Layers cause overhead
Silberschatz, Galvin and Gagne 20023.19Operating System Concepts
Layers with Modules Structure
Layers combined with modularity provide flexibility E.g., OS/2
Silberschatz, Galvin and Gagne 20023.20Operating System Concepts
Microkernel System Structure
Moves as much from the kernel into “user” space. Communication takes place between user modules using
message passing. Benefits:
Easier to extend a microkernel Easier to port the operating system to new architectures More reliable (less code is running in kernel mode) More secure
Silberschatz, Galvin and Gagne 20023.21Operating System Concepts
Virtual Machines
Non-virtual Machine Virtual Machine
The operating system creates the illusion of multiple processors each with its own (virtual) memory. A virtual machine provides an interface identical to the
underlying bare hardware.
Silberschatz, Galvin and Gagne 20023.22Operating System Concepts
System Implementation
Traditionally written in assembly language, operating systems can now be written in higher-level languages.
Code written in a high-level language: can be written faster. is more compact. is easier to understand and debug.
An operating system is far easier to port (move to some other hardware) if it is written in a high-level language.
Silberschatz, Galvin and Gagne 20023.23Operating System Concepts
System Generation (SYSGEN)
Operating systems are designed to run on any of a class of machines
The system must be configured for each specific computer site.
SYSGEN program obtains information concerning the specific configuration of the hardware system.
Silberschatz, Galvin and Gagne 20023.24Operating System Concepts
UNIX History
First developed in 1969 by Ken Thompson and Dennis Ritchie of the Research Group at Bell Laboratories; incorporated features of other operating systems, especially MULTICS.
The third version was written in C, which was developed at Bell Labs specifically to support UNIX.
The most influential of the non-Bell Labs and non-AT&T UNIX development groups — University of California at Berkeley (Berkeley Software Distributions). 4BSD UNIX resulted from DARPA funding to develop a standard
UNIX system for government use. Developed for the VAX, 4.3BSD is one of the most influential
versions, and has been ported to many other platforms. Several standardization projects seek to consolidate the
variant flavors of UNIX leading to one programming interface to UNIX.
Silberschatz, Galvin and Gagne 20023.25Operating System Concepts
History of UNIX Versions
Silberschatz, Galvin and Gagne 20023.26Operating System Concepts
UNIX Design Principles
Designed to be a time-sharing system. Has a simple standard user interface (shell) that can be
replaced. File system with multilevel tree-structured directories. Files are supported by the kernel as unstructured
sequences of bytes. Supports multiple processes; a process can easily create
new processes. High priority given to making system interactive, and
providing facilities for program development.
Silberschatz, Galvin and Gagne 20023.27Operating System Concepts
Early Advantages of UNIX
Written in a high-level language. Distributed in source form. Provided powerful operating-system primitives on an
inexpensive platform. Small size, modular, clean design.
Silberschatz, Galvin and Gagne 20023.28Operating System Concepts
UNIX System Structure
UNIX – limited by hardware functionality, the original UNIX operating system had limited structuring.
The UNIX OS consists of two separable parts. Systems programs Kernel that provides the file system, CPU scheduling,
memory management, and other operating-system functions; a large number of functions for one level.
Silberschatz, Galvin and Gagne 20023.29Operating System Concepts
System Calls
System calls define the programmer interface to UNIX The set of systems programs commonly available defines
the user interface. The programmer and user interface define the context
that the kernel must support. Roughly three categories of system calls in UNIX.
File manipulation (same system calls also support device manipulation)
Process control Information manipulation.