Você está na página 1de 31

Valia Koonambaikulathamma College of Engineering & Technology

Department of Computer Science & Engineering 08.406 OPERATING SYSTEMS MODULE I


Q. What is an Operating System?

An Operating System (OS) is an intermediary between users and computer hardware. It provides users an environment in which a user can execute programs conveniently and efficiently. In technical terms, It is a software which manages hardware. An operating System controls the allocation of resources and services such as Memory management Process management, Devices management, Security, Network management, File Management Control over system performance, Job accounting, Error detecting aids Coordination between other software and users Information management.

Q. What are the main operating system services? An Operating System provides services to both the users and to the programs. It provides programs, an environment to execute. It provides users, services to execute the programs in a convenient manner.

Following are few common services provided by operating systems. Program execution I/O operations File System manipulation Communication Error Detection Resource Allocation Protection

Program execution Loads program into memory. Executes the program. Handles program's execution Provides a mechanism for process synchronization Provides a mechanism for process communication. Provides a mechanism for deadlock handling.

I/O Operation I/O operation means read or write operation with any file or any specific I/O device. Program may require any I/O device while running. Operating system provides the access to the required I/O device when required.

File system manipulation Program needs to read a file or write a file.

The operating system gives the permission to the program for operation on file. Permission varies from read-only, read-write, denied and so on. Operating System provides an interface to the user to create/delete files. Operating System provides an interface to the user to create/delete directories. Operating System provides an interface to create the backup of file system.

Communication Two processes often require data to be transferred between them. The both processes can be on the one computer or on different computer but are connected through computer network. Communication may be implemented by two methods either by Shared Memory or by Message Passing.

Error handling OS constantly remains aware of possible errors. OS takes the appropriate action to ensure correct and consistent computing.

Resource Management OS manages all kind of resources using schedulers. CPU scheduling algorithms are used for better utilization of CPU.

Protection

OS ensures that all access to system resources is controlled. OS ensures that external I/O devices are protected from invalid access attempts. OS provides authentication feature for each user by means of a password.

Q. What are the three main purposes of an operating system? Answer: To provide an environment for a computer user to execute programs on computer hardware in a convenient and efficient manner. To allocate the separate resources of the computer as needed to solve the problem given. The allocation process should be as fair and efficient as possible. As a control program it serves two major functions: (1) supervision of the execution of user programs to prevent errors and improper use of the computer, and (2) management of the operation and control of I/O devices. Q. What are the main differences between operating systems for mainframe computers and personal computers? Generally, operating systems for batch systems have simpler requirements than for personal computers. Batch systems do not have to be concerned with interacting with a user as much as a personal computer. As a result, an operating system for a PC must be concerned with response time for an interactive user. Batch systems do not have such requirements. A pure batch system also may have not to handle time sharing, whereas an operating system must switch rapidly between different jobs.

Q. List the four steps that are necessary to run a program on a completely dedicated machine? Reserve machine time. Manually load program into memory. Load starting address and begin execution. Monitor and control execution of program from console.

Q. Early Systems Early computers were physically massive machines run from a console.

The programmer, of the computer system, would write a program and then would operate the program directly from the operators console. First, the program would be loaded manually into memory from the front panel switches (one instruction at a time), from paper tape, or from punched cards. Then, the appropriate buttons would be pushed to set the starting address and to start the execution of the program. As the program ran, the programmer could monitor its execution by the display lights on the console. If errors were discovered, the programmer could halt the program, examine the contents of memory and registers, and debug the program directly from the console. Output was printed or was punched onto paper tape or cards for later printing

Structure of Early Systems Single user system. Programmer/User as operator (Open Shop). Large machines run from console. Paper Tape or Punched cards.

Characteristics of Early Systems

Early software: Assemblers, Libraries of common subroutines (I/O, Floating-point), Device Drivers, Compilers, Linkers. Need significant amount of setup time. Extremely slow I/O devices. Very low CPU utilization. But computer was very secure.

