15/12/2013
COMPUTER SYSTEM & OPERATING SYSTEM OVERVIEW
1
LECTURE
OPERATING SYSTEM CONCEPTS
15/12/2013
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
Operating System Concepts
15/12/2013
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
What is a Computer System?
15/12/2013
COMPUTER SYSTEM STRUCTURE
15/12/2013
Computer System Structure
Hardware
Operating System
Programs
Users
5
COMPONENTS OF COMPUTER SYSTEM
15/12/2013
Computer system consists of hardware, system & application programs
15/12/2013
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
OPERATING SYSTEM EXAMPLES
15/12/2013
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
OPERATING SYSTEM TYPES
15/12/2013
Operating System Types
Embedded OS Palm OS Mainframe OS OS/360 Server OS PC OS
Distributed OS
Real-time OS VX Works, QNX
15
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
NETWORKING OPERATING SYSTEM
1. A Networking Operating System (NOS) runs on a server and enables the server to manage data, users, groups, security, applications, and other networking functions. 2. The network operating system is designed to allow shared file and printer access among multiple computers in a network, typically a local area network (LAN), a private network or to other networks. Examples Microsoft Windows Server 2003, Microsoft Windows Server 2008, UNIX, Linux, Mac OS, and Novell NetWare.
17
15/12/2013
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
BATCH PROCESSING SYSTEM
15/12/2013
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
BATCH PROCESSING SYSTEM
15/12/2013
Batch System Concept
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
Figure depicts the layout multiprogramming system.
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
INSTRUCTION FETCH AND EXECUTE
15/12/2013
1- Processor reads instructions from memory Fetches 2- Decoding-Encoding 3- Processor executes each instruction Execution
28
CONTROL REGISTERS
15/12/2013
Program Counter (PC)
Contains the address of an instruction to be fetched NEXT
Instruction Register (IR)
Contains the instruction most recently fetched
29
INSTRUCTION CYCLE
15/12/2013
30
PROGRAM COUNTER (PC)
The processor fetches the instruction from memory. Program counter (PC) holds address of the instruction to be fetched next. Program counter is incremented after each fetch.
15/12/2013
31
INSTRUCTION REGISTER (IR)
Fetched instruction is placed in the instruction register. The instructions contain bits that specify the action the processor is to take. The processor executes the instruction and performs the required action.
15/12/2013
32
PROCESSOR BRAIN OF COMPUTER
15/12/2013
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
Super scalar design
Present of multiple execution units Example b
33
15/12/2013
Ideal memory requirement
Extremely fast, abundantly large and cheap
Typical memory hierarchy
Register, internal memory in CPU Cache memory, mainly controlled by hardware Main memory, often called RAM (Random Accessed Memory) Magnetic disk, 2nd storage Magnetic tape, 2nd storage
34
STRUCTURE OF A DISK DRIVE
15/12/2013
-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
ISA (Industry Standard Architecture)
-Invented by IBM
-Runs at 8.33 MHz
-Transfer 2 bytes PCI (Peripheral Component Interconnect)
-Invented by INTL
-Runs at 66 MHZ -Transfer 8 bytes
37
15/12/2013
USB (Universal Serial Bus)
-Used for slow I/O devices -Share a single USB device driver -Can be attached without rebooting
SCSI (Small Computer System Interface)
-High performance for fast disks -Runs at 160MB/see
38
OS CONCEPTS
15/12/2013
1. 2. 3. 4. 5. 6.
Processes Deadlocks Memory management I/O Files Security
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.
Key process management operations
Process creation and termination A process can create one or more other processes, referred to as child processes
Process tree
A created two child processes, B and C B created three child processes, D, E, and F
40
15/12/2013
Following are some reasons for creation of a process
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
situation is called DEADLOCK.
44
DEADLOCK.
15/12/2013
Process A
Process B
R2 Denied R1 Granted R2 Denied R1 Granted
Deadlock
45
MEMORY MANAGEMENT
15/12/2013
Characteristics of Main Memory
1. It is a temporary storage device used to hold data temporary.
2. Main memory holds the programs and instructions which are currently being executed by the CPU.
3. It is the fast access storage device.
4. It is read and write memory. 5. It is a volatile memory.
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
OPERATING SYSTEM CONCEPTS-I/O
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.
3. Device drivers are specific to particular I/O devices.
51
OPERATING SYSTEM CONCEPTS-FILES
15/12/2013
Directory way of grouping files. Example, file system for a university department What will be the path of file CS101?
52
OPERATING SYSTEM CONCEPTS-MOUNTING FILE SYSTEM
15/12/2013
UNIX file system
Allow to attach file system on a floppy disk to be attached to the main tree (mounting) on the hard disk.
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.
After mounting floppy on b
files on floppy are part of file hierarchy
53
COMMUNICATION BETWEEN PROCESSES IN UNIX
15/12/2013
A pipe, a sort of pseudo file that can be used to connect two processes.
54
OPERATING SYSTEM CONCEPTS-SYSTEM CALL
1. System calls provide an interface between the process and the operating system.
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
System calls for Directory management
Link(/usr/jim/memo, usr/ast/note);
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