430 likes | 552 Vues
Operating System and Administration. Unit 1: Introduction to Operating System (OS). Mr. Pavan R Jaiswal. Unit Contents. General Overview History of Unix System Structure User Perspective OS Services Assumption About Hardware. What is an Operating System (1)?.
E N D
Operating System and Administration Unit 1: Introduction to Operating System (OS) Mr. Pavan R Jaiswal
Unit Contents • General Overview • History of Unix • System Structure • User Perspective • OS Services • Assumption About Hardware
What is an Operating System (1)? • A modern computer consists of: • One or more processors • Main memory • Disks • Printers • Various input/output devices. • Managing all these varied components requires a layer of software – the Operating System (OS).
What is an Operating System (2)? • An Operating System is a program that acts as an intermediary/interface between a user of a computer and the computer hardware. • OS goals: • Control/execute user/application programs. • Make the computer system convenient to use. • Ease the solving of user problems. • Use the computer hardware in an efficient manner.
Services provided by an OS • Facilities for program creation • editors, compilers, linkers, debuggers, etc. • Program execution • loading in memory, I/O and file initialization. • Access to I/O and files • deals with the specifics of I/O and file formats. • System access • resolves conflicts for resource contention. • protection in access to resources and data.
Why are Operating Systems Important? • Important to understand and know how to correctly use when writing user applications. • Large and complex systems that have a high economic impact and result in interesting problems of management. • Few actually involved in OS design and implementation but nevertheless many general techniques to be learned and applied. • Combines concepts from many other areas of Computer Science: Architecture, Languages, Data Structures, Algorithms.
Computer System Components • Hardware – provides basic computing resources (CPU, Memory, I/O devices, Communication). • Operating System – controls and coordinates the use of the hardware among various application programs for various users. • System & Application Programs – ways in which the system resources are used to solve computing problems of the users (Word processors, Compilers, Web browsers, Database systems, Video games). • Users – (People, Machines, other computers).
End User Programmer Operating- System Designer Layers of a Computer System Application Programs Utilities Operating-System Computer Hardware
Views of an Operating System • There are three classical views (in literature): • Resource Manager – manages and allocates resources. • Control program – controls the execution of user programs and operations of I/O devices. • Command Executer – Provides an environment for running user commands. • But one more modern view: the Operating System as a Virtual Machine.
1. Resource Manager • Resource Manager: • Manages and protects multiple computer resources: CPU, Processes, Internal/External memory, Tasks, Applications, Users, Communication channels, etc… • Handles and allocates resources to multiple users or multiple programs running at the same time and space (e.g., processor time, memory, I/O devices). • Decides between conflicting requests for efficient and fair resource use (e.g., maximize throughput, minimize response time). • Sort of a bottom-up view.
Resource Manager oriented OS names • DEC RSX – Resource Sharing eXecutive • MIT Multics – MULTiplexed Information and Computing Services • IBM MFT/MVT – Multiple Fixed/Variable Tasks • IBM MVS – Multiple Virtual Storage • DEC VMS – Virtual Memory System • MVS TSO – Time Sharing Option • CTSS – Compatible Time Sharing System • IBM VM – Virtual machine
2. Control Program • Control Program: • Manages all the components of a complex computer system in an integrated manner. • Controls the execution of user programs and I/O devices to prevent errors and improper use of computer resources. • Looks over and protects the computer: Monitor, Supervisor, Executive, Controller, Master, Coordinator …. • Sort of a black box view.
Control program oriented OS names • Unisys MCP – Master Control Program • DR CP/M – Control Program/Microcomputer • IBM VM/CP – VM Control Program • IBM AIX – Advanced Interactive eXecutive • DEC RSX – Resource Sharing eXecutive
3. Command Executer • Command Executer: • Interfaces between the users and machine. • Supplies services/utilities to users. • Provides the users with a convenient CLI (Command Language Interface), also called a Shell (in UNIX), for entering the user commands. • Sort of a top-down view.
Command Executer oriented OS names • IBM AIX – Advanced Interactive Executive • IBM VM/CMS – Conversational monitor System
Modern view: Virtual Machine (1) • Operating System as a Virtual Machine: • An interface between the user and hardware that hides the details of the hardware (e.g., I/O). • Constructs higher-level (virtual) resources out of lower-level (physical) resources (e.g., files). • Definition: OS is a collection of software enhancements, executed on the bare hardware, culminating in a high-level virtual machine that serves as an advanced programming environment. • virtual machine = software enhancement = extended machine = abstract machine = layer = level = ring.
Definition of Operating System • There is no universally accepted definition. • “Everything a vendor ships when you order an operating system” is good approximation but varies widely. • “The one program running at all times on the computer” is the Kernel. • Everything else is either a system program (ships with the operating system) or an application program.
What is the OS/Kernel? • Is the Operating System just the Kernel (not the utilities and application programs)?! • The Command Line Interface (CLI) (or command layer/interpreteror shell) allows direct command entry by the user. • The shell used to be in the kernel but now is a (first between equals) utility outside of it: • Easy to change/debug • Many of them (sh, bsh, csh, ksh, tcsh, wsh, bash) • Possible to switch between them (chsh)
UNIX Shell and Utilities User Utilities Shell Kernel Hardware
Components of OS • User Interface – The part of OS that you interface with. • Kernel – The core of OS. Interacts with BIOS (at one end), and the UI (at the other end). • File Management System – Organizes and manages files.
Functions of OS • Multiuser – Two or more users work with the computer at the same time. • Multitasking – Two or more processes running at the same time. • Multithreading – Two or more parts of the same process running at the same time.
PC Operating Systems • Microsoft Window – XP, 2000, 2003, 7, etc. • MacIntosh OS • Linux – Ubuntu, Fedora, Redhat, etc.
History of Unix - UNICS • 1940-1950 – one person machines – huge • 1960 – batch systems • Time-consuming process of entering punch card, debugging, etc. • Timesharing – invented at Dartmouth and MIT • MIT system – CTSS • MIT&Bell Labs&GE -> MULTICS (MULTiplexed Information and Computing Service) • Bell Labs pulled out of MULTICS, Ken Thompson stripped MULTICS on PDP-7 • UNICS (UNiplexed Information and Computing Service) • Name later changed to UNIX
Portable Unix • First port beyond PDP-11 was to Interdata 8/32 minicomputer • Porting required: • write a C compiler for the new machine, • write device drivers for the new machine’s I/O devices such as printers, terminals, disks • Small amount of machine-dependent code such as the interrupt handlers, memory management routines must be rewritten, usually in assembly code • Problem: Ritchie’s compiler – good, but produced PDP-11 object code. • Steve Johnson at Bell Labs implemented portable C compiler, called also Johnson’s compiler • 1984 – AT&T released UNIX as a commercial product, first System III, then System V.
MINIX • 1987 - New UNIX-like system • Small enough and open with source code available • Functionally almost equivalent to Version 7 UNIX • Based on micro-kernel design, i.e., minimal functionality in the kernel to make it reliable and efficient • Memory management and file system in user processes • Easy to understand • Easy to maintain due to their highly modular structure • Other Micro-kernels • Mach – CMU – 1986 • ChorusOS – INRIA - 1988 (for embedded systems)
Linux • 1991 - Linus Torvalds – Finland • UNIX clone – Linux • Linux 0.01 • came from MINIX ideas, ranging from structure of the source tree to the layout of the file system • Monolithic (not micro-kernel design) • Originally run on 386 architecture • 1994 – Linux 1.0 • New file system, memory-mapped files, BSD-like networking with sockets and TCP/IP • New device drivers • 1996 – Linux 2.0 • Support for 64-bit architectures, symmetric multiprogramming, new networking protocols • Business Model – free software • 80% of ca. 150 Linux system calls are exact copies of the corresponding system calls in POSIX, BSD or System V.
General UNIX Architecture (2) Other application programs sh who nroff a.out cpp Kernel date cmp Hardware cc echo as ld grep vi ed Other application programs
Unix Shell • Graphical User Interface at MAC and Windows • UNIX – command line interface, called shell • UNIX Graphical environment – X Windows • Bourne shell (sh) Protocol • Shell starts up and initializes itself • Shell types a prompt character (percent or dollar sign) and waits for user to type a command line • User types a command line • Shell extracts first word and assumes the name of a program to be run • Shell searches for this program • If it finds it, runs the program • Shell suspends itself until the program terminates • Shell waits for another command
Unix Shell • Shell is an ordinary user program – needs the ability to read from and write to the terminal, and execute other programs • Commands may take arguments, which are passed to the called program as character strings • Example • cp src dest • Shell accepts magic characters, called wild cards • Example: ls *.c • Shell does not have to open terminal, but it has access automatically to a file ‘standard input’ (for reading), file ‘standard output’ (for writing normal output), and file ‘standard error’ (for writing error messages) • Shell can redirect standard input/output to files • Example: sort <in >out
Unix Utility Programs • Large number of utility programs • Divided into six categories • File and directory manipulation commands • Example: cp a b | ls *.* • Filters • Example: grep (extracts lines containing patterns), cut, paste, • Program development tools such as editors/compilers • Example: cc (C compiler), make (maintain large programs whose source code consists of multiple files) • Text processing • Example: vi • System administration • Example: mount (mount file system) • Miscellaneous • Example: kill 1325 (kill a process), chmod (change privileges of a file)
OS Services • Following are services provided by OS to the convenience of user: • Program Execution • Provides environment • I/O Operations • Provides i/o devices • File System Manipulation • Manages user files • Communication • Provides mean for communication • Error Detection • Intimates user about error