1. Dedicated Computer Systems Later, additional software and hardware were developed. Assemblers, loaders, and linkers were designed to ease to programming task. Libraries of common functions were created. Common functions could then be copied into a new program without having to be written again, providing software reusability. The routines that performed I/O were especially important. Each new I/O device had its own characteristics. A special subroutinecalled a device driverwas written for each I/O device. A device driver knows how the buffers, flags, registers, control bits, and status bits for a particular device should be used. Each type of device has its own driver. Later, compilers for FORTRAN, COBOL, and other languages appeared, making the programming task much easier but the operation of the computer more complex. 2. Shared Computer Systems When a job stopped, the Operator would have to notice that it had stopped (by observing the console), determine why its topped (normal or abnormal termination), dump memory and register (if necessary), load the appropriate device with the next job, and restart the computer. During this transition from one job to the next, the CPU sat idle. To overcome this idle time, people developed automatic job sequencing; with this technique, the first basic operating systems were created.

A small program, called a resident monitor (Job Sequencer), was created to transfer control automatically from one job to the next. The resident monitor is always in memory (or resident).

When the computer was turned on, the resident monitor was invoked, and it would transfer control to a program. When the program terminated, it would return control to the resident monitor, which would then go on to the next program. Thus, the resident monitor would automatically sequence from one program to another and from one job to another.

Parts of resident monitor: o o o Control card Interpreter responsible for reading and carrying out instructions on the cards. Loader loads systems programs and applications programs into memory. Device drivers know special characteristics and properties for each of the systems I/O devices.

3. Overlapped I/ O

One common solution to the I/O problem was to replace slow card readers (input devices) and line printers (output devices)with magnetic-tape units. The majority of computer systems in the late1950s and early1960s were batch systems reading from card readers and writing to line printers or card punches. Rather than have the CP U read directly from cards, however, the cards were first copied onto a magnetic tape via a separate device. When the tape was sufficiently full, it was taken down and carried over to the computer.

When a card was needed for input to a program, the equivalent record was read from the tape. Similarly, output was written to the tape, and the contents of the tape were printed later.

The card readers and line printers were operated off-line, rather than the main computer

An obvious advantage of off-line operation was that the main computer was no longer constrained by the speed of the card readers and line printers but was limited only by the speed of the much faster magnetic tape units.

The technique of using magnetic tape for all I/O could be applied with any similar equipment The real gain in off-line operation is the using of multiple reader-to-tape and tape-toprinter systems for one CPU. If the CPU can process input twice as fast as the reader can read cards, then two readers working simultaneously can produce enough tape to keep the CPU busy.

There is some disadvantage too, a longer delay in getting a particular job run. The job must first be read onto tape. Then it must wait until enough additional jobs are read onto the tape to "fill" it. o o Card reader, Line printer and Tape drives slow (compared to Disk). I/O and CPU could not overlap

Solution: Spooling o o Overlap I/O of one job with the computation of another job (using double buffering, DMA, etc). Technique is called SPOOLing: Simultaneous Peripheral Operation On Line

SPOOLing System Components

While executing one job, the Operating System: Reads next job from card reader into a storage area on the disk (Job pool) and Outputs printout of previous job from disk to printer.

Job pool is a data structure that allows the OS to select which job to run next in order to increase CPU utilization.

Q. Evolution of Operating Systems? Early Systems (1950) Simple Batch Systems (1960) Multiprogrammed Batch Systems (1970) Time-Sharing and Real-Time Systems (1970) Personal/Desktop Computers (1980) Multiprocessor Systems (1980) Networked/Distributed Systems (1980) Web-based Systems (1990)

Q. Discuss the Concept of Operating-System Structures? Common System Components Operating System Services System Calls System Programs System Structure Virtual Machines System Design and Implementation System Generation

1. Common System Components Process Management Main Memory Management

File Management I/O System Management Secondary Management Networking Protection System Command-Interpreter System

