introduction to operating systems summer semester 2013 intro to os, lecture 1 by rana umer

79
INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Upload: ami-lloyd

Post on 19-Jan-2016

228 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

INTRODUCTION TO OPERATING SYSTEMS

Summer Semester 2013

Intro To OS, Lecture 1 By Rana Umer

Page 2: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Rana Umer AzizMSc.IT (London, UK)

Contact No. 0335-919 [email protected]

Intro To OS, Lecture 1 By Rana Umer

Page 3: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

EDUCATION CONSULTANT

Contact No. 0335-919 7775,0321-515 3403

www.oeconsultant.co.uk

Intro To OS, Lecture 1 By Rana Umer

Page 4: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

BookMODERN OPERATING SYSTEMSThird Edition ByANDREW S. TANENBAUM

Course Outline• Introduction• Processes & Threads• Memory Management• File Systems• Input / Output• Deadlocks• Multimedia Operating Systems• Multiple Processor Systems• Case Study 1: LINUX• Case Study 2: Windows Vista

Intro To OS, Lecture 1 By Rana Umer

Page 5: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Outline

• What is an operating system• The history of Operating System• Hardware of operating system• Important concepts of Operating System

Intro To OS, Lecture 1 By Rana Umer

Page 6: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

What is an operating system• 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

Intro To OS, Lecture 1 By Rana Umer

Page 7: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

A modern computer consists of:• One or more processors• Main memory• Disks• Printers• Various input/output devices

Managing all these components requires a layer of software – the operating system

Intro To OS, Lecture 1 By Rana Umer

Operating System

Page 8: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

• A modern computer is very complex. – Networking– Disks– Video/audio card

• It is impossible for every application programmer to understand every detail

• A layer of computer software is introduced to provide a better, simpler, cleaner model of the resources and manage them

Intro To OS, Lecture 1 By Rana Umer

Operating System

Page 9: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Operating System

Intro To OS, Lecture 1 By Rana Umer

Page 10: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

• Users use various OS– Windows, Linux, Mac OS etc.

• User interacts with shell or GUI (Graphical User Interface )

Intro To OS, Lecture 1 By Rana Umer

Operating System

Page 11: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Operating System• On top of hardware is OS• Most computers have two modes of

operation:– Kernel mode and user mode– OS runs in kernel mode, which has complete

access to all hardware and can execute any instruction

– Rest of software runs in user mode, which has limited capability

– Shell or GUI is the lowest level of user mode software

Intro To OS, Lecture 1 By Rana Umer

Page 12: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Operating System• The kernel is the main component of most computer operating

systems it is a bridge between applications and the actual data processing done at the hardware level. The kernel's responsibilities include managing the system's resources (the communication between hardware and software components).

Intro To OS, Lecture 1 By Rana Umer

Page 13: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

The Operating System as an Extended Machine

Intro To OS, Lecture 1 By Rana Umer

Page 14: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

As an Extended Machine

• Abstraction:– CPU—process– Storage –- files– Memory– address space

• 4 types of people:– Industrial engineer: design hardware– Kernel designer– Application programmer: OS’s user– End users

Intro To OS, Lecture 1 By Rana Umer

Page 15: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

The Operating System as a Resource Manager

• Allow multiple programs to run at the same time• Manage and protect memory, I/O devices, and other

resources• Includes multiplexing (sharing) resources in two

different ways: • In time• In space

Intro To OS, Lecture 1 By Rana Umer

Page 16: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

As Resource Manager

• Modern OS runs multiple programs of multiple users at the same time– Imagine what would happen if several programs

want to print at the same time?– How to account the resource usage of each

process?– Resources can be multiplexed:

• How to ensure fairness and efficiency?

Intro To OS, Lecture 1 By Rana Umer

Page 17: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

History of Operating Systems

Generations:

• First Generation (1945–55) Vacuum Tubes• 2nd Generation (1955–65) Transistors and Batch

Systems• 3rd Generation(1965–1980) ICs and

Multiprogramming• 4th Generation(1980–Present) Personal Computers• 5th Generation (Artificial Intelligence)

Intro To OS, Lecture 1 By Rana Umer

Page 18: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

First Generation (1945–55) Vacuum Tubes• Large and slow• Engineers design, build, operate and maintain

