Operating System.word.docx

  • Uploaded by: linu
  • 0
  • 0
  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Operating System.word.docx as PDF for free.

More details

  • Words: 3,552
  • Pages: 16
OPERATING SYSTEM MODULE 1 Operating system • An operating system is a program that manages the computer hardware. It also provides a basis for application programs and acts as an intermediary between the computer user and the computer hardware  Resource allocator  Manager-memory,process,files,security,ect.. • Goals:  Primary Goal: Convenience  Secondary Goal: Efficiency Computer System Structure  Computer system can be divided into four components:  Hardware – provides basic computing resources CPU, memory, I/O devices  Operating system Controls and coordinates use of hardware among various applications and users  Application programs – define the ways in which the system resources are used to solve the computing problems of the users Word processors, compilers, web browsers, database systems, video games  Users People, machines, other computers

Four Components of a computer system

Operating systems from two viewpoints: user and system. User View • Users want convenience, ease of use and good performance • Don’t care about resource utilization • User sits at a terminal connected to a mainframe or minicomputer- Other users are accessing the same computer through other terminals. • These users share resources and may exchange information. operating system in such cases is designed to maximize resource utilization • Users sit at workstations connected to networks of other workstations and servers. • These users have dedicated resources at their disposal, but they also share resources such as networking and servers—file,compute, and print servers. • Therefore, their operating system is designed to compromise between individual usability and resource utilization. • Some computers have little or no user view. • For example, embedded computers in home devices and automobiles. System View • OS is a resource allocator • Manages all resources • Decides between conflicting requests for efficient and fair resource use • OS is a control program Controls execution of programs to prevent errors and improper use of the computer

Functions of an operating System • Memory Management • Processor Management • Device Management • File Management • Security • Control over system performance • Job accounting • Error detecting aids • Coordination between other software and users Memory Management  Memory management refers to management of Primary Memory or Main Memory. • Keeps tracks of primary memory, i.e., what part of it are in use by whom, what part are not in use.

• In multiprogramming, the OS decides which process will get memory when and how much. • Allocates the memory when a process requests it to do so. • De-allocates the memory when a process no longer needs it or has been terminated. Processor Management • Keeps tracks of processor and status of process. The program responsible for this task is known as traffic controller. • Allocates the processor (CPU) to a process. • De-allocates processor when a process is no longer required. • In multiprogramming environment, the OS decides which process gets the processor when and for how much time. This function is called process scheduling. Device Management • An Operating System manages device communication via their respective drivers • Keeps tracks of all devices. Program responsible for this task is known as the I/O controller. • Decides which process gets the device when and for how much time. • Allocates the device in the efficient way. • De-allocates devices.

File Management • A file system is normally organized into directories for easy navigation and usage. These directories may contain files and other directions. • Keeps track of information, location, uses, status etc. The collective facilities are often known as file system. • Decides who gets the resources. • Allocates the resources. • De-allocates the resources.

Other Important Activities  Security − By means of password and similar other techniques, it prevents unauthorized access to programs and data.  Control over system performance − Recording delays between request for a service and response from the system. • Job accounting − Keeping track of time and resources used by various jobs and users.

• Error detecting aids − Production of dumps, traces, error messages, and other debugging and error detecting aids. • Coordination between other softwares and users − Coordination and assignment of compilers, interpreters, assemblers and other software to the various users of the computer systems. Types of Operating System Batch Operating System In main frame computers • Common I/p O/p devices are card readers and tape drives • User prepare a job consist of programme I/O data and control instructions Input job is given in the form of punch cards and the result also appear in the form of punch cards after processing

• Jobs with similar needs are batched together and executed through processor as a group • Operator starts job as a deck of punch cards into batch with similar needs Eg:FORTRAN batch, COBOL batch etc • Batch processing is the most primitive type of operating system. • Batch processing generally requires the program, data, and appropriate system commands to be submitted together in the form of a job. • Batch operating systems usually allow little or no interaction between users and executing programs. • Due to turnaround delays and offline debugging, batch is not very convenient for program development.