a. Process Management A process is a program in execution. A process needs certain resources, including CPU time, memory, files, and I/O devices, to accomplish its task. The operating system is responsible for the following activities in connection with process management. o Process creation and deletion. o Process suspension and resumption. o Provision of mechanisms for: process synchronization process communication b. Main Memory Management Memory is a large array of words or bytes, each with its own address. It is a repository of quickly accessible data shared by the CPU and I/O devices Main memory is a volatile storage device The operating system is responsible for the following activities o Keep track of which parts of memory are currently being used and by whom. o Decide which processes to load when memory space becomes available. o Allocate and deallocate memory space as needed. c. File Management A file is a collection of related information defined by its creator. The operating system is responsible for the following activities o File creation and deletion. o Directory creation and deletion. o Support of primitives for manipulating files and directories. o Mapping files onto secondary storage.

o File backup on stable (nonvolatile) storage media. d. I/O System Management The I/O system consists of o A buffer-caching system o A general device-driver interface o Drivers for specific hardware devices e. Secondary-Storage Management Since main memory (primary storage) is volatile and too small to accommodate all data and programs permanently, the computer system must provide secondary storage to back up main memory. Most modern computer systems use disks as the principle on-line storage medium, for both programs and data The operating system is responsible for the following activities in connection with disk management: o Free space management o Storage allocation o Disk scheduling f. Networking (Distributed Systems) A distributed system is a collection processors that do not share memory or a clock. Each processor has its own local memory. The processors in the system are connected through a communication network. Communication takes place using a protocol. A distributed system provides user access to various system resources. Access to a shared resource allows: o Computation speed-up o Increased data availability o Enhanced reliability

g. Protection System Protection refers to a mechanism for controlling access by processes, or users to both system and user resources. The protection mechanism must: o distinguish between authorized and unauthorized usage. programs,

o specify the controls to be imposed. o provide a means of enforcement. h. Command-Interpreter System Many commands are given to the operating system by control statements which deal with o process creation and management o I/O handling o secondary-storage management o main-memory management o file-system access o protection o networking The program that reads and interprets control statements is called variously: o command-line interpreter o shell (in UNIX)

2. Operating System Services. Program execution system capability to load a program into memory and to run it. I/O operations since user programs cannot execute I/O operations directly, the operating system performs it. File-system manipulation program capability to read, write, create, and delete files. Communications exchange of information between processes executing either on the same computer or on different systems. Implemented via shared memory or message passing. Error detection ensure correct computing by detecting errors in the CPU and memory hardware, in I/O devices, or in user programs.

a. Additional Operating System Functions Resource allocation allocating resources to multiple users or multiple jobs running at the same time.

Accounting keep track of and record which users use how much and what kinds of computer resources for account billing or for accumulating usage statistics. Protection ensuring that all access to system resources is controlled

3. System Calls System calls provide the interface between a running program and the operating system. o Generally available as assembly-language instructions. o Languages defined to replace assembly language for systems programming allow system calls to be made directly (e.g., C, C++) Three general methods are used to pass parameters between a running program and the operating system. o Pass parameters in registers. o Store the parameters in a table in memory, and the table address is passed as a parameter in a register. o Push (store) the parameters onto the stack by the program, and pop off the stack by operating system. Passing of Parameters As A Table

Types of System Calls o Process control o File management

o Device management o Information maintenance o Communications Communication Models o Communication may take place using either message passing or shared memory.

4. System Programs System programs provide a convenient environment for program development and execution. They can be divided into: o File manipulation o Status information o File modification o Programming language support o Program loading and execution o Communications o Application programs

5. System Structure MS-DOS Layer Structure

UNIX System Structure

Layered Approach o The operating system is divided into a number of layers (levels), each built on top of lower layers. The bottom layer (layer 0), is the hardware; the highest (layer N) is the user interface. o With modularity, layers are selected such that each uses functions (operations) and services of only lower level layers. o An Operating System Layer

o OS/2 Layer Structure

o Windows NT Client-Server Structure

Q. What is the main difficulty that a programmer must overcome in writing an operating system for a real-time environment? The main difficulty is keeping the operating system within the fixed time constraints of a real-time system. If the system does not complete a task in a certain time frame, it may cause a breakdown of the entire system it is running. Therefore when writing an operating system for a real-time system, the writer must be sure that his scheduling schemes dont allow response time to exceed the time constraint

