Lecture 2 Overview of Operating System
Lecture 2 Overview of Operating System
LECTURE
1. 2. 3.
4. 5. 6.
Introduction to Operating System Functions Performed by an OS Types of OS Mainframe OS Server OS Multiprocessor OS PC OS Real Time OS Embedded OS Networking OS Batch Processing System Multiprogramming Time Sharing System
2
7. Spooling 8. Instruction-Fetch-Execute Cycle 9. Structure of Disk Drive 10. Busses 11. Processes 12. Deadlocks 13. Memory Management 14. I/O 15. Files 16. Security
3
Hardware
Operating System
Programs
Users
5
OPERATING SYSTEM
15/12/2013
An Operating System (commonly abbreviated as OS & O/S) is an integrated set of programs which controls the overall operations of the computer system and acts as a layer between the hardware, applications and users.
OPERATING SYSTEM
15/12/2013
1. In simplest terms, an operating system is a collection of programs that manage a computer system's internal workings its memory, processors, devices, and file system. 2. Operating systems are designed to make the best use of the computer's various resources, and ensure that the maximum amount of work is processed as efficiently as possible. Although an operating system cannot increase the speed of a computer, it can maximize use of resources.
9
OPERATING SYSTEM
15/12/2013
It is an extended/virtual machine
Hides the messy details which must be performed (e.g. underlying hardware operations) Provide a user interface, make it easier to use
10
OPERATING SYSTEM
15/12/2013
It is a resource manager
1. Process management, (CPU) each program gets time with the resource 2. Memory management, (memory / disk) each program gets space on the resource
11
OPERATING SYSTEM
15/12/2013
Functions Performed by an Operating System 1. Memory management 2. Disk management 3. File management 4. Provide working environment to the users 5. Handling I/O devices 6. Handling security 7. Scheduling 8. Copying/Moving data from one device to another
12
Microsoft Suits Disk Operating System (MS-DOS) Windows Vista Windows XP Windows 2000 Windows ME Windows 98 Windows/NT Windows 95
13
15/12/2013
Other Suits
UNIX LINUX Apple Mac OS
14
Distributed OS
MAINFRAME OS
1. A mainframe operating system runs on a mainframe computer. 2. A powerful device used mainly by governments and businesses to process large amounts of information and support a great number of users. Examples 1. z/VM (Virtual Machine) 2. z/VSE (Virtual Storage Extended) 3. Linux for System 4. z/TPF (Transaction Processing Facility)
15/12/2013
16
DISTRIBUTED OS
1. It manages a group of independent computers and makes them appear to be a single computer. 2. The development of networked computers that could be linked and communicate with each other, gave rise to distributed computing. 3. Distributed computations are carried out on more than one machine. When computers in a group work in cooperation, they make a distributed system.
15/12/2013
18
REAL-TIME OS
15/12/2013
1. A real-time operating system is a multitasking operating system that aims at executing real-time applications. 2. The main objective of real-time operating systems is their quick and predictable response to events.
19
EMBEDDED OS
15/12/2013
1. Embedded operating systems are designed to be used in embedded computer systems. 2. They are designed to operate on small machines like mobile phones, PDAs, etc. 3. They are able to operate with a limited number of resources. They are very compact and extremely efficient by design. Examples Windows CE and Minix 3, Palm OS
20
A batch processing system is one where data are collected together in the form of batches before processing starts.
1. 2. 3. 4.
The method of data entry for early computers was using punched cards, which were handled in batches, and hence the term batch processing. Each piece of work for a batch processing system is called a job. Batch processing is most suitable for tasks where a large amount of data has to be processed on a regular basis. Examples of batch processing systems include payroll systems and examination report card systems, billing system etc
21
Operations
To collect a tray full of jobs in the input room Read them on to magnetic tape Printing output
A-Programmers bring cards to 1401 B-1401 read batch of jobs onto tape C-Operator carries input tape to 7094 D-7094 does computing E-Operator carries output tape to 1401 F-1401 prints
22
MULTIPROGRAMMING
1. Multiprogramming is a feature of an OS which allows running multiple programs simultaneously on 1 CPU. So, say, you may be typing in word, listening to music while in background IE is downloading some file & anti-virus program is scanning. 2. Programs do not run simultaneously. 3. OS divides time for each program according to priorities. When the chance of that program comes it runs, after the stipulated time is over, next program runs & so on. Since this process is so fast that it appears programs are running simultaneously.
23
15/12/2013
MULTIPROGRAMMING
4. In Multiprogramming, number of processes reside in main memory at a time. 5. The OS picks and begins to executes one of the jobs in the main memory. 6. If any I/O wait happened in a process, then CPU switches from that job to another job. 7. Hence CPU in not idle at any time.
24
15/12/2013
MULTIPROGRAMMING
15/12/2013
of
OS
Job 1
The main memory consists of 5 jobs at a time, the CPU executes one by one.
Job 2
Job 3
Job 4
Job 5
25
TIME-SHARING SYSTEM
1. Time sharing, or multitasking, is a logical extension of multiprogramming. 2. Multiple jobs are executed by switching the CPU between them. 3. In this, the CPU time is shared by different processes, so it is called as Time sharing Systems. 4. Time slice is defined by the OS, for sharing CPU time between processes. Examples: Multics, Unix, etc.
26
15/12/2013
Spooling
15/12/2013
1. Simultaneous Peripheral Operation On Line 2. When a running job finished the OS load a new job from the disk into the empty partition and run it.
27
1- Processor reads instructions from memory Fetches 2- Decoding-Encoding 3- Processor executes each instruction Execution
28
CONTROL REGISTERS
15/12/2013
29
INSTRUCTION CYCLE
15/12/2013
30
31
32
it fetches instructions from memory and execute them Contains registers, hold temporary results Pipeline design
Separate into 3 units, fetch , decode and execute. While it was executing instruction n it could also be decoding instructions n+1and fetching instructions n+2 Example a
33
15/12/2013
34
-Track is
divided into sectors, 512 bytes per sector -Outer cylinder contains more sectors than the inner one. -Moving arm takes 1msec.
35
BUSES
15/12/2013
Buses, handle the data transfer between CPU and devices Structure of a large Pentium system
36
15/12/2013
-Invented by IBM
-Invented by INTL
-Runs at 66 MHZ -Transfer 8 bytes
37
15/12/2013
OS CONCEPTS
15/12/2013
1. 2. 3. 4. 5. 6.
39
PROCESS
15/12/2013
Process in execution & has address space Time sharing concept All information about each process is stored in process table of the OS.
A created two child processes, B and C B created three child processes, D, E, and F
40
15/12/2013
1. User logs on. 2. User starts a program. 3. Operating systems creates process to provide service, e.g., to manage printer. 4. Some program starts another process, e.g., Netscape calls to display a picture.
41
The new process terminates the existing process, usually due to following reasons:
Normal Exist Most processes terminates because they have done their job. Error Exist When process discovers a fatal error. For example, a user tries to compile a program that does not exist. Fatal Error An error caused by process due to a bug in program for example dividing by zero. Killed by another Process A process executes a system call telling the Operating Systems to terminate some other process. In UNIX, this call is kill. 42
15/12/2013
15/12/2013
Two or more processes are interacting, they get themselves into a tie situation they cannot get out of.
43
DEADLOCK.
15/12/2013
Read this example and discuss each other Two processes each want to write a scanned document on the CD. Process A request permission to use the scanner and is granted it. Process B is programmed differently and request the CD recorder first and is also granted it. Now A asks for the CD recorder, but the request is denied until B releases it. Unfortunately, instead of releasing CD recorder B asks for the scanner. At this stage both processes are blocked. This
DEADLOCK.
15/12/2013
Process A
Process B
Deadlock
45
MEMORY MANAGEMENT
15/12/2013
46
1. In a simple OS, only one program at a time is in the memory. To run a second program, the first one has to be removed and the second program placed in the memory. 2. Sophisticated OS allow multiple programs to be in the main memory at the same time. 3. To keep them interfering with one another, some kind of protection mechanism is needed. 4. Important memory related issue is managing the address space of the processes.
47
15/12/2013
OS managed the address space (contains data, registers including program counter, stack pointer and all other info. need to run the program) of the process. Maximum amount of address space a process has is less than the main memory, a process can fill up its address space and there will be enough room in main memory to hold it all.
48
15/12/2013
What if a process has more address space than the computer has main memory and the process wants to use it all?
49
15/12/2013
Technique called virtual memory exists, in which the OS keeps part of the address space in the memory and part on the disk and shuttles pieces back and forth between them as needed.
50
15/12/2013
1. Operating system has I/O system for managing its I/O devices. 2. Some of I/O software are device independent, i.e. applies to many I/O devices equally well.
51
Directory way of grouping files. Example, file system for a university department What will be the path of file CS101?
52
Before mounting
files on floppy are inaccessible. The root file system is on the hard disk and a second file system on the floppy disk.
53
A pipe, a sort of pseudo file that can be used to connect two processes.
54
2. System calls allow user-level processes to request some services from the operating system which process itself is not allowed to do.
55
15/12/2013
Examples
56
15/12/2013
15/12/2013
1. mkdir and rmdir are used to create and remove empty directories.
2. Link system call is used to allow the same file to appear under two or more names in different directories.
57
15/12/2013
Fig.a Two directories before linking /usr/jim/memo to ast's directory Fig.b The same directories after linking
Note: Every file in UNIX has a unique number called inumber which identifies the file
58