the computer• All programming is done with machine

language, or by wiring circuits using cables• Insert Plugboards into the computer and

operate• The work is mainly numerical calculations

Intro To OS, Lecture 1 By Rana Umer

Page 19: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

First Generation (1945–55) Vacuum Tubes

Intro To OS, Lecture 1 By Rana Umer

Page 20: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

2nd Generation (1955–65) Transistors and Batch

• Electronic component transistors introduce in 1950.• Assembly language was used for programming.• Low cost & Small size then First Generation Computer.• Also called mainframes• Computers are managed by professional operators• Punch card used as input (Batch System) (IBM 1401)• For scientific & engineering calculation they were start

using FORTRAN & Assembly languages.• OS were FMS (Fortran Monitor System)

Intro To OS, Lecture 1 By Rana Umer

Page 21: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

2nd: Transistors and Batch Systems

• (a) Programmers bring cards to 1401.• (b)1401 reads batch of jobs onto tape. • (c) Operator carries input tape to IBM 7094 (Real computing).• (d) 7094 does computing. • (e) Operator carries output tape to 1401. (f) 1401 prints output.

Intro To OS, Lecture 1 By Rana Umer

Page 22: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Figure 1-4. Structure of a typical FMS job.Intro To OS, Lecture 1 By Rana Umer

Compiler

Page 23: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

• IC (Integrated Circuit) Technology was used • Magnetic Disk was used for storage.• High level language used very commonly• Input / Output devices start using.• OS/360: a dinosaur stuck in a tar pit

– Aims to adapts IBM (1401/7904) Functionality, covers all trades of life (Replaced IBM 1401/7904)

– However, OS/360 introduces several key techniques• Multi-programming: solve the problem of CPU idling• Spooling: simultaneous peripheral operation on line

– Whenever a job finishes, OS load a new job from disk to the empty-partition

Intro To OS, Lecture 1 By Rana Umer

3rd Generation(1965–1980) ICs and Multiprogramming

Page 24: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

A multiprogramming system with three jobs in memory.

Intro To OS, Lecture 1 By Rana Umer

3rd Generation(1965–1980) ICs and Multiprogramming

Page 25: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Intro To OS, Lecture 1 By Rana Umer

3rd Generation(1965–1980) ICs and Multiprogramming

Page 26: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

• Problems:– 3rd generation OS was well suited for big scientific

calculations and massive data processing– Not be able to debug quickly….

Intro To OS, Lecture 1 By Rana Umer

3rd Generation(1965–1980) ICs and Multiprogramming

Page 27: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

• Computers have performance similar to 3rd generation

• Micro Chip was introduced. (Intel Made the chip in 1971 which was capable to control processing unit.)

• CP/M(Control Program for Microcomputer)– First disk-based OS

• 1980, IBM PC, Basic Interpreter, DOS, MS-DOS• GUI--Lisa—Apple: user friendly• MS-DOS with GUI– Win95/98/me—winNT/xp…Intro To OS, Lecture 1 By Rana Umer

4th Generation(1980–Present) Personal Computers

Page 28: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

• Fifth generation computers are in developmental stage .

• Based on the artificial intelligence. • The goal of the fifth generation is to

develop the device which could respond to natural language input and are capable of learning and self-organization.

• We can say that the fifth generation computers will have the power of human intelligence.

Intro To OS, Lecture 1 By Rana Umer

5th Generation (Artificial Intelligence)

Page 29: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Intro To OS, Lecture 1 By Rana Umer

History of Computer Generations

Page 30: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

The Operating Systems

• Mainframe operating systems(Batch, Transaction & Timesharing Processing)

• Server operating systems• Multiprocessor operating systems• Personal computer operating systems• Handheld operating systems (PDA..) • Embedded operating systems (TV, Mobiles..) • Sensor node operating systems• Real-time operating systems

(Hard & Soft Real-Time Systems)

• Smart card operating systems (Cradit Cards)Intro To OS, Lecture 1 By Rana Umer

Page 31: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Assignment # 1

• What is an operating system? List some differences of all Operating Systems?

Intro To OS, Lecture 1 By Rana Umer

Page 32: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Computer Hardware

Some of the components

of a simple personal computer.