• Examples of such programs include payroll, forecasting, statistical analysis, and large scientific number-crunching programs. Scheduling in batch is very simple. Jobs are typically processed in order of their submission, that is, first-come first-served fashion • Memory management in batch systems is also very simple. Memory is usually divided into two areas. • The resident portion of the Operating System permanently occupies one of them, and the other is used to load transient programs for execution. • When a transient program terminates, a new program is loaded into the same area of memory.

Multiprogramming Operating System • In a multiprogramming system there are one or more programs loaded in main memory which are ready to execute. • Only one program at a time is able to get the CPU for executing its instructions (i.e., there is at most one process running on the system) while all the others are waiting their turn. • The main idea of multiprogramming is to maximize the use of CPU time. • Suppose the currently running process is performing an I/O task (Does not need the CPU to be accomplished). Then, the OS may interrupt that process and give the control to one of the other in-main-memory programs that are ready to execute (i.e. process context switching). • No CPU time is wasted by the system waiting for the I/O task to be completed, and a running process keeps executing until either it voluntarily releases the CPU or when it blocks for an I/O operation • The ultimate goal of multiprogramming is to keep the CPU busy as long as there are processes ready to execute.

Time Sharing Operating System • A time sharing system allows many users to share the computer resources simultaneously. • In other words, time sharing refers to the allocation of computer resources in time slots to several programs simultaneously. • For example a mainframe computer that has many users logged on to it. • Each user uses the resources of the mainframe -i.e. memory, CPU etc. The users feel that they are exclusive user of the CPU, even though this is not possible with one CPU i.e. shared among different users. • The time sharing systems were developed to provide an interactive use of the computer system. • A time shared system uses CPU scheduling and multiprogramming to provide each user with a small portion of a time-shared computer. • It allows many users to share the computer resources simultaneously. As the system switches rapidly from one user to the other, a short time slot is given to each user for their executions. • The time sharing system provides the direct access to a large number of users where CPU time is divided among all the users on scheduled basis. • The OS allocates a set of time to each user. • When this time is expired, it passes control to the next user on the system. • The time allowed is extremely small and the users are given the impression that they each have their own CPU and they are the sole owner of the CPU.



This short period of time during that a user gets attention of the CPU; is known as a time slice or a quantum.

Multiprocessing Operating system • Generally a Computer has a Single Processor means a Computer have a just one CPU for Processing the instructions. • But if we are Running multiple jobs, then this will decrease the Speed of CPU. • For Increasing the Speed of Processing then we uses the Multiprocessing, in the Multi Processing there are two or More CPU in a system • If one CPU will fail, then other CPU is used for providing backup to the first CPU. • With the help of Multi-processing, we can Execute Many Jobs at a Time. • All the Operations are divided into the Number of CPU’s. • If first CPU Completed his Work before the Second CPU, then the Work of Second CPU will be divided into the First and Second.

Real Time Operating Systems • A real-time system is defined as a data processing system in which the time interval required to process and respond to inputs is so small that it controls the environment. • The time taken by the system to respond to an input and display of required updated information is termed as the response time. • So in this method, the response time is very less. • Real-time systems are used when there are rigid time requirements on the operation of a processor or the flow of data • Real-time systems can be used as a control device in a dedicated application.

• A real-time operating system must have well-defined, fixed time constraints, otherwise the system will fail. • For example, Scientific experiments, medical imaging systems, industrial control systems, weapon systems, robots, air traffic control systems, etc. • There are two types of real-time operating systems. Hard real-time systems • Hard real-time systems guarantee that critical tasks complete on time. • In hard real-time systems, secondary storage is limited or missing and the data is stored in ROM. Soft real-time systems • Soft real-time systems are less restriction. • A critical real-time task gets priority over other tasks and retains the priority until it completes. • Soft real-time systems have limited utility than hard real-time systems. • For example, multimedia, virtual reality, Advanced Scientific Projects like undersea exploration ect

