Introduction to operating systems

Download Report

Transcript Introduction to operating systems

Introduction to Operating Systems



What is an operating system?
Examples
How do many programs run at the same time,
with one processor?
What is an operating system?

A short definition of an operating system: An
operating system is a collection of system
programs that manage the resources of a
computer and control the running of user
programs.
Why do we need an operating system?

An operating system from a programmer’s
point of view is a program that adds a variety of
new instructions and features, beyond those of
the instruction set. An operating system is
implemented largely in software.
Examples






UNIX/Linux
Windows 98
Windows NT
Windows XP
BEOS
DOS

Kernel
–
–

Central part of the operating system.
All hardware requests go through the kernel as
system calls
Shell
–
The interfaces for the applications programs and
users, with the operating system.
Interrupts

Where the normal running of a program is
interrupted by an event. Generated:
–
–
–
–
By computers hardware e.g. key press
Within the CPU by unexpected event, e.g divide-byzero.
By external events, e.g. from interface cards
By software to perform pre-defined routines in ROM
or RAM, e.g. routines in BIOS or user defined
routines in RAM- software interrupts.

Process manager deals with
–
–
–
–
hardware/software interrupts.
Processor errors
Scheduling tasks
Communication between tasks

Memory Management
–
–
–
Allocate memory
Ensures processes (see next week’s lecture) stay
memory boundaries
Controlling virtual memory

I/0 System
–
–
Communicates with peripherals and hardware
components
Co-ordinates i/o systems such as interrupts and
direct memory access

Files system
–
–
–
Organises and accesses files
Maintains on a multi-user system user file quotas
Controls file/record access

Application Program Interface
–
–
Provides systems services for applications
An interface between the applications and the
operating system.

User interface
–
–
–
Allows the user access to programs
Allows the user to view and change system settings.
A consistent interface between the user and the
operating system.
Single user/task system



Simplest system
Single machine running one application at a
time.
Has it’s own resources (e.g. printer).
Multiprogramming/Multi-tasking System

How do many programs run at the same time,
with one processor?

Short answer: They do not!

They just appear to by running one program at
a time, but for a short period of time.

Most modern operating systems have the ability to
execute several programs at once, although there is
usually only one processor in the system. This is
multiprogramming and is made possible by rapidly
switching the processor between programs. Interrupting
the processor periodically, gives the programs control of
the processor for a short period.

This switching is triggered by a piece of hardware
called the interval timer, which generates an
interrupt (a time-out interrupt) when the
programmed period has elapsed. The interrupt
handler, then saves the context of the processor.
The context is the contents of registers that may be
overwritten by other programs. Control is passed
over to the dispatcher/low-level scheduler.

The dispatcher searches a set of potentially
'runnable' program using a scheduling algorithm to
select a suitable program to run next. The context
of the processor, which existed when that program
last ran, is restored to the registers.