Скачать презентацию Introduction to OS Services Provided by OS Скачать презентацию Introduction to OS Services Provided by OS

8436250b27f2876d5db3fc249fb33c99.ppt

  • Количество слайдов: 65

Introduction to OS Introduction to OS

Services Provided by OS • • • Memory Management Program Execution Controlled Access to Services Provided by OS • • • Memory Management Program Execution Controlled Access to file Managing I/O Devices System Access Error Detection and Response Program Development Accounting and monitoring Providing Security

Different Types of OS § Mainframe OS. Eg z/ZTF § Server OS Eg. MS Different Types of OS § Mainframe OS. Eg z/ZTF § Server OS Eg. MS Windows Server 2008, UNIX, Linux § Network OS Eg. Cisco IOS, Router. OS § Multiprocessor OS § Personal OS

Different Types of OS § Handhelds Devices OS Eg. Android, Palm OS § Embedded Different Types of OS § Handhelds Devices OS Eg. Android, Palm OS § Embedded OS Eg. QNX, Vx. Works § Sensor Node OS Eg. Tiny. OS § Real Time OS Eg. E-Cos § Smart Card OS

Different Types of OS (Based on its working) • Single Programming OS • Multiprogramming Different Types of OS (Based on its working) • Single Programming OS • Multiprogramming OS • Multitasking OS / Time Sharing OS • Multiprocessor OS • Multiuser OS

HISTORY OF OPERATING SYSTEMS Operating systems have historically been closely tied to the architecture HISTORY OF OPERATING SYSTEMS Operating systems have historically been closely tied to the architecture of the computers on which they run. We will look at successive generations of computers to see what their operating systems were like.

The First Generation (1945 -55) The first ones used mechanical relays but were very The First Generation (1945 -55) The first ones used mechanical relays but were very slow, with cycle times measured in seconds. Relays were later replaced by vacuum tubes. These machines were enormous, filling up entire rooms with tens of thousands of vacuum tubes, but they were still millions of times slower than even the cheapest personal computers available today.

The Second Generation (1955 -65) Transistors and Batch Systems The introduction of the transistor The Second Generation (1955 -65) Transistors and Batch Systems The introduction of the transistor in the mid-1950 s changed the picture radically. For the first time, there was a clear separation between designers, builders, operators, programmers, and maintenance personnel

(The first mainframes were programmed in assembly language) These machines, now called mainframes, were (The first mainframes were programmed in assembly language) These machines, now called mainframes, were locked away in specially air conditioned computer rooms, with staffs of professional operators to run them. Only big corporations or major government agencies or universities could afford the multimillion dollar price tag. To run a job (i. e. , a program or set of programs), a programmer would first write the program on paper (in FORTRAN or assembler), then punch it on cards. He would then bring the card deck down to the input room and hand it to one of the operators and go drink coffee until the output was ready.

 • When the computer finished whatever job it was currently running, an operator • When the computer finished whatever job it was currently running, an operator would go over to the printer and tear off the output and carry it over to the output room, so that the programmer could collect it later.

Batch Systems • Given the high cost of the equipment, it is not surprising Batch Systems • Given the high cost of the equipment, it is not surprising that people quickly looked for ways to reduce the wasted time. The solution generally adopted was the batch system. • The idea behind it was to collect a tray full of jobs in the input room and then read them onto a magnetic tape using a small (relatively) inexpensive computer, • such as the IBM 1401, which was very good at reading cards, copying tapes, and printing output, but not at all good at numerical calculations. Other, much more expensive machines, such as the IBM 7094, were used for the real computing.

The Third Generation (1965 -1980) ICs and Multiprogramming • The 360 was the first The Third Generation (1965 -1980) ICs and Multiprogramming • The 360 was the first major computer line to use (small-scale) Integrated Circuits (ICs), thus providing a major price/performance advantage over the second-generation machines, which were built up from individual transistors. • It was an immediate success, and the idea of a family of compatible computers was soon adopted by all the other major manufacturers.

 • They also popularized several key techniques absent in second-generation operating systems. Probably • They also popularized several key techniques absent in second-generation operating systems. Probably the most important of these was multiprogramming. • Having multiple jobs safely in memory at once requires special hardware to protect each job against snooping and mischief by the other ones, but the 360 and other third-generation systems were equipped with this hardware. (diagram…. next page)