Distributed Operating System • Distributed Operating System is a model where distributed applications are running on multiple computers linked by communications. • This system looks to its users like an ordinary centralized operating system but runs on multiple, independent central processing units (CPUs) • These systems are referred as loosely coupled systems where each processor has its own local memory and processors communicate with one another through various communication lines, such as high speed buses or telephone lines. • Processors in a distributed system may vary in size and function. These processors are referred as sites, nodes, computers, and so on. The advantages of distributed systems are as follows • With resource sharing facility, a user at one site may be able to use the resources available at another. • Speedup the exchange of data with one another. • If one site fails in a distributed system, the remaining sites can potentially continue operating. • Better service to the customers. • Reduction of the load on the host computer. • Reduction of delays in data processing.

Operating-system operations • Modern operating systems are interrupt driven. • If there are no processes to execute, no I/O devices to service, and no users to whom to respond, an operating system will sit quietly, waiting for something to happen. • Events are almost always signalled by the occurrence of an interrupt or a trap.

TRAP • A trap (or an exception) is an interrupt caused either by an error (for example, division by zero or invalid memory access) or by a specific request from a user program that an operating-system service be performed. • The interrupt-driven nature of an operating system defines that system's general structure. • For each type of interrupt, separate segments of code in the operating system determine what action should be taken. • An interrupt service routine is provided that is responsible for dealing with the interrupt. • Since the operating system and the users share the hardware and software resources of the computer system, we need to make sure that an error in a user program could cause problems only for the one program that was running. With sharing, many processes could be adversely affected by a bug in one program. • For example, if a process gets stuck in an infinite loop, this loop could prevent the correct operation of many other processes. • More errors can occur in a multiprogramming system, where one erroneous program might modify another program, the data of another program, or even the operating system itself. • A properly designed operating system must ensure that an incorrect (or malicious) program cannot cause other programs to execute incorrectly.

Operating System Operations Dual -Mode Opeartion • In order to ensure the proper execution of the operating system, we must be able to distinguish between the execution of operating-system code and user defined code. • Two separate modes of operation: • user mode • kernel mode (also called supervisor mode, system mode, or privileged mode).

• A bit, called the mode bit, is added to the hardware of the computer to indicate the current mode: • kernel (0) • user (1). • With the mode bit, we are able to distinguish between a task that is executed on behalf of the operating system and one that is executed on behalf of the user. • When the computer system is executing on behalf of a user application, the system is in user mode. • However, when a user application requests a service from the operating system (via a system call), it must transition from user to kernel mode to fulfil the request. • At system boot time, the hardware starts in kernel mode. • The operating system is then loaded and starts user applications in user mode. • Whenever a trap or interrupt occurs, the hardware switches from user mode to kernel mode (that is, changes the state of the mode bit to 0). • Thus, whenever the operating system gains control of the computer, it is in kernel mode. • The system always switches to user mode (by setting the mode bit to 1) before passing control to a user program. • The dual mode of operation provides us with the means for protecting the operating system from errant users—and errant users from one another. • This protection is accomplish this protection by designating some of the machine instructions that may cause harm as privileged instructions. • The hardware allows privileged instructions to be executed only in kernel mode. • If an attempt is made to execute a privileged instruction in user mode, the hardware does not execute the instruction but rather treats it as illegal and traps it to the operating system. • The instruction to switch to user mode is an example of a privileged instruction. • Some other examples include I/O control, timer management, and interrupt management.

Transition from user to kernel mode

Operating System Services •

