290 likes | 296 Views
Operating Systems I. INTRODUCTION. Abstract View of Computer Components. Computer System Components. Hardware provides basic computing resources (CPU, memory, I/O) Operating system controls and coordinates the use of the hardware among the various application programs for the various users
E N D
Operating Systems I . Introduction to Operating Systems
INTRODUCTION Introduction to Operating Systems
Abstract View of Computer Components Introduction to Operating Systems
Computer System Components • Hardware • provides basic computing resources (CPU, memory, I/O) • Operating system • controls and coordinates the use of the hardware among the various application programs for the various users • Applications programs • define the ways in which the system resources are used to solve the computing problems of the users (compilers, database systems, video games, business programs) • Users • (people, machines, other computers) Introduction to Operating Systems
Why Study Operating System? • Argument against studying OS • Very few designers/implementers needed • All I need to know is in the manual pages • We are all just going to use Windows-?? Anyway !!! Introduction to Operating Systems
Arguments in Favour • OS is the most used program • Need to know about system design in general • OS includes all design/implementation problems • design of efficient interfaces • flexibility, robustness and performance • trade-off between performance and simplicity • Mini-OS in many applications • We are not all using Windows-??... Introduction to Operating Systems
What is an OS? • Is a program that • manages physical resources • acts as an interface between the user and the hardware • controls the execution of application programs • provides an environment for the execution of programs • provides mechanisms and policies to manage the whole resources of the system • controls programs and users interactions Introduction to Operating Systems
Major Issues in OS • Structure -- how is an operating system organised? • Sharing -- how are resources shared between users and programs? • Naming -- how are resources named (by users or programs)? • Protection -- how is a user/program protected from another? • Security --how to restrict the flow information? • Performance--why it is slow? • Reliability & fault tolerance--when something goes wrong • Extensibility--how to add new features? Introduction to Operating Systems
Major Issues in OS • Communication -- how and with whom can we communicate (exchange information)? • Concurrency -- how are parallel activities created & controlled? • Scalability & Growth -- what will happened when demands and/or resources increase? • Persistence -- how to make data last longer than programs? • Compatibility --can we ever do anything new? • Distribution--accessing the world of information? • Accounting--who pays the bills, and how to control resource usage? Introduction to Operating Systems
OS Views • An operating system can be seen as • a virtual machine (extending the hardware functionality) • resource manager (managing the hardware resources) • Virtual Machine • Hide all the low-level details of programming the hardware • Construct layers of software that provide more and more functionality • Present a nice and simple view of the computer use Introduction to Operating Systems
OS as Resource Manager • A computer can be seen as a set of resources for • movement, storage, and processing of data and • control of these functions • The hardware resources can be • CPU (computation) • Main memory • Secondary memory (disks, tapes, etc) • Network • I/O devices (keyboard, mouse, printers, display, etc) • ... Introduction to Operating Systems
OS Principles • OS as illusionist • make hardware resources unlimited • provide illusion of dedicated machine with infinite memory and infinite processors • OS as government • protect users from each other • allocate resources fairly and efficiently • OS as history teacher • learn from the past to predict the future Introduction to Operating Systems
A brief history of OS • With the earliest computers, the OS was just “code” to which you linked your program, loaded as a whole into the main memory and ran it • It is just a run-time library • Simple batch systems were the first real OSs • the OS is stored in the main memory • a single job is loaded (from card reader) into the memory • the control cards of the job tell the OS what to do • run the job (compute, print the outputs, etc.) Introduction to Operating Systems
Multiprogramming • Idea: Expand memory to hold 2 or more programs and switch among all of them. This process is known as Multitasking or Multiprogramming • Multiprogramming Systems • keep multiple runnable jobs loaded in memory • overlap I/O operations of a job with computations of another • benefit from I/O devices that can operate asynchronously • require the use of interrupts and DMA • increase the processor utilisation and attempt to optimise throughput • Central theme of modern operating systems Introduction to Operating Systems
Timesharing • Idea:is to have multiple users simultaneously using terminals, with the OS interleaving the execution of each user program in a short quantum of computation • Timesharing Systems • based on time-slicing • each user feels like using the computer on his/her own • try to optimise response time • allow the users to view, edit, debug, and run their programs interactively • MIT Multics system (mid-late 60s) was the first large timesharing system Introduction to Operating Systems
Real-Time OS • Idea: OS must guarantee response to physical events in a fixed interval of time • Real-Time OSs • are used for specialised applications: subway systems, flight control, factories, nuclear power, etc. • their problem is to schedule all activities in order to meet all their critical requirements • perform operations at fixed, predetermined times (time intervals) • allow more user control • With the use of video applications on modern PCs, all OSs will have real-time requirements Introduction to Operating Systems
Distributed OS • Idea:a common operating system shared by a network of independent computers • Distributed OS • facilitates the use of geographically distributed resources • looks to its users like an ordinary centralised OS • supports communication between parts of a job or different jobs • supports sharing of distributed resources (hardware and software) • allows some kind of parallelism, but the speedup is not an issue Introduction to Operating Systems
Process Management • An OS executes many kinds of activities • user programs • system programs; print spooler, name servers, file servers, etc • Each of these “execution entities” is encapsulated in a process • The OS schedules processes to run Introduction to Operating Systems
Processes • A program is just a file on a disk with code that is potentially executable • A process is one instance of a program in execution. At any time, there may be many processes running copies of a single program (e.g. an editor): each one is a separate and independent process • A process includes the execution context (program counter, registers, virtual memory, resources, etc.) and all information the activity (program) needs to run Introduction to Operating Systems
Process Operations • Processes are fundamental OS-provided objects • The OS operations on processes include • create a process • delete a process • suspend a process • inter-process communication • inter-process synchronisation • create/delete a sub-process Introduction to Operating Systems
Memory Management • The main memory is a direct-access storage device • Programs must be stored in memory to be executed • OS must • allocate memory to processes (implicitly and explicitly) • de-allocate it when they are done • maintain (update) the mapping between virtual and physical memory (page tables) • Keep track of which parts of memory are in use and which parts are not • decide how much memory to allocate to each process and when a process should be removed from memory Introduction to Operating Systems
I/O Management • An important part of the OS kernel is dedicated to I/O • The OS provides a standard interface between processes (user’s or system’s) and devices • Device driver • is a process responsible for a given device type • encapsulate device-specific knowledge, e.g. for device initiation and control, interrupt handling and errors • there may be a process for each device Introduction to Operating Systems
Secondary Storage Management • Secondary Storage • permanent memory • endures system failures (we hope) • block access (Disk) • OS must • provide low-level routines responsible for low-level disk functions such as disk scheduling, head movement, error handling, etc • manage the disk space Introduction to Operating Systems
File Management • Secondary storage devices are too crude to be used directly for long-term storage • A file is • the basic long-term storage entity • a collection of permanent information that can be read or written • File system • provides logical objects • provides logical operations on these objects • supports directories -- special files that contain other files Introduction to Operating Systems
File Management • File system provides standard file operations • create/delete files • create/delete directories • copy/move files/directories • other basic operations like: read, write, protect, extend, … • File system provide also general services • backup Introduction to Operating Systems
System Protection • Protection is a mechanism for controlling the access of processes or users to the resources of the system • All resource objects need to be protected • CPU, memory • processes • files • devices, networking • Protection mechanisms • help to detect errors and • prevent malicious destruction Introduction to Operating Systems
Command Interpreter • A process that handles user input commands from keyboard (or script files) • Command Interpreter can be • a standard part of the OS • simply a non-privileged process interacting with the user (Macintosh has no commands in the conventional sense) Introduction to Operating Systems
Accounting System • Accounting • general facility to keep track of all system resource usage • can be used to enforce quotas, or to produce bill$ Introduction to Operating Systems