Intro To OS, Lecture 1 By Rana Umer

Page 33: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Hardware: Processor• Brain of computer

– Fetches instruction from memory and execute– Cycle of CPU:

• fetch, decode, execute– CPU has General Registers to store variable and

temporary result: load from memory to register; store from register to memory

– Program counter Register: next instruction memory address to fetch

– Stack pointer Register: the top of the current stack

Intro To OS, Lecture 1 By Rana Umer

Page 34: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Hardware: Processor– PSW Register (Program Status Word), priority,

mode… – The program status word (PSW) is 32 bits in length

and contains the information required for proper program execution.

– The PSW includes the instruction address, condition code, and other fields. In general, the PSW is used to control instruction sequencing and to hold and indicate the status of the system in relation to the program currently being executed.

Intro To OS, Lecture 1 By Rana Umer

Page 35: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

CPU Pipeline

• Accelerate the execution

Intro To OS, Lecture 1 By Rana Umer

(a) A three-stage pipeline. (b) A superscalar CPU.

Page 36: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

A typical memory hierarchy. The numbers are very rough approximations.

Memory

Intro To OS, Lecture 1 By Rana Umer

Page 37: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

• Memory is where computer fetch and store data, ideally, it should be both chip/Registers

• The best people can do, is to construct a memory hierarchyRegisters• The top layer consists of the registers internal to the CPU.

They are made of the same material as the CPU and are thus just as fast as the CPU.

• The storage capacity available in them is typically 32 x 32-bits on a 32-bit CPU and 64 x 64-bits on a 64-bit CPU. Less than 1 KB in both cases.

• Programsmust manage the registers (i.e., decide what to keep in them) themselves, in software.

Intro To OS, Lecture 1 By Rana Umer

Memory

Page 38: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

• Cache lines:– Memory divided into cache lines

• Cache hit (reports the number of times that a needed page was found in the data cache)

• Cache misses( reports the number of times that a needed page was not found in the cache and had to be read from disk )– Cache: whenever there is disparity in usage or

speed; used to improve performance

Intro To OS, Lecture 1 By Rana Umer

Memory

Page 39: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

• Main memory comes next. This is the workhorse of the memory system. Main memory is often called RAM (Random Access Memory).

• All CPU requests that cannot be satisfied out of the cache go to main memory.

Intro To OS, Lecture 1 By Rana Umer

Memory

Page 40: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

• Next in the hierarchy is Magnetic Disk (Hard Disk). • Cheap and larger than RAM• Slower than RAM• Mechanical movement to fetch data• One or more platter—rotate– rpm• Information is stored on concentric circles• Arm, track, cylinder, sector• Disk helps to implement Virtual Memory

– When no enough memory is available, disks are used as the storage, and memory as cache

Intro To OS, Lecture 1 By Rana Umer

Memory

Page 41: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

• Disk platters are formatted in a system of concentric circles, or rings, called tracks.

• Within each track are sectors, which subdivide the circle into a system of arcs, each formatted to hold the same amount of data—typically 512 bytes.

• Cylinders are the system of identical tracks on multiple platters within the drive. The multiple arms of a drive move together in lockstep, positioning the heads in the same relative location on all platters simultaneously.

Intro To OS, Lecture 1 By Rana Umer

Memory

Page 42: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Structure of a disk drive.

Hard Disks

Intro To OS, Lecture 1 By Rana Umer

Page 43: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

The final layer in the memory hierarchy is Magnetic Tape. • This medium is often used as a backup for disk

storage and for holding very large data sets. • To access a tape, we must have tape reader • Then the tape may have to be spooled forwarded to

get to the requested block.• The big plus of tape is that it is exceedingly cheap

per bit and removable, which is important for backup tapes that must be stored off-site in order to survive fires, floods, earthquakes , etc.

Intro To OS, Lecture 1 By Rana Umer

Memory

Page 44: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Intro To OS, Lecture 1 By Rana Umer

Memory

Page 45: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

I/O Devices

Intro To OS, Lecture 1 By Rana Umer

I/O devices can be roughly categorized as • Storage• Communications• User-interface, and other

• Devices communicate with the computer via signals sent over wires or through the air (Wireless).

• Devices connect with the computer via ports, e.g. a serial or parallel port.

