Cs238 Lecture 3 Computer System Structures

Download Report

Transcript Cs238 Lecture 3 Computer System Structures

Cs238 Lecture 3
Operating System Structures
Dr. Alan R. Davis
System Components
•
•
•
•
•
•
•
•
Process Management
Main-Memory Management
File Management
I/O System Management
Secondary-Storage Management
Networking
Protection System
Command-Interpreter System
Process Management
• The creation and deletion of both user and
system processes.
• The suspension and resumption of processes.
• Providing mechanisms for process
synchronization.
• Providing mechanisms for process
communication.
• Providing mechanisms for deadlock handling.
Main-Memory Management
• Keep track of which parts of memory are
currently being used, and by whom.
• Decide which processes are to be loaded
into memory when memory space becomes
available.
• Allocate and deallocate memory space as
needed.
File Management
• The creation and deletion of files.
• The creation and deletion of directories.
• The support of primitives for manipulating
files and directories.
• The mapping of files onto secondary
storage.
• The backup of files on nonvolatile storage
media.
I/O System Management
• A memory management component
including buffering, caching, and spooling.
• A general device-driver interface.
• Drivers for specific hardware devices.
Secondary Storage Management
•
•
•
•
•
Free space management.
Storage allocation.
Disk scheduling.
Defragmenting disks.
Partitioning and formatting disks.
Networking
•
•
•
•
Create, delete communications connection
Send, receive messages
Transfer status information
Attach or detach remote devices
Protection Systems
• When multiple programs and users share a system
we must prevent them from adversely affecting
each other.
• A properly designed operating system must ensure
that an incorrect (or malicious) program cannot
cause other programs to execute incorrectly.
• We give the operating system control over other
processes by distinguishing its instructions from
all others.
Protection Systems cont’d
• By adding a special bit to the hardware, we can
distinguish between instructions being executed
in system mode, privileged mode, monitor mode,
supervisor mode, and those being executed in
user mode.
• The system starts (boots) in privileged mode,
loads the operating system,and then starts user
processes in user mode.
• Interrupts cause the system to switch from user
mode to privileged mode.
• Some machine instructions are designated as
privileged instructions.
Protection cont’d
• The hardware allows privileged instructions to
be executed only in monitor mode.
• Attempts to do otherwise result in errors.
• To prevent the user from performing illegal I/O
operations, all I/O instructions are privileged.
• Memory protection is accomplished by special
purpose hardware to contain the base address
and limit address for a program.
Protection cont’d
• CPU protection is accomplished with a
timer.
• The operating system sets a timer before
each change to user mode so that a user
process can not monopolize the CPU.
• File protection is accomplished with extra
bits associated with a file to indicate access
rights (read, write, protected, etc.)
Command Interpreter System
• This is the interface between the user and the
operating system.
• It could handle control statements on punched
cards, statements typed on a console from the
keyboard, or icons clicked by a mouse in a
GUI environment.
• Commands deal with process creation and
management, I/O handling, secondary-storage
management, main memory management, filesystem access, protection, and networking.
Operating System Services
•
•
•
•
•
•
•
•
Program execution
I/O operations
File system manipulation
Communications
Error detection
Resource allocation
Accounting
Protection
System Calls
• System calls provide the interface between a
process and the operating system.
• They are generally available as assemblylanguage instructions, or in some higher level
languages.
• System calls can be grouped into categories:
process control, file manipulation, device
manipulation, information maintenance, and
communications.
System Calls cont’d
• Information must be passed to the operating
system in a system call.
• It could be passed in registers.
• It could be passed in a block or table in memory.
• It could be passed on the stack.
Systems Programs
•
•
•
•
File manipulation
Status information - date, time, CPU usage
File modification - editors
Programming language support - compilers,
assemblers, interpreters
• Program loading and execution • Communications - e-mail, ftp, telnet
• Applications programs
Virtual Machines
• Operating systems are thought of as consisting
of layers.
• The base layer is the hardware layer.
• Then comes the operating system kernel.
• Then come the system programs.
• The kernel can access the hardware with
hardware instructions. It also wraps those
instructions in system calls for use by the next
higher layer.
• The application layer can use either method to
access the hardware and often does not
distinguish the two methods.
Virtual Machines cont’d
• The virtual machine architecture provides an
interface that is identical to the underlying
hardware.
• Each process is provided with a (virtual) copy
of the underlying computer.
• The resources of the physical computer are
shared to create the virtual machines.
• CPU scheduling for a virtual CPU, spooling
and a file system for virtual I/O, disk
management to supply virtual disks.
Virtual Machines cont’d
• IBM’s VM operating system is the prime
example.
• Users are given their own virtual machine.
• They can run any of the operating systems
or software packages available on the
underlying physical machine.
• Usually IBM VM users run CMS, a singleuser interactive operating system.
Virtual Machines cont’d
• The virtual machine concept was important
for large mainframe installations.
• However, it is also useful currently to solve
system compatibility problems.
• A virtual Intel machine can be created on a
Sun Microsystem machine to allow it to run
all MS-DOS software.
• We also currently have the Java Virtual
Machine(JVM).