(OS) Operating System „ System software that manages computer resources and provides as an interface between an application program and the computer hardware. Company Logo @

Digital Computer Concept and Practice

Computer Software (revisited) Operating System

„ System software: manages and controls computer „ Goals hardware so that application software can „ Execute user programs perform a task „ Use the computer hardware in an efficient manner „ Operating systems „ Make the computer system convenient to use „ Device drivers

„ Programming tools, etc. „ Application software

„ Word processors: used to create and print documents.

„ Spreadsheets: allow users to perform various calculations on rows and columns of numbers.

„ Graphics, etc. OS Tasks OS Architecture

start the computer provide a manage programs „ OS = Kernel + Service Program

administer security

manage Application Software memory System Software

Service Program Operating System control a network Kernel

establish an monitor schedule jobs and internet connection configure devices provide file performance management and other utilities

OS Tasks Operating System Architecture

„ e.g. recognizing input from the keyboard, sending „ Kernel output to the display screen, keeping track of files „ Core component (OS of a narrow sense) and directories on the disk, and controlling peripheral devices such as disk drives and printers. „ When the OS boots, a kernel loads first and remains in main memory.

„ Providing all the essential services

„ CPU , managing system resources, I/O functions, etc. „ Service

„ Providing convenience services

„ Notepad, calculator, disk defragmenter, etc. User

„ Single user

„ MS-DOS, Windows 95 „ Multi-user Types of Operating System „ Allows two or more users to run programs at one time

„ (), Windows XP, Windows Vista

„ Job Processes Î Single Tasking, Multitasking „ User Î Single User, Multi-user „ System Processes Î Batch Processing, Time-Sharing

Job Processes System Processes

„ Single tasking „ Batch processing „ One task at one time „ It is execution of a series of programs ("jobs") on a „ MS-DOS ( Disk Operating System) computer „ Developed in early 1980s for personal computers „ „ Used command-line interface when first developed Data or programs are collected grouped and

„ Hardly used today because it does not offer GUI processed at a later date. „ Multitasking „ Early operating systems

„ More than one task at one time

„ Allows more than one program to run concurrently

„ Foreground contains a program you are using

„ Background contains programs that are running but are not in use System Processes (1) Main

„ Time-sharing „ Memory management involves providing ways to allocate portions of memory to programs at their „ Refers to sharing a computing resource among request and freeing it for reuse when no longer many users by multitasking. needed. „ Faster responses than batch processing „ Program execution methods „ UNIX „ Monoprogramming (single programming)

„ Multiprogramming „ Program allocation methods 1,4,7,... 3,6,9,... „ Fixed partition (static partition)

2,5,8,... „ Variable partition (dynamic partition) „

Program Execution Methods

Monoprogramming Multiprogramming

Operating System Functions

„ Main Memory Management „ Management „ I/O Management „ User Interface „ Protection for Program and User Fixed Partition Allocation Virtual Memory

„ Program allocation methods: ‘fixed’ or ‘variable’ „ Divide memory into fixed-size partitions „ Not a physical device but an abstract concept. „ Each partition contains exactly one process „ System creates illusion of large contiguous memory „ When a process terminates, the partition becomes spaces for each process. available for other processes „ Keep only the active the process in main memory „ Easy to implement, but.. „ Inactive processes are kept in the secondary memory, i.e. hard disk. OS OS „ The main memory can execute a process bigger than Partition 1 Program A Program A, B its own capacity. Partition 2 Partition 2 allocation Program B Partition 3 internal fragmentation

Partiion 4 Partition 4

Variable Partition Allocation Virtual Memory

„ When a process arrives, search for a memory large enough for this process Secondary Memory „ Allocate only as much memory as needed Main Memory VM of user A Program „ When a process terminates, the space becomes A available for loading a new process

„ Hard to manage, but.. Program VM of user B B OS OS Program A Program A fragmentation Program B Program VM of user C C Program C Load only active processes Program C to run programs

Program D

Need to be fragmentation merged external fragmentation (2) Process Management Round Robin

„ Assigns time slices to each process in equal portions „ Process: a running program and in order, handling all processes without priority „ CPU executes only one instruction at a time, one after „ A job is resumed next time a time slot is assigned the other Æ needs CPU scheduling to that process. „ CPU scheduling „ Keeping current process states „ FIFO „ Appropriate for interactive system. „ Round robin

„ Priority scheduling A waiting list for execution Execution Execution Start Complete A’ C B A CPU

An uncompleted job during previous time slot

FIFO (First In First Out) Priority Scheduling

„ Each process is assigned a priority, and the process „ FIFO executes a process in the requested order with the highest priority is performed „ It gives every process CPU time in the order they come. „ How to give a priority? „ Though a process needs a short time, it can wait a „ ‘Shortest job first’ scheduling long time. „ Scheduler runs the shortest job first. „ Inappropriate for interactive system. „ The length of a job estimates based on previous runs.

„ UNIX : Round Robin + Priority A waiting list for execution Execution Execution A waiting list for execution Start Complete C B A CPU Execution in order of Execution C B A B, C and A CPU Complete

Estimated job length (3) I/O Management File Management

„ “” „ Files

„ It gives OS a signal that an event has occurred. „ Collection of information (stored on hard disk)

„ An interrupt is a signal which tells the OS to suspend „ Disks need to be formatted to allow them to store execution of its present instructions (A) and to transfer information to another instructions (B). „ OS manages location of files on disk. „ And, the OS resumes the original instruction (A) when „ Performs I/O to disk finished with (B). „ Checks and corrects errors on disk I/O „ Interrupt signals can come from a variety of sources. „ Performs copying, renaming, deleting, and moving „ e.g. every keystroke generates an interrupt signal files

Keyboard Interrupt (4) User Interface

„ Command line interface Keyboard interrupt Execute instructions routine „ MS DOS, UNIX „ Interacting with a computer by typing commands to Beginning a new job conduct the system. Generating „ GUI () interface Handling the input interrupt signal from a keyboard „ MS Windows, Mac OS „ GUI presents graphical icons and visual indicators. Resuming „ Using mouse and keyboard from a breakpoint (5) Protection for Program and User MS Windows

„ Control system resources of each user „ MS Windows versions Windows Version Year Released „ Authentication and authorization „ Windows 3.x Windows 3.x 1990 „ Detect and protect a personal computer from „ Not O/S Windows NT 3.1 1993 „ Offering multitasking unauthorized intrusions Windows 95 1995 and GUI Windows NT Workstation 4.0 1996 „ Windows 95 Windows 98 1998 „ Plug and Play Windows Millennium Edition 2000 „ OLE (Object Linking and Embedding) Windows 2000 Professional 2000 Windows XP 2001 Windows XP SP2 2004 Windows Vista 2006

MS Windows

„ Windows XP „ Fast, reliable(?) Windows operating system „ Available in five editions: Home Edition, Professional Examples of Operating System Edition, Tablet PC Edition, Media Center Edition, and 64-bit Edition

„ MS Windows „ UNIX (LINUX) „ Mac OS MS Windows Mac OS

„ Windows Vista „ Mac OS X „ „ Successor to Windows XP, containing a new interface Available only for Apple computers and new/enhanced features „ GUI environments

UNIX

„ UNIX (1969, Bell Lab.)

„ Portability, small size kernel, and open source codes (by C language)

„ Currently offers GUI

„ Many versions

„ System V

„ SunOS

„ Solaris

„ Linux (for PC)