Operating systems provide an environment for execution of programs and services to programs and users • One set of operating-system services provides functions that are helpful to the user: User interface - Almost all operating systems have a user interface (UI). Command-Line (CLI), Graphics User Interface (GUI), Batch Based Interface  The command line interface (CLI) usually deals with using text commands and a technique for entering those commands.  The batch interface (BI): commands and directives are used to manage those commands that are entered into files and those files get executed.  Graphical user interface (GUI): which is a window system with a pointing device (like mouse or trackball) to point to the I/O, choose from menus driven interface and to make choices viewing from a number of lists and a keyboard to entry the texts.  Program execution - The system must be able to load a program into memory and to run that program, end execution, either normally or abnormally (indicating error)  I/O operations - A running program may require I/O, which may involve a file or an I/O device  File-system manipulation - The file system is of particular interest. Programs need to read and write files and directories, create and delete them, search them, list file Information, permission management.  Communications – Processes may exchange information, on the same computer or between computers over a network  Communications may be via shared memory or through message passing (packets moved by the OS)  Error detection – OS needs to be constantly aware of possible errors  May occur in the CPU and memory hardware, in I/O devices, in user program  For each type of error, OS should take the appropriate action to ensure correct and consistent computing  Debugging facilities can greatly enhance the user’s and programmer’s abilities to efficiently use the system  Resource allocation - When multiple users or multiple jobs running concurrently, resources must be allocated to each of them  Many types of resources - CPU cycles, main memory, file storage, I/O devices.

 Accounting - To keep track of which users use how much and what kinds of computer resources  Protection and security - The owners of information stored in a multiuser or networked computer system may want to control use of that information, concurrent processes should not interfere with each other • Protection involves ensuring that all access to system resources is controlled • Security of the system from outsiders requires user authentication, extends to defending external I/O devices from invalid access attempts

A View of Operating System Services

System Calls • Programming interface to the services provided by the OS • Mostly accessed by programs via a high-level Application Programming Interface (API) rather than direct system call use • Three most common APIs are • Win32 API for Windows, POSIX API for POSIX-based systems (including virtually all versions of UNIX, Linux, and Mac OS X) and Java API for the Java virtual machine (JVM)

System Call Implementation • Typically, a number associated with each system call • System-call interface maintains a table indexed according to these numbers • The system call interface invokes the intended system call in OS kernel and returns status of the system call and any return values • The caller need know nothing about how the system call is implemented • Just needs to obey API and understand what OS will do as a result call • Most details of OS interface hidden from programmer by API

Example of System Calls • System call sequence to copy the contents of one file to another file

API – System Call – OS Relationship

System Call Parameter Passing • Often, more information is required than simply identity of desired system call • Exact type and amount of information vary according to OS and call • Three general methods used to pass parameters to the OS • Simplest: pass the parameters in registers • In some cases, may be more parameters than registers • Parameters stored in a block, or table, in memory, and address of block passed as a parameter in a register • This approach taken by Linux and Solaris • Parameters placed, or pushed, onto the stack by the program and popped off the stack by the operating system • Block and stack methods do not limit the number or length of parameters being passed

Parameter Passing via Table

Types of System Calls • Process control • create process, terminate process • end, abort • load, execute • get process attributes, set process attributes • wait for time • wait event, signal event • allocate and free memory • Dump memory if error • Debugger for determining bugs, single step execution • Locks for managing access to shared data between processes  File management • create file, delete file • open, close file • read, write, reposition • get and set file attributes  Device management • request device, release device • read, write, reposition • get device attributes, set device attributes • logically attach or detach devices  Information maintenance • get time or date, set time or date • get system data, set system data • get and set process, file, or device attributes  Communications • create, delete communication connection • send, receive messages if message passing model to host name or process name From client to server • Shared-memory model create and gain access to memory regions • transfer status information • attach and detach remote devices  Protection • Control access to resources • Get and set permissions Allow and deny user access

Examples of Windows and Unix System Calls

Standard C Library Example • C program invoking printf() library call, which calls write() system call

Related Documents

Operating
November 2019 33
Operating System
November 2019 42
Operating Costs
November 2019 17
Operating Instructions
June 2020 16
Operating System2
November 2019 18
Operating Systems
October 2019 29

More Documents from ""