Q. What is the purpose of system programs? System programs can be thought of as bundles of useful system calls. They provide basic functionality to users so that users do not need to write their own programs to solve common problems.

Q. What is the main advantage of the layered approach to system design? What are the disadvantages of using the layered approach? As in all cases of modular design, designing an operating system in a modular way has several advantages. The system is easier to debug and modify because changes affect only limited sections of the system rather than touching all sections of the operating system. Information is kept only where it is needed and is accessible only within a defined and restricted area, so any bugs affecting that data must be limited to a specific module or layer.

Q. What is the purpose of system calls? System calls allow user-level processes to request services of the operating system.

System calls allow user-level processes to request services of the operating system.

Q. What is the purpose of the command interpreter? Why is it usually separate from the kernel? It reads commands from the user or from a file of commands and executes them, usually by turning them into one or more system calls. It is usually not part of the kernel since the command interpreter is subject to changes.

Q. What are the three major activities of an operating system in regard to memory management? Keep track of which parts of memory are currently being used and by whom. Decide which processes are to be loaded into memory when memory space becomes available. Allocate and deallocate memory space as needed.

Q. What are the five major activities of an operating system in regard to process management? The creation and deletion of both user and system processes The suspension and resumption of processes The provision of mechanisms for process synchronization The provision of mechanisms for process communication The provision of mechanisms for deadlock handling

Q. What are the three major activities of an operating system in regard to secondary-storage management? Free-space management. Storage allocation. Disk scheduling.

Q. List five services provided by an operating system. Explain how each provides convenience to the users?

Program execution. The operating system loads the contents (or sections) of a file into memory and begins its execution. A user level program could not be trusted to properly allocate CPU time. I/O operations. Disks, tapes, serial lines, and other devices must be communicated with at a very low level. The user need only specify the device and the operation to perform on it, while the system converts that request into deviceor controller-specific commands. User-level programs cannot be trusted to access only devices they should have access to and to access them only when they are otherwise unused. File-system manipulation. There are many details in file creation, deletion, allocation, and naming that users should not have to perform. Blocks of disk space are used by files and must be tracked. Deleting a file requires removing the name file information and freeing the allocated blocks. Protections must also be checked to assure proper file access. User programs could neither ensure adherence to protection methods nor be trusted to allocate only free blocks and deallocate blocks on file deletion. Communications. Message passing between systems requires messages to be turned into packets of information, sent to the network controller, transmitted across a communications medium, and reassembled by the destination system. Packet ordering and data correction must take place. Again, user programs might not coordinate access to the network device, or they might receive packets destined for other processes. Error detection. Error detection occurs at both the hardware and software levels. At the hardware level, all data transfers must be inspected to ensure that data have not been corrupted in transit. All data on media must be checked to be sure they have not changed since they were written to the media. At the software level, media must be checked for data consistency; for instance, whether the number of allocated and unallocated blocks of storage matches the total number on the device. There, errors are frequently process-independent, so there must be a global program (the operating system) that handles all types of errors. Also, by having errors processed by the operating system, processes need not contain code to catch and correct all the errors possible on a system.

Types of Operating System

There are Many Operating Systems which have the Capability to Perform the Requests those are received from the System. The Operating system can perform a Single Operation and also Multiple Operations at a Time.

Serial Processing: o The Serial Processing Operating Systems are those which Performs all the instructions into a Sequence Manner or will be executed by using the FIFO Manner means First in First Out. o All the Instructions those are Entered First in the System will be Executed First and the Instructions those are Entered Later Will be Executed Later. o For Running the Instructions the Program Counter is used which is used for

