CS4023_-_lecture_05_-_0910
Download
Report
Transcript CS4023_-_lecture_05_-_0910
Lecture 5
Operating-System Services
and Structure
These slides are based on slides which are copyright Silberschatz, Galvin and Gagne, 2005
Operating System Definition
Intermediary between a user of a computer
and the computer hardware.
Control program
Controls execution of programs to prevent errors
and improper use of the computer
Resource allocator
Manages all resources
Decides between conflicting requests for efficient
and fair resource use
OS Design and Implementation
Design and Implementation of OS not
“solvable”, but some approaches have
proven successful
Internal structure of different Operating
Systems can vary widely
Affected by choice of hardware, type of
system
OS Design and Implementation
(Contd.)
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
A View of Operating System
Services
OS Services Helpful to the User
User interface (UI):
Command-Line (CLI)
Graphics User Interface (GUI)
Tangible interfaces
User Interface - CLI
CLI allows direct command entry
Sometimes multiple flavors implemented – shells
Primarily fetches a command from user and
executes it
Sometimes commands built-in, sometimes just
names of programs
User Interface - GUI
User-friendly desktop metaphor interface
Usually mouse, keyboard, and monitor
Icons represent folders, files, programs, actions, etc.
Various mouse buttons over objects in the interface
cause various actions.
Many systems now include both CLI and GUI interfaces
Microsoft Windows is GUI with CLI “command” shell
Apple Mac OS X as “Aqua” GUI interface with UNIX
kernel underneath and shells available
Solaris is CLI with optional GUI interfaces (Java
Desktop, KDE)
OS Services Helpful to the User
(Contd.)
Program execution - OS must be able to load a
program into memory, run that program, and end
execution (either normally or abnormally)
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. Obviously, programs need
to read and write files and directories, create and
delete them, search them, list file Information.
OS Services Helpful to the User
(Contd.)
Communications – Processes may exchange
information, on the same computer or over a
network.
Communications may be via shared memory or
through message passing.
Error detection – OS needs to be constantly
aware of possible errors
May occur in the CPU and memory hardware, in
I/O devices, in user program
For each type of error, OS should take the
appropriate action to ensure correct and
consistent computing
OS Services for Efficient
Operation
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 protocol, others
(such as I/O devices) may have general
request and release protocol.
Accounting - To keep track of which users
use how much and what kinds of computer
resources
OS Services for Efficient
Operation (Contd.)
Protection and security - to control use of
shared data (on a multiuser system or a
network)
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
If a system is to be protected and secure,
precautions must be instituted throughout it. A
chain is only as strong as its weakest link.
Kernel
the central component of an OS. It has complete control
over everything that occurs in the system.
http://en.wikipedia.org/wiki/Kernel_(computer_science)
Hierarchical Protection
Domains (protection rings)
Hardware supported rings
were among the more
revolutionary concepts
introduced by the Multics.
However, most generalpurpose UNIX systems use
only two rings, even if the
hardware it runs on provides
more CPU modes than that.
X86-processors have four
different modes divided into
four different rings.
http://en.wikipedia.org/wiki/Privilege_ring
Monolithic Kernel
The monolithic kernel offers everything the OS needs:
CPU scheduling, memory management,
multiprogramming, interprocess communication (IPC),
device access, file systems, network protocols, etc.
Newer monolithic kernels have a modular design, which
offers run-time adding and removal of services. The
whole kernel runs in "kernel mode" in which the software
has full control over the machine. The processes running
on top of the kernel run in "user mode", in which
programs have only access to the kernel services.
Modern OS with monolithic kernels: Linux, FreeBSD,
NetBSD, Solaris
http://tunes.org/~unios/oskernels.html
Microkernel
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
Disadvantages:
Performance overhead of user space to kernel space
communication
Example microkernels: Mach, L4, Minix, QNX
Hybrid Kernels
Similar to microkernels, except that they include additional
code in kernel space so that such code can run more swiftly
than it would were it in user space.
These kernels represent a compromise that was implemented
by some developers before it was demonstrated that pure
microkernels can provide high performance.
Hybrid kernels should not be confused with monolithic kernels
that can load modules after booting (such as Linux).
Example OS with hybrid kernels: Microsoft Windows,
DragonFly BSD, Mac OS X
http://www.linfo.org/kernel.html
Mac OS X Structure
Monolithic vs. Microkernel
System Structure
Monolithic kernel
Microkernel
http://en.wikipedia.org/wiki/Kernel_(computer_science)