• A common set of wires connecting multiple devices is termed a bus.

Page 46: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

I/O Devices

Intro To OS, Lecture 1 By Rana Umer

• I/O devices generally consist of two parts: • Controller • The Device itself

• Controller The controller is a chip or a set of chips on a

plug-in board that physically controls the device. It accepts commands from the operating system.

The software that talks to a controller, giving it commands and accepting responses, is called a Device Driver.

Page 47: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

I/O Devices

Intro To OS, Lecture 1 By Rana Umer

Input and output can be done in three different ways.• Simplest method, a user program issues a System Call.• System Call, Call the kernel then translates into a

procedure call to the appropriate driver. • The driver then starts the I/O and sits in a tight loop

continuously polling the device to see if it is done• When the I/O has completed, the driver puts the data

where they are needed (if any), and returns .• The operating system then returns control to the caller. • This method is called busy waiting and has the

disadvantage of tying up the CPU polling the device until it is finished.

CPU Involve

Page 48: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

I/O Devices

Intro To OS, Lecture 1 By Rana Umer

• The second method is for the driver to start the device and ask it to give an interrupt when it is finished.

• At that point the driver returns. The operating system then blocks the caller if need be and looks for other work to do.

• When the controller detects the end of the transfer, it generates an interrupt to signal completion.

Interrupts are very important in operating systems

Page 49: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

I/O Devices

Intro To OS, Lecture 1 By Rana Umer

• The third method for doing I/O makes use of a special DMA (Direct Memory Access) special processor.

• Chip that can control the flow of bits between memory and some controller without constant CPU involvement.

• The CPU sets up the DMA chip• How many bytes to transfer.• The device and memory addresses involved.• The direction and lets it go.

• When the DMA chip is done, it causes an interrupt.

Page 50: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

I/O Devices

Intro To OS, Lecture 1 By Rana Umer

• For devices that transfer large quantities of data ( such as disk controllers ), it is wasteful to tie up the CPU transferring data in and out of registers one byte at a time.

• Instead this work can be off-loaded to a special processor, known as the Direct Memory Access, DMA, Controller.

• The DMA controller handles the data transfer, and then interrupts the CPU when the transfer is complete.

• A simple DMA controller is a standard component in modern PCs, and many bus-mastering (The bus master is the program which is the "master" and the I/O devices on the bus are the "slaves."  The bus master actually a program which controls the bus paths on which the address and control signals flow.) I/O cards contain their own DMA hardware.

• Handshaking between DMA controllers and their devices is accomplished through two wires called the DMA-request and DMA-acknowledge wires.

Page 51: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

I/O Devices

Intro To OS, Lecture 1 By Rana Umer

• A common set of wires connecting multiple devices is termed a bus.

Buses include rigid protocols for the types of messages that can be sent across the bus and the procedures for resolving contention issues

System have two types of Buses• Internal bus ( local bus )• External bus ( Expansion Bus ).

Page 52: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

I/O Devices

Intro To OS, Lecture 1 By Rana Umer

Internal bus (local bus)• Internal bus, also known as internal data bus, memory bus

or system bus or front-Side-Bus, connects all the internal components of a computer, such as CPU and memory, to the motherboard.

• This bus is typically rather quick and is independent of the rest of the computer operations.

Page 53: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

I/O Devices

Intro To OS, Lecture 1 By Rana Umer

External bus ( Expansion Bus)The external bus connect the different external devices, such as printer, mouse, keyboard etc., to the computer.

Page 54: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Booting the Computer• BIOS—basic input/output system

– On the Motherboard, low-level I/O software– Checks RAM, keyboard and other basic devices– Determine the boot device: floppy, CD-ROM, disk– First sector of the boot-device is read into memory– The sector contains program to check which Disk

partition is active– Then a secondary boot-loader is read into memory

and reads in operating system from the active Disk partition

Intro To OS, Lecture 1 By Rana Umer

Page 55: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

• Processes• Deadlocks • Memory Management• Input / Output• Files• Security • The shell• Recycling of Concepts

Operating System Concepts

Intro To OS, Lecture 1 By Rana Umer

Page 56: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

• A key concept in all operating systems is the process.

• A process is basically a program in execution. • Associated with each process is its address

