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:

 

1.    Hardware

CPU, memory, I/O devices, etc.

 

2.    Operating system

Controls and coordinates the use of hardware among various applications and users

 

3.    Application programs

Word processors, compilers, web browsers, database systems, video games

 

4.    Users

People, machines, other computers

 

 

 

 

 

«   Computer System Organization

 

 

 

 

 

 

«   Computer-System Operation

 

 

·       I/O devices and the CPU can execute concurrently

·       Each device controller is in charge of a particular device type

·       Each device controller has a local buffer

·       CPU moves data from/to main memory to/from local buffers

·       I/O is from the device to local buffer of controller

·       Device controller informs CPU that it has finished its operation via interrupt

 

 

«   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

·       Incoming interrupts are disabled while another interrupt is processed to prevent a lost interrupt

·       An operating system is interrupt driven

 

 Interrupt Handling

·       The operating system preserves the state of the CPU by storing registers and the program counter

·       Determines which type of interrupt has occurred

·       Separate segments of code determine what action should be taken for each type of interrupt

 

 

 


«   Direct Memory Access Structure

 

·       Used for high-speed I/O devices to transmit information at close to memory speeds

·       Device controller transfers blocks from buffers directly to main memory without CPU intervention

·       Only one interrupt is generated per block, rather than one interrupt per byte

 

 

«   Storage Structure

 

·       Main memory – storage media that the CPU can access directly

·       Secondary storage – extension of main memory that provides large nonvolatile storage capacity

·       Magnetic disks – metal covered with magnetic recording material

Disk surface is logically divided into tracks, which are subdivided into sectors

 

 

 

«   Storage-Device Hierarchy

 

 

 

«   Caching

 

·       Information in use copied from slower to faster storage temporarily

·       Faster storage (cache) checked first to determine if information is there

ü If it is, information used directly from the cache (fast)

ü If not, data copied to cache and used there

·       Cache smaller than storage being cached

ü Cache management is important design problem

ü Cache size and replacement policy

 

 

 


«   How a Modern Computer Works

 

 

Description: 1

 

«   Operating System Structure

 

·       Multiprogramming needed for efficiency

ü 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

ü A subset of total jobs in system is kept in memory

ü One job selected and run via job scheduling

ü When it has to wait (for I/O for example), OS switches to another job

 

·       Timesharing (multitasking) is logical extension in which CPU switches jobs so frequently

that users can interact with each job while it is running, creating interactive computing

ü Response time should be < 1 second

ü 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 don’t fit in memory, swapping moves them in and out to run

ü Virtual memory allows execution of processes not completely in memory

 

 

«   Operating-System Operations

 

 

Dual-mode operation allows OS to protect itself and other system components

·       User mode and Kernel mode

·       Mode bit provided by hardware

ü Provides ability to distinguish when system is running user code or kernel code

ü Some instructions designated as privileged, only executable in kernel mode

ü System call changes mode to kernel, return from call resets it to user

 

Transition from User to Kernel Mode

 

Timer to prevent infinite loop / process hogging resources

ü Set interrupt after specific period

ü Operating system decrements counter

ü When counter zero generate an interrupt

ü Set up before scheduling process to regain control or terminate program that exceeds allotted time

 

 

 


«   Process Management

 

·       Process is a program in execution. It is a unit of work within the system.

·       Program is a passive entity, process is an active entity.

·       Process needs resources to accomplish its task:

CPU, memory, I/O, Files, Initialization data

·       Process termination requires reclaim of any reusable resources

·       Single-threaded process has one program counter specifying location of next instruction to execute.

Process executes instructions sequentially, one at a time, until completion

·       Multi-threaded process has one program counter per thread

·       Typically system has many processes, running concurrently by multiplexing the CPU among the processes / threads

 

The operating system is responsible for the following activities in connection with process management:

 

·       Creating and deleting both user and system processes

·       Suspending and resuming processes

·       Providing mechanisms for process synchronization

·       Providing mechanisms for process communication

·       Providing mechanisms for deadlock handling

 

«   Memory Management

 

Memory management activities

·       Keeping track of which parts of memory are currently being used and by whom

·       Deciding which processes (or parts thereof) and data to move into and out of memory

·       Allocating and de-allocating memory space as needed

 

«   Storage Management

 

OS provides uniform, logical view of information storage

·       Abstracts physical properties to logical storage unit  - file

·       Each medium is controlled by device (i.e., disk drive, tape drive).

·       Varying properties include access speed, capacity, data-transfer rate, access method (sequential or random)

 

     File-System management

·       Files usually organized into directories

·       Access control on most systems to determine who can access what

·       OS activities include

§  Creating and deleting files and directories

§  Primitives to manipulate files and directories

§  Mapping files onto secondary storage

§  Backup files onto stable (non-volatile) storage media

 

 

«   Performance of Various Levels of Storage

 

 

 

 

 

See a comparison of Cost per Mbit vs. Capacity for many different memory types:

 

http://www.wtec.org/loyola/opto/c3_s2.htm#f3_3

 

 

 

 


«   Protection and Security

 

·       Protection –controlling access of processes or users to resources defined by the OS

·       Security – defense of the system against internal and external attacks:

  denial-of-service, worms, viruses, identity theft, theft of service.

·       Systems distinguish among users, to determine who can do what

ü User identities (user IDs) include name and associated number, one per user

ü User ID then associated with all files, processes of that user to determine access control

ü Group identifier (group IDs) allows a set of users to be defined for access control, also associated with each process and file.

ü Privilege escalation allows user to change to effective ID with more rights.

 

 

 


«   Computing Environments

 

          ·          Traditional computer: Blurring over time

o   Office environment

§  PCs connected to a network, terminals attached to mainframe or minicomputers providing batch and timesharing

§  Now portals allowing networked and remote systems access to same resources.

o   Home networks

§  Used to be single system, then modems

§  Now firewalled, networked

 

·       Client-Server Computing

o   Dumb terminals supplanted by smart PCs

o   Many systems act as servers, responding to requests generated by clients

§  Compute-server provides an interface to client to request services (i.e. database)

§  File-server provides interface for clients to store and retrieve files

 

 

 

 

 

·       Peer-to-Peer Computing

P2P does not distinguish clients and servers

§  Instead all nodes are considered peers

§  May each act as client, server or both

§  Node must join P2P network

·       Registers its service with central lookup service on network, or

·       Broadcast request for service and respond to requests for service via discovery protocol

 

·       Web-Based Computing

§  More devices becoming networked to allow web access (cloud computing)

§  New category of devices to manage web traffic among similar servers: load balancers

 

 

 

 


Open-Source Operating Systems

 

 

·       Operating systems made available in source-code format rather than just binary closed-source

·       Counter to the copy protection and Digital Rights Management (DRM) movement

·       Started by Free Software Foundation (FSF), which has “copyleft” GNU Public License (GPL)

·       Examples include GNU/Linux, BSD UNIX, including core of Mac OS X, and Sun Solaris.

E.g.:  MIT xv6: https://pdos.csail.mit.edu/6.828/2014/xv6.html