o In this the Program Counter will determines which instruction is going to Execute and the which instruction will be Execute after this. o Mainly the Punch Cards are used for this. In this all the Jobs are firstly Prepared and Stored on the Card and after that card will be entered in the System and after that all the Instructions will be executed one by One. o But the Main Problem is that a user doesnt interact with the System Batch Processing o The Batch Processing is same as the Serial Processing Technique. o But in the Batch Processing Similar Types of jobs are Firstly Prepared and they are Stored on the Card. and that card will be Submit to the System for the Processing. o The System then Perform all the Operations on the Instructions one by one. And a user cant be Able to specify any input. o And Operating System wills increments his Program Counter for Executing the Next Instruction. o The Main Problem is that the Jobs those are prepared for Execution must be the Same Type and if a job requires for any type of Input then this will not be Possible for the user. o The Batch Contains the Jobs and all those jobs will be executed without the user Intervention. o And Operating System will use the LOAD and RUN Operation. This will first LOAD the Job from the Card and after that he will execute the instructions. By using the RUN Command. o The Speed of the Processing the Job will be Depend on the Jobs and the

Results those are produced by the system o

Time-sharing operating systems o Time sharing is a technique which enables many people, located at various terminals, to use a particular computer system at the same time. o Time-sharing or multitasking is a logical extension of multiprogramming.

o Processor's time which is shared among multiple users simultaneously is termed as time-sharing. o The main difference between Multiprogrammed Batch Systems and TimeSharing Systems is that in case of Multiprogrammed batch systems, objective is to maximize processor use, whereas in Time-Sharing Systems objective is to minimize response time.

Advantages of Timesharing operating systems are following

Provide advantage of quick response. Avoids duplication of software. Reduces CPU idle time. Disadvantages of Timesharing operating systems are following. Problem of reliability. Question of security and integrity of user programs and data. Problem of data communication.

Distributed operating System

o Distributed systems use multiple central processors to serve multiple real time application and multiple users. o Data processing jobs are distributed among the processors accordingly to which one can perform each job most efficiently. o The processors communicate with one another through various communication lines (such as high-speed buses or telephone lines). o These are referred as loosely coupled systems or distributed systems.

Processors in a distributed system may vary in size and function.

The advantages of distributed systems are following.

With resource sharing facility user at one site may be able to use the resources available at another. Speedup the exchange of data with one another via electronic mail.

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.

Network operating System

o Network Operating System runs on a server and provides server the capability to manage data, users, groups, security, applications, and other networking functions. o The primary purpose of the network operating system is 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. o Examples of network operating systems are Microsoft Windows Server 2003, Microsoft Windows Server 2008, UNIX, Linux, Mac OS X, Novell NetWare, and BSD.

The advantages of network operating systems are following.

Centralized servers are highly stable. Security is server managed.

Upgrades to new technologies and hardwares can be easily integrated into the system.

Remote access to servers is possible from different locations and types of systems.

The disadvantages of network operating systems are following.

High cost of buying and running a server.

Dependency on a central location for most operations. required. Regular maintenance and updates are

Real Time operating System

o Real time system is defines 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.

Real time processing is always on line whereas on line system need not be real time.

o The time taken by the system to respond to an input and display of required updated information is termed as response time. So in this method response time is very less as compared to the online processing. o Real-time operating system has well-defined, fixed time constraints otherwise system will fail. For example Scientific experiments, medical imaging systems, industrial control systems, weapon systems, robots, and home-appliance controllers, Air traffic control system etc. o There are two types of real-time operating systems.

Hard real-time systems

o Hard real-time systems guarantee that critical tasks complete on time. In hard real- time systems secondary storage is limited or missing with data stored in ROM. In these systems virtual memory is almost never found.
Soft real-time systems

o Soft real time systems are less restrictive. 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 and planetary rovers etc.

[CSE VKCET]

Page 28

[CSE VKCET]

Page 29

Q. What is preemptive and non preemptive scheduling?

Tasks are usually assigned with priorities. At times it is necessary to run a certain task that has a higher priority before another task although it is running. Therefore, the running task is interrupted for some time and resumed later when the priority task has finished its execution. This is called preemptive scheduling. With pre-emptive CPU scheduling, a new process can run when interrupt occurs. E.g.: Round robin

[CSE VKCET]

Page 30

In non-preemptive scheduling, a running task is executed till completion. It cannot be interrupted. E.g. First In First Out

Q.

[CSE VKCET]

Page 31

Você também pode gostar