space, a list of memory– Other resources like: registers, files, alarms,

related processes, and other information– A process is fundamentally a container that holds

information for a program to runIntro To OS, Lecture 1 By Rana Umer

Operating System Concepts

Processes

Page 57: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

• A Deadlock occurs when two or more tasks permanently block each other by each task having a lock on a resource which the other tasks are trying to lock.

Intro To OS, Lecture 1 By Rana Umer

Operating System Concepts

DeadLocks

Page 58: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

• Memory management is the process of controlling and coordinating computer memory, assigning portions called blocks to various running programs to optimize overall system performance.

• Memory management resides in hardware, in the OS (operating system), and in programs and applications.

Intro To OS, Lecture 1 By Rana Umer

Operating System Concepts

Memory Management

Page 59: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

• All computers have physical devices for acquiring input and producing output.

• Every operating system has an I/O subsystem for managing its I/O devices.

• Some of the I/O software is device independent, means, applies to many or all I/O devices equally well.

• Other parts of it, such as device drivers, are specific to particular I/O devices.

Intro To OS, Lecture 1 By Rana Umer

Operating System ConceptsInput / Output

Page 60: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

• Another key concept supported by virtually all operating systems is the file system.

• Major function of the operating system is to hide the peculiarities (unusual characteristic) of the disks and other I/O devices and present the programmer with a nice, clean abstract model of device-independent files.

• System calls are obviously needed to create files, remove files, read files, and write files. Before a file can be read, it must be located on the disk and opened, and after it has been read it should be closed, so calls are provided to do these things.

Intro To OS, Lecture 1 By Rana Umer

Operating System ConceptsFiles

Page 61: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Before mounting, the files on the CD-ROM are not accessible

Intro To OS, Lecture 1 By Rana Umer

Operating System ConceptsFiles

Page 62: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

• Computers contain large amounts of information that users often want to keep confidential.

• This information may include electronic mail, business plans, tax returns, and much more.

• It is up to the operating system to manage the system security so that files, for example, are only accessible to authorized users.

Intro To OS, Lecture 1 By Rana Umer

Operating System ConceptsSecurity

Page 63: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

• The shell has the terminal as standard input and standard output. It starts out by typing the prompt, a character

OR• A shell is software that provides an interface for users of

an operating system to access the services of a kernel

Intro To OS, Lecture 1 By Rana Umer

Operating System ConceptsShell

Page 64: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

• Multiprogramming is a elementary form of parallel processing in which several programs are run at the same time on a uniprocessor.

• The operating system executes part of one program, then part of another, and so on. To the user it appears that all programs are executing at the same time.

Intro To OS, Lecture 1 By Rana Umer

Multiprogramming

Page 65: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Intro To OS, Lecture 1 By Rana Umer

Memory Protection

• Memory protection is a way to control memory access rights on a computer, and is a part of most modern operating systems.

• The main purpose of memory protection is to prevent a process from accessing memory that has not been allocated to it

Page 66: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Intro To OS, Lecture 1 By Rana Umer

Multitasking

• The ability to execute more than one task at the same time, a task being a program.

• The terms multitasking and multiprocessing are often used interchangeably, although multiprocessing implies that more than one CPU is involved.

• In multitasking, only one CPU is involved, but it switches from one program to another so quickly that it gives the appearance of executing all of the programs at the same time.

Page 67: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Intro To OS, Lecture 1 By Rana Umer

Multitasking

• There are two basic types• Preemptive • Cooperative.

• In Preemptive Multitasking, the operating system parcels out CPU time slices to each program.

• In Cooperative Multitasking, each program can control the CPU for as long as it needs it. If a program is not using the CPU, however, it can allow another program to use it temporarily.

Page 68: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Intro To OS, Lecture 1 By Rana Umer

Timesharing

• Time sharing operating system is a operating system in which available CPU time is divided into equal slots.

• These slots are assigned to all the users connected to the system. any user can use the system only for the specified time slot. if he finishes his work within the given time slot, that's fine but if he still got some work pending then he will again wait for his turn to complete the remaining work.

• The time slots of CPU are distributes to all the connected users in first come first serve basis and then their turn comes in round robin fashion.

• Time sharing operating system are used when a powerful server computer serves several client computers.

