Operating Systems
Download
Report
Transcript Operating Systems
Operating Systems
An Introductory Overview
Copyright © 2005 - Curt Hill
Application or System?
• What is the difference?
• Can be fuzzy at times
• System
– Runs the machine
– Necessary evil
– Without system software we cannot run the
machine
• Application
– Why we bought system
– Performs the work that we want done
– Spreadsheets, Word processors, Databases
etc.
Copyright © 2005 - Curt Hill
What does an OS do?
•
•
•
•
•
Execute application programs
Provide services to the program
Establish and manage a file system
Utility functions
Many functions that are used by
most programs will eventually be
incorporated into the OS
Copyright © 2005 - Curt Hill
Execute application programs
• Interpret commands
– Interpret typed commands or mouse
actions
• Load programs
– The loader is an OS program
• Relocation
• Memory allocation
• Set as a task
– Provide services to the running
programs
Copyright © 2005 - Curt Hill
Provide services to the
program
• Memory management
– Memory allocation
– Virtual or fixed memory
• I/O management
– Manage file activity
• Task Scheduler
– Inter-process communication
– Managing priorities
Copyright © 2005 - Curt Hill
Establish and manage a file
system
• Determine how things are stored on disk
or tape
• Do we have a directory or just search?
• Are things stored in a contiguous fashion
or scattered?
• How are things named?
• How are things accessed?
• Interrupt processing
• Utility functions
– Prepare a disk for use
– Copy/move/delete files
– Show contents of a file or disk
Copyright © 2005 - Curt Hill
How are files accessed?
• Access to files is a program service
• Program says that it wants access to
file: fn
• System finds it
• Gets it ready
• Gives it to the program one chunk at
a time
• Several things should be transparent
to program
• Buffering
• Devices
Copyright © 2005 - Curt Hill
Utility functions
• Protection
– Files from deletion by someone other
than owner
– Memory of one program from another
• Hardware manipulation
– Mount disks and tapes
• Miscellaneous
– Error detection
– Multitasking
– Accounting
Copyright © 2005 - Curt Hill
Types of OS
• Tasking types
– How are processes handled
• Number of Users
– Single or multiple
• Program Interaction Type
– Console or GUI or both
Copyright © 2005 - Curt Hill
Single tasking vs multitasking
• Tasking
– How many things are running at once
• DOS is really a single tasking OS
– The print command attempts simple
multitasking, but it only gets control when
DOS gets control
– Not time-slice or interrupt driven
• Windows 3 tries harder it did simple
multitasking
• UNIX, NT and most mainframe OS do real
multitasking
Copyright © 2005 - Curt Hill
Single user vs. multiuser
• Windows 3, Win 95 and DOS are
really single user
– There was no protection of one user
from another
• Windows NT and descendents claim
to be multiuser
– The system does not protect users from
one another as well as it could
• UNIX is multiuser
– Most of the bugs have been fixed
Copyright © 2005 - Curt Hill
Batch and timesharing
• Old mainframes were batch oriented
and not interactive
– Maximizes utilization of CPU
• Timesharing
– Timesharing implies multi-tasking
– However, DOS was modeled after a
time sharing interface
• Most OSs are time sharing these
days, but that was not the case in the
old days
Copyright © 2005 - Curt Hill
Pieces of the operating
system
•
•
•
•
•
•
•
CPU management
Memory management
Process management
I/O management
User management
File management
Others
Copyright © 2005 - Curt Hill
CPU management - Interrupt
handling
• All the external hardware will use
interrupts
• How is a device interrupt handled?
• Device drivers
– Low level programs that oversee the
actions of various devices
• The interrupt must be processed in a
timely fashion without disturbing
other processes
Copyright © 2005 - Curt Hill
CPU management - Task
scheduling
• Each task must be known to OS
• When the task is suspended another
should be started
• Task management is the handling of
these details
• The task dispatcher determines
which is next
– This is one part of OS that must be
serialized
Copyright © 2005 - Curt Hill
Memory management
• Virtual memory systems will be
discussed later
• Allocation requests
– Loader for creating a process
– Program for new space, such as new
– File system for buffers
• Deallocation
• Memory leaks are the sign of a
poorly constructed OS
– Win 95/98/ME
Copyright © 2005 - Curt Hill
Process management
• Starting or loading
– Usually initiated by OS in response to
program start request
• Creation and deletion
– One program starting another
• Interprocess communication
– Two independent programs
communicating through the OS
Copyright © 2005 - Curt Hill
I/O management
• I/O services
– These are services provided to a
program
– Open, close, read, write a file
– Rename, move, delete a file without
processing it
• Device management
– These are usually done through OS
directly
– Mount or demount a device
– Format or partition a disk
Copyright © 2005 - Curt Hill
File management
• Some overlap with I/O management
– Usually the OS perspective rather than
program perspective
• Device maintenance
• Volume maintenance
• Creation/Deletion/Accessing of file
system
• Access controls
• Backup and recovery
Copyright © 2005 - Curt Hill
User management
• Logging in
– Includes authentification
– Logging
• Accounting
– Gives the ability to charge a user for
services
– CPU time, disk storage, connect time
• Access controls
– Which user may access which files?
Copyright © 2005 - Curt Hill
OS Layers
• Most OSs are onion shaped
– For historical and maintenance reasons
– Historically the innermost was all that
was available
• Each layer then communicates with
adjacent layers through well defined
pathes
– Well defined in terms of this particular
OS
• Layers: Kernel, Service, Command
Copyright © 2005 - Curt Hill
Kernel is the innermost layer
• Low level activities only
–
–
–
–
Load and/or execute a program
Device allocation and access
Process management
Low level file access
• This is the lowest level interface to the hardware
and the only one that touches the hardware
directly
• In DOS there is the BIOS which amounts to a
kernel
• The kernel is usually always resident in the
memory
• Basic process management is usually here, since
we need to make each program we load a
process
Copyright © 2005 - Curt Hill
Service layer
• Set of routines that provide services
– Use the kernel
– This is where the traditional file manipulation
commands are executed, such as opening and
closing files, reading and writing records
– Entire file copying is usually done at the next
higher level
• The service layer represents the services
that are available to a program
• The service layer is also designed to
generalize the interface between devices
– A CRT, disk and tape are wildly different, yet
we would like their interface to look similar
Copyright © 2005 - Curt Hill
Service Layer
• In the assembly language interface
each of the service calls becomes a
macro or subroutine call
• In a HLL it is usually built into the
command part of the language or is
in a library of some sort
• Some process management is here
as well
– Inter-process communication
Copyright © 2005 - Curt Hill
Command layer
• The interface that allows the user to
interface with the system directly
• This includes command interpretation
• This is Command.com in DOS or program
manager in Windows
• Many utility functions are placed in this
layer
– The DOS Format is a command in this layer
• It performs an essential function, but is its
own program
Copyright © 2005 - Curt Hill
Next
• Before going any further we should
consider the history of operating
systems
Copyright © 2005 - Curt Hill