Multiprogramming Multiprogramming

 • Another major feature present in thirdgeneration operating systems was the ability to • Another major feature present in thirdgeneration operating systems was the ability to read jobs from cards onto the disk as soon as they were brought to the computer room. • Then, whenever a running job finished, the operating system could load a new job from the disk into the now-empty partition and run it. This technique is called spooling (from Simultaneous Peripheral Operation On Line) and was also used for output.

 • This desire for quick response time paved the way for timesharing, a • This desire for quick response time paved the way for timesharing, a variant of multiprogramming, in which each user has an online terminal. • In a timesharing system, if 20 users are logged in and 17 of them are thinking or talking or drinking coffee, the CPU can be allocated in turn to the three jobs that want service

The Fourth Generation (1980 Present) Personal Computers • With the development of LSI (Large The Fourth Generation (1980 Present) Personal Computers • With the development of LSI (Large Scale Integration) circuits, chips containing thousands of transistors on a square centimeter of silicon. • Where the minicomputer made it possible for a department in a company or university to have its own computer, the microprocessor chip made it possible for a single individual to have his or her own personal computer. • Engelbart invented the GUI (Graphical User Interface), pronounced “gooey, ” complete with windows, icons, menus, and mouse.

 • OS user friendly, meaning that it was intended for users who not • OS user friendly, meaning that it was intended for users who not only knew nothing about computers but furthermore had absolutely no intention whatsoever of learning.

Magnetic Disks • They use magnetization process to read and write data. • Multiple Magnetic Disks • They use magnetization process to read and write data. • Multiple disks are covered with magnetic coating. • These are used for storing data permanently.

Magnetic Disks • Magnetic disks are as they have mechanical devices. • Disks rotate Magnetic Disks • Magnetic disks are as they have mechanical devices. • Disks rotate at 540010800 rpm. • Data is written in concentric circles called tracks which are divided into sectors.

Magnetic Tapes • Used to back up data externally. • Large data at low Magnetic Tapes • Used to back up data externally. • Large data at low prices. • Very slow storage devices.

READ ONLY MEMORY (ROM) • Can only read but not update data on ROM. READ ONLY MEMORY (ROM) • Can only read but not update data on ROM. • Non volatile memory. • ROM stores such instruction that are used to start computer. • This instruction is called as bootstrap. • Bootstrap is a program that initializes OS during start up. This process is called as bootstrapping.

Types of ROM • Masked ROM • PROM • EEROM Types of ROM • Masked ROM • PROM • EEROM

CMOS(Complementary Metal oxide Semiconductor) • Used for storing current date and time. • Volatile CMOS(Complementary Metal oxide Semiconductor) • Used for storing current date and time. • Volatile so needs battery to store data all the time. • Previously BIOS settings were stored in CMOS.

Booting Process Six Steps involved in booting process: 1)BIOS(Basic Input/Output System): • Performs some Booting Process Six Steps involved in booting process: 1)BIOS(Basic Input/Output System): • Performs some integrity checks(Power on Self Test). • Searches, loads and executes primary boot loader.

Booting Process 2)Master boot record: • This is generally stored in 1 st sector Booting Process 2)Master boot record: • This is generally stored in 1 st sector of bootable disks. • Size is less than 512 bytes. • Contains information about partition table. • MBR loads and executes GRUB loader.

Booting Process 3)GRUB Loader: • It is multiboot loader which displays list of kernels Booting Process 3)GRUB Loader: • It is multiboot loader which displays list of kernels for few seconds. • It loads init function of kernel in RAM.

Booting Process 4)Kernel: • Kernel executes init function of OS and it then acts Booting Process 4)Kernel: • Kernel executes init function of OS and it then acts as mediator between hardware and software. 5)Init: • Init function then loads remaining part of OS into RAM.

Booting Process 6)Run Level Programs: • Depending on our configuration other programs will get Booting Process 6)Run Level Programs: • Depending on our configuration other programs will get executed. • For Eg. Antivirus.

