Beruflich Dokumente
Kultur Dokumente
Introduction
Chapter 1: Introduction
Chapter 1: Introduction
What is the aim of the subject? Why are OSes important? What is an OS? A bit of history Some basic OS concepts How does an OS work? OS Structures
Ceng 334 - Operating Systems
1-1
It is a resource manager
Each program gets time with the resource Each program gets space on the resource
4
Introduction
1-4
1-5
1-6
Every program
would contain code to do the same thing probably do something wrong
1-7
10
11
12
Multiprogramming system
three jobs in memory 3rd generation
15
17
1-10
18
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
Ceng 334 - Operating Systems
1-11
19
Applications are mostly scientific and engineering calculations (eg., solution of partial differential equations) High level languages such as FORTRAN and COBOL
1-12
20
21
Minicomputers - Cheaper than mainframes but with limited hardware (eg. DEC PDPx)
1-14
22
1-15
23
Now
Now!
Client/Server computation Clients : PCs, workstations running under Windows and UNIX operating systems Servers : systems that run under UNIX and Windows NT Internet and intranet networking (WWW)
1-16
24
Important Points
Important Points
OS provides
a simpler, more powerful interface higher level services
OS services only accessed via system calls Users and programs cant directly access the hardware Set of System Calls (APIs) is what programs think the operating system is.
Ceng 334 - Operating Systems
1-17
25
Device Drivers
Programs that provide a simple, consistent interface to I/O devices Typically part of the kernel
1-18
26
Process
A program in execution. The collection of OS data structures and resources owned by a program while it is running.
1-19
27
Producing an Executable
Producing an Executable
Source Code Object File Executable
Compile
Link
1-20
28
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); } Ceng 334 - Operating Systems
1-21
29
int main(int argc, char *argv[]) { DIR *dp; struct dirent *dirp;
Functions supplied by system libraries. These functions will contain a trap instruction.
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); } Ceng 334 - Operating Systems
1-22
30
31
1-24
32
Monolithic System
Monolithic System
OS has no structure but is a collection of procedures with well defined calling interfaces Program - OS interface is via supervisor calls (SVC)
SVC Program Interrupt Handler Service routine
1-25
33
OS code is a binded object program and its source code may be logically divided into
OS main program System call service routines Utility procedures which help service routines
1-26
34
Layered System
Layered System
Structure of THE OS (a batch OS)
5. OPERATOR FUNCTIONS 4. USER PROGRAMS 3. I/O MANAGEMENT 2. OPERATOR-PROCESS COMMUNICATION 1. MEMORY MANAGEMENT (Swapping) 0. CPU MANAGEMENT (Process switching)
1-27
36
37
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)
Ceng 334 - Operating Systems
1-28
38
4. User programs 5. Operator Synchronisation between layers : Hardware and software (semaphores) interrupts Each layer provides some sort of a virtual machine
Ceng 334 - Operating Systems
1-29
39
Virtual Machine
Virtual Machines User Programs OS1 OS2 OS3 OS4 Virtual Machine Physical Hardware
VM provides n duplicates of physical hardware using software. So different Oses can work in the same machine at the same time
1-30
40
What is wrong
What is wrong?
OS is one large program that provides all the required services. Anytime you add a new device you must
get a device driver for the device recompile the kernel with the new device driver reboot the machine so the new kernel will be used
1-31
42
Micro-Kernel Model
Micro-Kernel (Client/Server) Model
OS is a minimal core known as Kernel.
Messages for Communication Prog1 Prog2
.. File Server
OS Kernel
1-32
43
46
Characteristics of Kernel
Characteristics of Kernel
Makes use of message passing Easy to replace server processes Can have multiple personalities Easier to write and port OS Design is perfect for distributed systems
Less performance
Ceng 334 - Operating Systems
1-34
47
Bus
(a)
(b)
(a) Steps in starting an I/O device and getting interrupt (b) How the CPU is interrupted 53
54
A process tree
A created two child processes, B and C B created three child processes, D, E, and F
55
57
Before mounting,
files on floppy are inaccessible
/* execute command */
60
61
Metric Units