Computer Systems 1 Fundamentals of Computing Operating Systems CS1 - Week 22 Introduction to the OS OS Fundamentals Processes Memory Files I/O Computer Systems 1 (2004-2005) The Operating System (OS) Manages the hardware and software resources of the system Resources Processor Memory Disk space, etc. Allows applications to deal with the hardware without having to know all the details of the hardware Computer Systems 1 (2004-2005) Operating Systems •The OS acts a a ‘shell’ around the hardware. •The applications software need an OS to work, and users need the applications software to interact with the hardware via the OS. Application Operating System Application Application User User Hardwar e User Computer Systems 1 (2004-2005) Types of OS Real-Time Operating System (RTOS) Single-User, Single Task One user can do one thing at a time Useful for low spec systems Single-User, Multi-Tasking Fast Response (‘Real Time’ / Instant) Used to control machinery and industrial systems Usually Poor HCI One user can perform many tasks at a time Common for current PC systems Multi-User Many users can use the computer's resources simultaneously OS balances resources allocation against users and tasks N.B- A machine on a network is not necessarily multi-user!!! Computer Systems 1 (2004-2005) OS Generic Structure •Kernel •Memory & Process Management •Input / Output •File System •User Interface Computer Systems 1 (2004-2005) The Kernel Heart of the OS Provides secure access to the computer hardware Low-level software / hardware transfer Manages resource availability / usage A kernel includes Interrupt handler Handles all requests for kernel service Scheduler that Decides how and which programs share the kernel processing time Supervisor Gives use of the computer to each process when required Computer Systems 1 (2004-2005) Types of kernels Monolithic Kernel Microkernel Runs most of its services in the kernel workspace Error prone due to the amount of tasks in the kernel itself Used in most Linux systems Runs most services - like networking, filesystem, etc. - in user space More stable, but more complex designs Hybrid (Modified Microkernel) Microkernels that have some "non-essential" code in kernel space in order for that code to run more quickly. Windows NT/2000 and Macintosh OS X use hybrid kernels Computer Systems 1 (2004-2005) Process Management Process A single sequence of operation(s) The basic unit of software the operating system deals with in scheduling the work done by the processor Not the same as an application An application can contain multiple processes Process has some key attributes Process ID (PID) Priority Level Pointers to upper and lower bounds of memory allocated Status of all I/O devices needed Computer Systems 1 (2004-2005) Process Management CPU can only do one thing at a time If a process wants to use the CPU it must tell the CPU To give the appearance multi-tasking, the quickly OS switches between different processes Interrupts or Polling This function is performed by a process scheduler Schedulers decide what process should run, when, and for how long Scheduling decision factors Priority Resources needed Resources used to date Waiting time to date Computer Systems 1 (2004-2005) Memory Management Provide memory space to enable multiple processes to be executed at the same time Give satisfactory level of performance for users Protect each process Enable sharing of memory between processes Don’t get data mixed-up between processes More dynamic & efficient use of the memory resources Make addressing of memory transparent to programmers Provides Virtual Memory Extra memory, larger than the physical allocation Done by storing portions of data to backing storage Computer Systems 1 (2004-2005) Input / Output Devices use an I/O sub-system of a computer use to communicate I/O devices use interrupts to signal to the CPU that a task has been completed Communication carried out via registers IRQ – Interrupt ReQuests. Each device has a unique IRQ Need more input…. On ISA buses, data can be sent from the I/O controller to memory, bypassing the the CPU This is DMA (Direct Memory Access) Computer Systems 1 (2004-2005) Input / Output Input / Output Control System (IOCS) The part of the O/S that deals with I/O activity Deals with requests and routes to and from devices Device Driver A software module which manages the communication with, and control of, a specific I/O device Interprets requests from the application to specific commands to the I/O device Input-output Control System (IOCS) Application Program Device Driver I/O Device } System Calls Operating System I/O Bus Computer Systems 1 (2004-2005) Device Controller File System File can be stored data, although programs and folders are also considered files at a low level OS knows nothing about file structure File System tasks Applications can interpret file data Creating & deleting files Storing and organising files on storage medium A new file is allocated one cluster As the file grows the cluster becomes filled and more clusters are assigned to the file Computer Systems 1 (2004-2005) File System Ideally, successive file clusters should be in sequence on the disk Usually a disk contains many files Faster access as less disk movement in required Clusters get mixed out of sequence This is known as fragmentation Fragmentation can reach a critical level where system performance becomes greatly reduced A A B A B C C End of file A Computer Systems 1 (2004-2005) B Free cluster B End of file B File System Windows file systems are FAT File Allocation Table FAT16 Uses 16-bit value to record file properties FAT32 Very similar to FAT16, except it uses 32-bit values Linux / UNIX Use iNodes Similar procedure to Windows Usually 32-bit values Every file has an iNode OS tracks iNodes and file names Computer Systems 1 (2004-2005) User Interface The user interface (UI) is a layer above the operating system What users “see” or interact with UI deals with getting user commands and providing feedback / representation Two common types of user interfaces: Command-Line Interface (CLI) Graphical User Interface (GUI) Computer Systems 1 (2004-2005) Command-Line Interface Textual commands Either from the keyboard or from a script User types a command after the computer displays a prompt character For example, MS-DOS, UNIX, etc. Advantages Faster for skilled users All options and commands available in a standard format Can perform operations in a batch processing mode without user interaction Disadvantages Perplexes new users / Not user-friendly Multiple operations made complex Have to remember commands / not intuitive Computer Systems 1 (2004-2005) Graphical User Interface Graphical representations & metaphors GUIs have a number of common features: Advantages Windows, Icons, Menus, Pointers (WIMP) As well as buttons, toolbars, etc. Consistent look and feel, even across platforms Commands can be executed using either mouse or keyboard High levels of operation and dialog Disadvantages Often restrictive Use more system resources / more intense Computer Systems 1 (2004-2005) UNIX Designed by Ken Thomson of AT&T Bell Laboratories improved by Dennis Ritchie Multi-user More than one person suing the OS at a time Multitasking Each user can run more than one process Platform independent Runs on almost any hardware platform Complex Large distribution User control and administration Used as multiple types of server Computer Systems 1 (2004-2005) LINUX Created by Linus Torvalds Particularly aimed at PC users Two parts: Kernel Distribution Free! (more or less) Many now have a windows style interface Particular flavour of Linux Open source The Linux operations section The UNIX part of things Easy to get to grips with Some expertise is required to become a master Low hardware requirements 100 MHz CPU, 12Mb RAM, 500Mb HDD Computer Systems 1 (2004-2005) Microsoft Windows Founded by Bill Gates Developed from MS-DOS Microsoft Disk Operating System ‘Borrowed’ from XEROX Q-DOS Windows 1.0 began life as an interface running on MS-DOS GUI improved and networking capabilities added in future versions Is now independent of MS-DOS Many varieties available Majority are multi-user and multi-task Windows XP Windows Server Windows 2000 Computer Systems 1 (2004-2005) Macintosh OS X Rooted in a UNIX system Providing all the good bits of a powerful UNIX OS Super-nice GUI as front-end Ease of use and interaction Macintosh OS have always been pioneers in user-friendly interfaces and functionality High level of accessibility Scalable from first-time users to advanced Seamless integration of OS and system applications Computer Systems 1 (2004-2005) Week 22 Operating System Structure & Components Kernel Memory management Process management Input / output File system User interface Computer Systems 1 (2004-2005)