I/O Devices • Consists of 2 parts: —Controller —Device itself I/O Devices • Consists of 2 parts: —Controller —Device itself

I/O Devices • 3 ways to make drivers as part of OS: —Install driver I/O Devices • 3 ways to make drivers as part of OS: —Install driver and reboot. —Make entry in OS file and reboot. —Linking OS and driver while running system.

3 ways to access data from I/O 1)I/O Polled 2)Interrupt Driven 3)DMA (direct memory 3 ways to access data from I/O 1)I/O Polled 2)Interrupt Driven 3)DMA (direct memory access)

I/O Polled • I/O system call is transferred to appropriate driver by operating system. I/O Polled • I/O system call is transferred to appropriate driver by operating system. • Driver then instructs device controller about the same and sits in tight loop continuously polling the device controller to see if it is done. • This method is called busy-waiting. • Disadvantage: CPU is used in continuously polling.

Interrupt Driven I/O • Device controller copies data from device to device controller buffer. Interrupt Driven I/O • Device controller copies data from device to device controller buffer. • Interrupts processor to transfer data from buffer to RAM.

Interrupt • An interrupt is a signal to the processor emitted by hardware or Interrupt • An interrupt is a signal to the processor emitted by hardware or software indicating an event that needs immediate attention.

DMA (Direct Memory Access • DMA Controller are special devices used to perform I/O DMA (Direct Memory Access • DMA Controller are special devices used to perform I/O operation without intervention of processor.

Buses • Total 8 buses. Buses • Total 8 buses.

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

System Call System Call

Different Views of Operating System 1)OS as Extended Machine • Complex architecture. • Not Different Views of Operating System 1)OS as Extended Machine • Complex architecture. • Not possible for users to track location of files at hardware level. • Operating System provides a simple, high level abstraction such that these devices contain a collection of named files. • Operating System provides a set of basic commands such as read, write, modify, open or close.

Different Views of Operating System 1)OS as Extended Machine • The function of the Different Views of Operating System 1)OS as Extended Machine • The function of the OS is to present the user machine that is easier to work with than the underlying hardware.

Different Views of Operating System 2)OS as Resource Manager: • As a resource manager, Different Views of Operating System 2)OS as Resource Manager: • As a resource manager, Operating system provides controlled allocation of the processors, memories, I/O devices among various programs. • Keep the track of which programs are using which resources, to grant resource requests, to account for usage, and to resolve conflicting requests. • An Operating System is a control program. A control program controls the execution of user programs to prevent errors and improper use of computer.

OS Architecture 1) Monolithic system In this approach the entire operating system runs as OS Architecture 1) Monolithic system In this approach the entire operating system runs as a single program in kernel mode.

OS Architecture 2)Layered System: • In this system, operating system is organized as a OS Architecture 2)Layered System: • In this system, operating system is organized as a hierarchy of layers, each one constructed upon the one below it as shown below in figure.

OS Architecture 2)Layered System: • The first system constructed in this way was the OS Architecture 2)Layered System: • The first system constructed in this way was the “THE system”. • This layering concept was also present in the MULTICS(Multiplexed Information and Computing Services) system.

Microkernels • • • Small number of processes are allowed in the kernel. Minimizes Microkernels • • • Small number of processes are allowed in the kernel. Minimizes effects of bugs. Don’t want bug in driver to crash system. Examples of microkernel are Integrity, K 42, L 4, Pike. OS, QNX, Symbian, and MINIX 3. One interesting server is the reincarnation server, whose job is to check if the other servers and drivers are functioning correctly. In the event that a faulty one is detected, it is automatically replaced without any user intervention.

Microkernels Structure of the MINIX 3 system. Microkernels Structure of the MINIX 3 system.

Client Server Model • A slight variation of the microkernel idea is to distinguish Client Server Model • A slight variation of the microkernel idea is to distinguish two classes of processes, firstly servers, which provides some service, and the clients, which use these services. This model is known as the clientserver model.

Virtual Machines: • • • The initial releases of OS/360 were strictly batch systems. Virtual Machines: • • • The initial releases of OS/360 were strictly batch systems. z/VM was developed , which is now widely used on IBM’s current mainframes, the z. Series, which are heavily used in large corporate data centers. VM/370, this system, originally called CP/CMS and later renamed VM/370.

