Download presentation
Presentation is loading. Please wait.
1
1 Chapter 1: Introduction What is the aim of the subject? What is the aim of the subject? Why are OSes important? Why are OSes important? What is an OS? What is an OS? A bit of history A bit of history Some basic OS concepts Some basic OS concepts How does an OS work? How does an OS work? OS Structures OS Structures
2
2 The Aim of the Subject WILL NOT TEACH YOU HOW TO USE AN OPERATING SYSTEM. It will examine It will examine the way in which an OS works the way in which an OS works the algorithms and data structures inside an OS the algorithms and data structures inside an OS the problems, solutions and trade offs in designing an OS the problems, solutions and trade offs in designing an OS TO ACHIEVE AN UNDERSTANDING OF HOW AN OPERATING SYSTEM WORKS.
3
3 Computer System Components Application Software : Bank automation system, airline reservations, payroll etc. System Software : OS, data base, compilers, editors etc.
4
4 What is SYSTEM SOFTWARE? System software provides the environment and the tools to create the application software (sort of virtual machine) System software provides the environment and the tools to create the application software (sort of virtual machine) It is also the interface between the hardware and the applications It is also the interface between the hardware and the applications
5
5 Why is the OS Important? The operating system is the foundation upon which all computing work is performed. The operating system is the foundation upon which all computing work is performed. Knowledge of the internals of an OS is essential to achieve efficiency in Knowledge of the internals of an OS is essential to achieve efficiency in building software applications building software applications deciding upon a computing platform deciding upon a computing platform
6
6 What is an Operating System? A big, complex program (sometimes many) A big, complex program (sometimes many) It has two main purposes in life It has two main purposes in life An interface between the user and the hardware (provides a virtual machine) An interface between the user and the hardware (provides a virtual machine) Provide efficient, safe management of computing resources Provide efficient, safe management of computing resources
7
7 Life without an OS Every programmer would Every programmer would have to know the hardware have to know the hardware be able to access the hardware be able to access the hardware Every program Every program would contain code to do the same thing would contain code to do the same thing probably do something wrong probably do something wrong
8
8 Where does the OS Fit? Hardware CPU & Memory I/O Devices Operating System System Calls Users and User Programs
9
9 History : First Generation (1945-1955) Vacuum tubes Vacuum tubes No operating system No operating system Programming is done by wiring a plug board Programming is done by wiring a plug board Applications are mostly numerical calculations (trajectory computations, computation of tables such as sine, cosine etc.) Applications are mostly numerical calculations (trajectory computations, computation of tables such as sine, cosine etc.)
10
10 History: Second Generation (1955-1965) Transistors Transistors Commercially produced computers Commercially produced computers Very expensive and very slow computers compared with your old PC at home Very expensive and very slow computers compared with your old PC at home Batch operation (collect jobs, run in one go, print all outputs) Batch operation (collect jobs, run in one go, print all outputs)
11
11 Spooling (Simultaneous Peripheral Operation On-line) Spooling (Simultaneous Peripheral Operation On-line) off-line spooling off-line spooling on-line spooling on-line spooling Off-line spooling : replace slow I/O devices with I/O dedicated computers so that the main system sees these machines as its I/O devices Off-line spooling : replace slow I/O devices with I/O dedicated computers so that the main system sees these machines as its I/O devices
12
12 Early Batch Systems bring cards to 1401 read cards to tape put tape on 7094 which does computing put tape on 1401 which prints output
13
13 A Deck of Cards (Program)
14
14 Applications are mostly scientific and engineering calculations (eg., solution of partial differential equations) Applications are mostly scientific and engineering calculations (eg., solution of partial differential equations) High level languages such as FORTRAN and COBOL High level languages such as FORTRAN and COBOL
15
15 History: Third Generation (1965-1980) Integrated circuits (small scale) packed as chips Integrated circuits (small scale) packed as chips I/O processors (channels) which can work in parallel with CPU - Multiprogramming I/O processors (channels) which can work in parallel with CPU - Multiprogramming
16
16 Multiprogramming system - three jobs in memory
17
17 On-line spooling (using channels) On-line spooling (using channels) Time-sharing (TTY terminals and VDU’s) Time-sharing (TTY terminals and VDU’s) Multics OS - original UNIX Minicomputers - Cheaper than mainframes but with limited hardware (eg. DEC PDPx) Multics OS - original UNIX Minicomputers - Cheaper than mainframes but with limited hardware (eg. DEC PDPx)
18
18 History: Fourth Generation (1980-1990) Large scale integration Large scale integration Personal computers Personal computers CP/M, MS DOS, Unix operating systems CP/M, MS DOS, Unix operating systems Networks Networks
19
19 Now! Client/Server computation Client/Server computation Clients : PCs, workstations running under Windows and UNIX operating systems Clients : PCs, workstations running under Windows and UNIX operating systems Servers : systems that run under UNIX and Windows NT Servers : systems that run under UNIX and Windows NT Internet and intranet networking (WWW) Internet and intranet networking (WWW)
20
20 Links for More History http://www.old-computers.com http://www.old-computers.com http://www.old-computers.com http://www.hitmill.com/computers/history/index.html http://www.hitmill.com/computers/history/index.html http://www.hitmill.com/computers/history/index.html http://www.computerhistory.org/ http://www.computerhistory.org/ http://www.computerhistory.org/
21
21 Important Points OS provides OS provides a simpler, more powerful interface a simpler, more powerful interface higher level services higher level services OS services only accessed via system calls OS services only accessed via system calls Users and programs can’t directly access the hardware Users and programs can’t directly access the hardware Set of System Calls (APIs) is what programs think the operating system is. Set of System Calls (APIs) is what programs think the operating system is.
22
22 Some OS Concepts Kernel Kernel The main OS program. Contains code for most services. Always in primary memory The main OS program. Contains code for most services. Always in primary memory Device Drivers Device Drivers Programs that provide a simple, consistent interface to I/O devices Programs that provide a simple, consistent interface to I/O devices Typically part of the kernel Typically part of the kernel
23
23 Some OS Concepts Program Program A static file of machine code on a disk A static file of machine code on a disk Process Process A program in execution. A program in execution. The collection of OS data structures and resources owned by a program while it is running. The collection of OS data structures and resources owned by a program while it is running.
24
24 Producing an Executable Source CodeObject File Compile Libraries and other Object files Link Executable
25
25 #include #include "ourhdr.h" int main(int argc, char *argv[]) { DIR *dp; struct dirent *dirp; if (argc != 2) err_quit("a single argument (the directory name) is required"); if ( (dp = opendir(argv[1])) == NULL) err_sys("can't open %s", argv[1]); while ( (dirp = readdir(dp)) != NULL) printf("%s\n", dirp->d_name); closedir(dp); exit(0); } Functions supplied by system libraries. These functions will contain a trap instruction. A Simple Program to print a directory
26
26 RAM User Program #1 User Program #2 trap 002 Kernel 1 2 3 System/Kernel Mode User Mode 1. Program performs trap 2. OS determines service number 3. Service is located and executed. 4. Control returns to user program. 4 Based on a diagram from “Modern Operating Systems” by Andrew Tanenbaum.
27
27 Steps in Making a System Call There are 11 steps in making the system call : read (fd, buffer, nbytes)
28
28 Some System Calls For Process Management
29
29 Some System Calls For File Management
30
30 Some System Calls For Directory Management
31
31 Some System Calls For Miscellaneous Tasks
32
32 A System Call Example A stripped down shell: A stripped down shell: while (TRUE) {/* repeat forever */ type_prompt( );/* display prompt */ type_prompt( );/* display prompt */ read_command (command, parameters)/* input from terminal */ read_command (command, parameters)/* input from terminal */ if (fork() != 0) {/* fork off child process */ /* Parent code */ /* Parent code */ waitpid( -1, &status, 0);/* wait for child to exit */ waitpid( -1, &status, 0);/* wait for child to exit */ } else { /* Child code */ /* Child code */ execve (command, parameters, 0);/* execute command */ execve (command, parameters, 0);/* execute command */ }}
33
33 OS Structures Monolithic systems Monolithic systems Hierarchy of layers Hierarchy of layers Virtual machines Virtual machines Micro-kernel (client/server) model Micro-kernel (client/server) model
34
34 Monolithic System OS has no structure but is a collection of procedures with well defined calling interfaces OS has no structure but is a collection of procedures with well defined calling interfaces Program - OS interface is via supervisor calls (SVC) Program - OS interface is via supervisor calls (SVC) Interrupt Handler Service routine SVC Program
35
35 Simple structuring model for a monolithic system
36
36 Monolithic System (Cont.) OS code is a binded object program and its source code may be logically divided into OS code is a binded object program and its source code may be logically divided into OS main program OS main program System call service routines System call service routines Utility procedures which help service routines Utility procedures which help service routines
37
37 Layered System Structure of “THE” OS (a batch OS) Structure of “THE” OS (a batch OS)
38
38 Layered System (Cont.) 0. Process switching, multi programming, CPU scheduling 1. Memory and swap space (disk) management (“segment controller”) 2. Message interpretation, job control (JCL) functions 3. I/O management (virtual peripherals) 4. User programs 5. Operator
39
39 Layered System (Cont.) Synchronisation between layers : Hardware and software (semaphores) interrupts Synchronisation between layers : Hardware and software (semaphores) interrupts Each layer provides some sort of a “virtual machine” Each layer provides some sort of a “virtual machine”
40
40 Virtual Machines Physical Hardware Virtual Machine OS1 OS2 OS3 OS4 User Programs VM provides “n” duplicates of physical hardware using software. So different Oses can work in the same machine at the same time
41
41 What is wrong so far? OS is one large program that provides all the required services. OS is one large program that provides all the required services. Anytime you add a new device you must Anytime you add a new device you must get a device driver for the device get a device driver for the device recompile the kernel with the new device driver recompile the kernel with the new device driver reboot the machine so the new kernel will be used reboot the machine so the new kernel will be used
42
42 Micro-Kernel (Client/Server) Model OS is a minimal core known as Kernel. OS is a minimal core known as Kernel.
43
43 The kernel contains the minimum of function The kernel contains the minimum of function memory management memory management basic CPU management basic CPU management inter-process communication (messages) inter-process communication (messages) I/O support I/O support Other functionality provided by user level processes Other functionality provided by user level processes
44
44 Characteristics of Kernel Makes use of message passing Makes use of message passing Easy to replace server processes Easy to replace server processes Easier to write and port OS Easier to write and port OS Design is perfect for distributed systems Design is perfect for distributed systems Less performance Less performance
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.