Page 69: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Intro To OS, Lecture 1 By Rana Umer

System Calls

• Operating systems contain sets of routines for performing various low-level operations.

• If you want to execute an operating system routine from a program, you must make a system call.(System Call not only transfer the control but it transfer the privileges)

• The interface between the operating system and the user programs is defined by the set of system calls that the operating system provides.

• The system calls available in the interface vary from OS to OS (What & How to do) (although the underlying concepts tend to be similar).

• Only System Calls enter the kernel and Procedure Calls do not

Page 70: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Intro To OS, Lecture 1 By Rana Umer

System Calls

System Calls could be….• System Calls for Process Management• System Calls for file Management• System Calls for Directory Management• Miscellaneous System Calls (Change the name of file/Directory etc.)

• The Windows Win32 API (Application Program Interface)

Process Status Word Register (PSW)

Page 71: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Intro To OS, Lecture 1 By Rana Umer

OS Structure (Inside)

It is time to take a look inside…• They give an idea of some designs that have been tried in

practice.• In order to get some idea of the spectrum of possibilities

The Five Designs Approaches we discuss here1. Monolithic Systems2. layered Systems3. Virtual Machines4. Exokernels5. Client-Server Systems.

Page 72: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Intro To OS, Lecture 1 By Rana Umer

OS Structure (Inside)

Monolithic Systems (Procedure System)-- “The BigMess.”• Monolithic architecture, in which functionally

distinguishable aspects are not architecturally separate components but are all interwoven.

• The operating system is written as a collection of procedures, each of which can call any of the other ones whenever it needs to.

• This technique is used interface in terms of parameters and results, and each one is free to call any other one.

Page 73: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Intro To OS, Lecture 1 By Rana Umer

OS Structure (Inside)

Monolithic Systems Basic Structure is…

• A Main Program that invokes the requested service procedure.

• A Set Of Service procedures that carry out the system calls.

• A Set Of Utility procedures that help the service procedures.

Page 74: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Intro To OS, Lecture 1 By Rana Umer

OS Structure (Inside)

Monolithic Systems Basic Structure is…

Page 75: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Intro To OS, Lecture 1 By Rana Umer

OS Structure (Inside)Layered Systems (Batch System)• In this approach organize the operating system as a

hierarchy of six layers. (Netherland 1968)

( System Operator )

( Application )

Page 76: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Intro To OS, Lecture 1 By Rana Umer

OS Structure (Inside)Virtual MachineThe virtual machine typically emulates a physical computing environment, but requests for CPU, memory, hard disk, network and other hardware resources are managed by a virtualization layer which translates these requests to the underlying physical hardware.• OS/360 (Problem is multiuser)• VM (often: VM/CMS) is a family of IBM virtual machine

operating systems used on IBM mainframes System/370, System/390 ..etc

• The first version, released in 1972, was VM/370, or officially Virtual Machine Facility/370.

• So on till date…..• JVM (Java Virtual Machine). The Java compiler produces code for

JVM, which then typically is executed by a software JVM interpreter

Page 77: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Intro To OS, Lecture 1 By Rana Umer

OS Structure (Inside)Exokernels• Going one step further, researchers have built a system that gives

each user a clone of the actual computer, but with a subset of the resources (Thus one virtual machine might get disk blocks 0 to 1023, the next one might get blocks 1024 to 2047, and so on.)

• At the bottom layer, running in kernel mode, is a program called the exokernel.– Its job is to allocate resources to virtual machines and then

check attempts to use them to make sure no machine is trying to use somebody else’s resources.

– Each user-level virtual machine can run its own operating system, except that each one is restricted to using only the resources.

Page 78: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Intro To OS, Lecture 1 By Rana Umer

OS Structure (Inside)Exokernels

– With the exokernel, Virtual machine monitor maintain tables remapping is not needed.

– The exokernel need only keep track of which virtual machine has been assigned which resource.

Page 79: INTRODUCTION TO OPERATING SYSTEMS Summer Semester 2013 Intro To OS, Lecture 1 By Rana Umer

Intro To OS, Lecture 1 By Rana Umer

OS Structure (Inside)Client Server Model• To request a service, sends the request to a server

process, which then does the work and sends back the answer.