Virtual Machines: • • The heart of the system, known as the virtual machine Virtual Machines: • • The heart of the system, known as the virtual machine monitor, runs on the bare hardware and does the multiprogramming, providing not one, but several virtual machines to the next layer up. They are exact copies of the bare hardware, including kernel/user mode, I/O, interrupts, and everything else the real machine has.

Virtual Machines: • Many companies have traditionally run their mail servers, Web servers, FTP Virtual Machines: • Many companies have traditionally run their mail servers, Web servers, FTP servers. . They see virtualization as a way to run them all on the same machine without having a crash of one server bring down the rest. • Besides VMware and Xen, popular hypervisors today include KVM (for the Linux kernel), Virtual. Box (by Oracle), and Hyper-V (by Microsoft).

Exokernels: • • • Rather than cloning (copying) the actual machine, as is done Exokernels: • • • Rather than cloning (copying) the actual machine, as is done with virtual machines, another strategy is partitioning it. Exokernels job is to allocate resources to virtual machines and to make sure no machine is trying to use somebody else’s resources. The advantage of the exokernel scheme is that it saves a layer of mapping.

System call for process management • Fork is a most widely used as system System call for process management • Fork is a most widely used as system call for process management in unix. • Creates exact duplicate copy of original process including all the file variables, registers— everything. • Fork() takes no arguments and returns a process ID.

Working of fork system call • Fork System call returns either of 3 different Working of fork system call • Fork System call returns either of 3 different values: —+ve value to parent process that indicates process id of newly created child process. —-ve value that indicates unsuccessful to creat child process. —Zero to child process.

Working of fork system call • If the call to fork() is executed successfully, Working of fork system call • If the call to fork() is executed successfully, Unix will make two identical copies of address spaces, one for the parent and the other for the child. • Both processes will start their execution at the next statement following the fork() call.

Working of fork system call Working of fork system call

Working of fork system call Working of fork system call

Mounting file system • The mount command mounts a storage device or file system, Mounting file system • The mount command mounts a storage device or file system, making it accessible and attaching it to an existing directory structure.

Special files in unix • Another important concept in UNIX is the special file. Special files in unix • Another important concept in UNIX is the special file. Special files are provided in order to make I/O devices look like files. That way, they can be read and written using the same system calls as are used for reading and writing files. • Two kinds of special files exist: block special files and character special files. • Block special files are used to model devices that consist of a collection of randomly addressable blocks, such as disks. By opening a block special file and reading, say, block 4, a program can directly access the fourth block on the device, without regard to the structure of the file system contained on it.

Special files in unix Character special files are used to model printers, modems, and Special files in unix Character special files are used to model printers, modems, and other devices that accept or output a character stream. By convention, the special files are kept in the /dev directory. For example, /dev/lp might be the line printer.

Pipe in unix • The last feature we will discuss in this overview is Pipe in unix • The last feature we will discuss in this overview is one that relates to both processes and files: pipes. • A pipe is a sort of pseudofile that can be used to connect two processes, as shown below. If processes A and B wish to talk using a pipe, they must set it up in advance. When process A wants to send data to process B, it writes on the pipe as though it were an output file. Process B can read the data by reading from the pipe as though it were an input file.

Protection of files in OS • Files in UNIX are protected by assigning each Protection of files in OS • Files in UNIX are protected by assigning each one a 9 -bit binary protection code. • The protection code consists of three 3 -bit fields, one for the owner, one for other members of the owner’s group and one for everyone else. • For example, the protection code rwx r-x —x.

UID and GID • Each person authorized to use a system is assigned a UID and GID • Each person authorized to use a system is assigned a UID (User IDentification ) by the system administrator. • Every process/file has the UID of the person who started/created it. • Users can be members of groups, each of which has a GID (Group IDentification ). • One UID, called the superuser (in UNIX), has special power.

Shell • It is also the primary interface between a user sitting at his Shell • It is also the primary interface between a user sitting at his terminal and the operating system. • • • Bourne shell (sh) C shell (csh) TC shell (tcsh) Korn shell (ksh) Bourne Again shell (bash)