Introduction to Operating Systems l l l What

  • Slides: 19
Download presentation
Introduction to Operating Systems l l l What is an operating system? Examples How

Introduction to Operating Systems l l l What is an operating system? Examples How do many programs run at the same time, with one processor?

What is an operating system? l A short definition of an operating system: An

What is an operating system? l 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? l An operating system from a programmer’s

Why do we need an operating system? l 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 l l l UNIX/Linux Windows 98 Windows NT Windows XP BEOS DOS

Examples l l l UNIX/Linux Windows 98 Windows NT Windows XP BEOS DOS

l Kernel – – l Central part of the operating system. All hardware requests

l Kernel – – l 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 l Where the normal running of a program is interrupted by an event.

Interrupts l 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.

l Process manager deals with – – hardware/software interrupts. Processor errors Scheduling tasks Communication

l Process manager deals with – – hardware/software interrupts. Processor errors Scheduling tasks Communication between tasks

l Memory Management – – – Allocate memory Ensures processes (see next week’s lecture)

l Memory Management – – – Allocate memory Ensures processes (see next week’s lecture) stay memory boundaries Controlling virtual memory

l I/0 System – – Communicates with peripherals and hardware components Co-ordinates i/o systems

l I/0 System – – Communicates with peripherals and hardware components Co-ordinates i/o systems such as interrupts and direct memory access

l Files system – – – Organises and accesses files Maintains on a multi-user

l Files system – – – Organises and accesses files Maintains on a multi-user system user file quotas Controls file/record access

l Application Program Interface – – Provides systems services for applications An interface between

l Application Program Interface – – Provides systems services for applications An interface between the applications and the operating system.

l User interface – – – Allows the user access to programs Allows the

l 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 l l l Simplest system Single machine running one application at

Single user/task system l l l Simplest system Single machine running one application at a time. Has it’s own resources (e. g. printer).

Multiprogramming/Multi-tasking System l How do many programs run at the same time, with one

Multiprogramming/Multi-tasking System l How do many programs run at the same time, with one processor? l Short answer: They do not! l They just appear to by running one program at a time, but for a short period of time.

l Most modern operating systems have the ability to execute several programs at once,

l Most modern operating systems have the ability to execute several programs at once, although there is usually 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.

l This switching is triggered by a piece of hardware called the interval timer,

l 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.

l The dispatcher searches a set of potentially 'runnable' program using a scheduling algorithm

l 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.