FUDAMENTALS OF OPERATING SYSTEMS - COMP355
FUDAMENTALS OF OPERATING SYSTEMS
References - Operating System Concepts 9th Edition courtesy - Silberschatz, Galvin and Gagne
Chapter 1: Introduction
What is an Operating System?
A program that acts as an intermediary between a user of a computer and the computer hardware.
Operating system goals
Execute user programs and make solving user problems easier.
Make the computer system convenient to use.
Use the computer hardware in an efficient manner.
Computer System Structure
Computer system can be divided into four components:
Hardware - Provides basic computing resources CPU, memory, I/O devices.
Operating system - Controls and coordinates use of hardware among various applications and users.
Application programs - Define the ways in which the system resources are used to solve the computing problems of the users. Examples: Word processors, compilers, web browsers, database systems, video games, etc.
Users - People, machines, other computers.
Abstract View / Four Components of a Computer System -
Operating System function
Resource allocator manages and allocates resources.
Control program controls the execution of user programs and operations of I/O devices.
Kernel the one program running at all times (all else being application programs).
Multiple computers for unique I/O - Operating systems are everywhere
Bootstrap program is loaded at power-up or reboot.
Typically stored in ROM or EPROM, generally known as firmware.
Initializes all aspects of system.
Loads operating system kernel and starts execution.
One or more CPUs, device controllers connect through common bus providing access to shared memory.
Concurrent execution of CPUs and devices competing for memory cycles.
Device controller informs CPU that it has finished its operation by causing an interrupt.
The normal sequence of the processor may be interrupted by other modules like I/O, memory etc. The list of common interrupts.
Generated as a result of an instruction execution. For example, arithmetic overflow, division by zero etc.
Generated by timer within the processor. It allows OS to perform certain functions on regular basis.
Generated by I/O controller to indicate any error or normal completion of an operation.
Failure Generated by failure like power failure or memory parity error.
The aim of interrupts is to improve the processor utilization. For example, most I/O devices are slower than the processor. If the processor gives the instruction for WRITE something on I/O devices, the I/O unit takes two steps for the job
I/O program may copy the data to be written into the buffer etc. and prepare for the actual I/O operation.
The actual I/O command has to be executed.
Common Functions of Interrupts
Interrupt transfers control to the interrupt service routine generally, through the interrupt vector, which contains the addresses of all the service routines.
Interrupt architecture must save the address of the interrupted instruction.
A trap or exception is a software-generated interrupt caused either by an error or a user request.
An operating system is interrupt driven.
Storage Structure types
Main memory only large storage media that the CPU can access directly.
Random access, typically volatile.
Secondary storage extension of main memory that provides large nonvolatile storage capacity.
Hard disks rigid metal or glass platters covered with magnetic recording material.
Disk surface is logically divided into tracks, which are subdivided into sectors.
The disk controller determines the logical interaction between the device and the computer .
Solid-state disks faster than hard disks, nonvolatile.
Various other technologies, Becoming more popular.
The basic unit of computer storage is the bit.
A bit can contain one of two values, 0 and 1.
A byte is 8 bits.
All other storage in a computer is based on collections of bits. Given enough bits, it is amazing how many things a computer can represent: numbers, letters, images, movies, sounds, documents, and programs.
103 = 10001
106 = 10002
109 = 10003
Storage-Device Hierarchy diagram
In computing, a cache is a hardware or software component that stores data so future requests for that data can be served faster, the data stored in a cache might be the result of an earlier computation, or the duplicate of data stored elsewhere.
Device controller to manage I/O. Provides uniform interface between controller and kernel.
Different types of Operating System Structure
Single- and multi-tasking
A single-tasking system can only run one program at a time, while
Amulti-taskingoperating system allows more than one program to be running in concurrency. This is achieved bytime-sharing, dividing the available processor time between multiple processes that are each interrupted repeatedly in time slices by a task-scheduling subsystem of the operating system.
Single- and multi-user
Single-user operating systems have no facilities to distinguish users, but may allow multiple programs to run in cycle.
Amulti-useroperating system extends the basic concept of multi-tasking with facilities that identify processes and resources, such as disk space, belonging to multiple users, and the system permits multiple users to interact with the system at the same time.
Adistributed operating systemmanages a group of distinct computers and makes them appear to be a single computer.
Distributed systems use multiple central processors to serve multiple real time application and multiple users.
Data processing jobs are distributed among the processors accordingly to which one can perform each job most efficiently.
In an OS, distributed andcloud computingcontext,templatingrefers to creating a single virtual machine image as a guest operating system, then saving it as a tool for multiple running virtual machines.
The technique is used both invirtualizationand cloud computing management, and is common in large server warehouses.
Embedded operating systemsare designed to be used inembedded computer systems. They are designed to operate on small machines like PDAs with less autonomy. They are very compact and extremely efficient by design.
Areal-time operating systemis an operating system that guarantees to process events or data within a certain short amount of time.
A library operating system is one in which the services that a typical operating system provides, such as networking, are provided in the form of libraries.
Multiprogramming (Batch system) - needed for efficiency.
Since several jobs are available on disk, OS can select which job to run; this essentially leads to job scheduling. Idea is to ensure that CPU is always busy.
A single job may not be able to be keep CPU busy. Multiprogramming allows to keep the CPU more busy.
Single user cannot keep CPU and I/O devices busy at all times.
Multiprogramming organizes jobs (code and data) so CPU always has one to execute.
Once this job needs an I/O operation operating system switches to another job (CPU and OS always busy).
A subset of total jobs in system is kept in memory.
One job selected and run via job scheduling.
In multiprogramming the prime focus is to maximize the CPU usage.
Memory Layout for Multiprogrammed System
Timesharing (multitasking) - Processor's time which is shared among multiple users simultaneously is termed as time-sharing.
In time sharing systems the prime focus is on minimizing the response time,
Each user has at least one program executing in memory process.
If several jobs ready to run at the same time - CPU scheduling.
If processes dont fit in memory, swapping moves them in and out to run.
Creating interactive computing.
Personal computers computer system dedicated to a single user.
I/O devices keyboards, mice, display screens, small printers.
User convenience and responsiveness.
Can adopt technology developed for larger operating system.
May run several different types of operating systems (Windows, MacOS, UNIX, Linux)
Multiprocessor systems - with more than on CPU in close communication.
Tightly coupled system processors share memory and a clock; communication usually takes