Download Operating Systems: Fundamentals and Types and more Study notes Operating Systems in PDF only on Docsity!
UNIT โ I
NECESSITY OF OPERATING SYSTEM:
- Definition: โ An operating system is a program that controls the execution of programs and acts as an interface between the user of a computer and the computer hardware. โ Example: Linux, Windows, OS X, OS/400, AIX, etc.
- Operating system performs three functions: โ Convenience: โ An OS makes a computer more convenient to use. โ Efficiency: โ An OS allows the computer system resources to be used in an efficient manner. โ Ability to evolve: โ An OS should be constructed in such a way as to permit the effective development, testing, and introduction of new system functions without at the same time interfacing with service.
- Operating System as a User Interface: โ Every general-purpose computer consists of the hardware, operating system, system programs, application programs. Hardware โ Memory, CPU, ALU, I/O devices, Peripheral devices and storage device. Operating System โ Windows, Linux, Unix, etc. System Program โ Compiler, Loaders, Editors, etc. Application Program โ Business program, Database Program. โ Every computer must have an operating system to run other programs. The Operating System controls and co-ordinates the use of the hardware among the various system programs and application program for a various user. โ It simply provides an environment within which other programs can do useful work.
โ The Operating System is a set of special programs that run on a computer system that allow it to work properly. โ It performs basic tasks such as recognizing input from the keyboard, keeping track of files and directories on the disk, sending output to the display screen and controlling a peripheral device.
- (^) OS is designed to serve two basic purposes:
โ It controls the allocations and use of the computing systemโs resources among the various users and tasks. โ It provides an interface between the computer hardware and the programmer that simplifies and makes feasible for coding, creation, debugging of application programs.
- OS supports the following task: โ Provides the facilities to create, modification of program and data files using an editor. โ Access to the compiler for translating the user program from high level language to machine language. โ Provide a loader program to move the compiled program code to the computerโs memory for execution. โ Provide routines that handle the details of I/O programming.
- Need of Operating System: โ OS as a platform for Application Programs: โ Operating system provides a platform, on top of which, other program called Application Programs can run. These application programs help the users to perform a specific task easily. It acts as an interface between the computer and the user. It is designed in such a manner that it operates, controls and executes various applications on the computer. โ Managing input-output unit: โ Operating system allows the computer to manage its own resources such as memory, monitor, keyboard, printer, etc. Management of these resources is required for an effective utilization. The operating system controls the various system input-output resources and allocates them to the users or programs as per their requirement. โ Consistent user interface: โ Operating system provides the user an easy-to-work user interface, so the user doesnโt have to learn a different UI every time and can focus on the content and be productive as quickly as possible. Operating system provides templates, UI components to make the working of a computer, really easy for the user. โ Multitasking: โ Operating system manages memory and allow multiple programs to run in their own space and even communicate with each other through shared memory. Multitasking gives users a good experience as they can perform several tasks on a computer at a time.
- Functions of Operating system โ Operating system performs three functions: โ Convenience: โ An OS makes a computer more convenient to use. โ Efficiency: โ An OS allows the computer system resources to be used in an efficient manner. โ Ability to Evolve: โ An OS should be constructed in such a way as to permit the effective development, testing and introduction of new system functions without at the same time interfering with service.
- History of Operating System: โ Operating system has been evolving through the years. Following Table shows the history of OS.
โ These systems are also known as Multitasking Systems. โ The task can be from single user or from different users also. The time that each task gets to execute is called quantum. After this time interval is over OS switches over to next task. โ Examples of Time-Sharing OSs are: Multics, Unix etc.
โ Advantages: โ Each task gets an equal opportunity โ Less chances of duplication of software โ CPU idle time can be reduced โ Disadvantages: โ Reliability problem โ One must have to take care of security and integrity of user programs and data โ Data communication problem
DISTRIBUTED OPERATING SYSTEM โ These types of operating system are a recent advancement in the world of computer technology and are being widely accepted all-over the world and, that too, with a great pace. โ Various autonomous interconnected computers communicate each other using a shared communication network. Independent systems possess their own memory unit and CPU. โ These are referred as loosely coupled systems or distributed systems. โ These systems processors differ in sizes and functions. โ The major benefit of working with these types of operating system is that it is always possible that one user can access the files or software which are not actually present on his system but on some other system connected within this network i.e., remote access is enabled within the devices connected in that network. โ Examples of Distributed Operating System are: LOCUS etc.
โ Advantages: โ Failure of one will not affect the other network communication, as all systems are independent from each other. โ Electronic mail increases the data exchange speed. โ Since resources are being shared, computation is highly fast and durable. โ Load on host computer reduces. โ These systems are easily scalable as many systems can be easily added to the network. โ Delay in data processing reduces. โ Disadvantages: โ Failure of the main network will stop the entire communication. โ To establish distributed systems the language which are used are not well defined yet. โ These types of systems are not readily available as they are very expensive. Not only that the underlying software is highly complex and not understood well yet. NETWORK OPERATING SYSTEM โ These systems run on a server and provides the capability to manage data, users, groups, security, applications, and other networking functions. โ (^) These types of operating systems allow shared access of files, printers, security, applications, and other networking functions over a small private network. โ One more important aspect of Network Operating Systems is that all the users are well aware of the underlying configuration, of all other users within the network, their individual connections etc. and thatโs why these computers are popularly known as tightly coupled systems. โ Examples of Network Operating System are: Microsoft Windows Server 2003, Microsoft Windows Server 2008, UNIX, Linux, Mac OS X, Novell NetWare, and BSD etc.
โ Advantages: โ Maximum Consumption:
- Maximum utilization of devices and system, thus more output from all the resources โ Task Shifting:
- Time assigned for shifting tasks in these systems are very less. For example, in older systems it takes about 10 micro seconds in shifting one task to another and in latest systems it takes 3 micro seconds. โ Focus on Application:
- Focus on running applications and less importance to applications which are in queue. โ Real time operating system in embedded system:
- Since size of programs are small, RTOS can also be used in embedded systems like in transport and others. โ Error Free:
- These types of systems are error free. โ Memory Allocation:
- (^) Memory allocation is best managed in these types of systems. โ Disadvantages: โ Limited Tasks:
- Very few tasks run at the same time and their concentration is very less on few applications to avoid errors. โ Use heavy system resources:
- Sometimes the system resources are not so good and they are expensive as well. โ Complex Algorithms:
- The algorithms are very complex and difficult for the designer to write on. โ Device driver and interrupt signals:
- It needs specific device drivers and interrupt signals to response earliest to interrupts. โ Thread Priority:
- It is not good to set thread priority as these systems are very less pron to switching tasks.
DEVICE MANAGEMENT:
- General Device Characteristics: โ Character stream/block: โ A character-stream device transfers byte in one by one fashion, where as a block device transfers a complete unit of bytes. โ Sequential/Random Access: โ A sequential device transfers data in a fixed order determined by the devices. โ A random-access device can be instructed to seek position to any of the available data storage locations. โ Synchronous/Asynchronous: โ A synchronous device performs data transfer with known response time. โ An asynchronous device shows irregular or unpredictable response time. โ Sharable/Dedicated: โ A sharable device can be used concurrently by several processes or threads. โ Dedicated device cannot be used concurrently by several processes or threads. โ Speed of Operation:
โ Device speeds may range from a few bytes per second to a few gigabytes per second. โ Read-write read only or writes only: โ Some devices perform both input and output, but others support only one. โ Efficiency: โ Most input-output devices are extremely slow compared with the processor and the main memory and buffering is one way to deal with this issue. โ Generality: โ It is desirable to handle all devices in a uniform and consistent manner. โ It applies for both the way the user processes see the devices and the way the operating system manages the input output devices and operations.
- Input/output Hardware: โ (^) I/O devices can be divided into two categories: โ Block Devices: - A block device is one with which the driver communicates by sending entire blocks of data. - For example: Hard disk, USB cameras, Disk-On-Key etc. โ Character Devices: - A character device is one with the driver communicates by sending and receiving single characters (bytes, octets). - For example: Serial Ports, Parallel Ports, Sounds cards, etc. โ Device Controllers โ Device Drivers are software modules that can be plugged into an OS to handle a particular device. โ Operating System takes help from devices drivers to handle all I/O devices. โ Device Controller works like an interface between a device and a device driver. I/O units โ (keyboards, mouse, printer, etc) typically consist of a mechanical component and an electronic component where component is called the Device Controller.
โ Communication to I/O Devices โ The CPU must have a way to pass information to and from an I/O device. There are three approaches available to communicate with the CPU and Device. โ (^) Special Instruction I/O. โ Memory-Mapped I/O. โ Direct Memory Access (DMA). SPECIAL INSTRUCTION I/O: -
- This uses CPU instructions that are specifically made for controlling I/O devices. These instructions typically allow data to be sent to an I/O device or read from an I/O device. MEMORY-MAPPED I/O: -
- When using memory-mapped I/O, the same address space is shared by memory and I/O devices. The device is connected directly to certain main memory locations so that I/O device can transfer block of data to/from memory without going through CPU.
โ A device controller puts an interrupt signal on the bus when it needs CPUโs attention when CPU receives an interrupt, it saves its current state and invokes the appropriate interrupt handler using the interrupt vector (addresses of OS routines to handle various events). When the interrupting device has been dealt with, the CPU continues with its original task as if it had never been interrupted.
- Input/output Software: โ I/O software is often organized in the following layers โ โ User Level Libraries โ - This provides simple interface to the user program to perform input and output. For example, stdio is a library provided by C and C++ programming languages. โ Kernel Level Modules โ - This provides device driver to interact with the device controller and device independent I/O modules used by the device drivers. โ Hardware โ - This layer includes actual hardware and hardware controller which interact with the device drivers and makes hardware alive.
โ Device Drivers โ Device drivers are software modules that can be plugged into an OS to handle a particular device. โ Operating System takes help from device drivers to handle all I/O devices. โ Device drivers encapsulate device-dependent code and implement a standard interface in such a way that code contains device-specific register reads/writes. โ Device driver, is generally written by the device's manufacturer and delivered along with the device on a CD-ROM. โ A device driver performs the following jobs โ
- To accept request from the device independent software above to it.
- Interact with the device controller to take and give I/O and perform required error handling.
- Making sure that the request is executed successfully.
โ Interrupt Handlers
โ An interrupt handler, also known as an interrupt service routine or ISR, is a piece
of software or more specifically a call-back function in an operating system or more specifically in a device driver, whose execution is triggered by the reception of an interrupt.
โ When the interrupt happens, the interrupt procedure does whatever it has to in
order to handle the interrupt, updates data structures and wakes up process that was waiting for an interrupt to happen.
โ The interrupt mechanism accepts an address โ a number that selects a specific
interrupt handling routine/function from a small set.
โ User-Space I/O Software
โ These are the libraries which provide richer and simplified interface to access
the functionality of the kernel or ultimately interactive with the device drivers.
โ Most of the user-level I/O software consists of library procedures with some
exception like spooling system which is a way of dealing with dedicated I/O devices in a multiprogramming system.
โ I/O Libraries (e.g., stdio) are in user-space to provide an interface to the OS
resident device-independent I/O SW.
โ For example putchar(), getchar(), printf() and scanf() are example of user level
I/O library stdio available in C programming.
โ Kernel I/O Subsystem
โ Kernel I/O Subsystem is responsible to provide many services related to I/O.
Following are some of the services provided.
โข Scheduling โ Kernel schedules a set of I/O requests to determine a good
order in which to execute them. When an application issues a blocking I/ O system call, the request is placed on the queue for that device. The Kernel I/O scheduler rearranges the order of the queue to improve the overall system efficiency and the average response time experienced by the applications.
โข Buffering โ Kernel I/O Subsystem maintains a memory area known
as buffer that stores data while they are transferred between two devices or between a device with an application operation. Buffering is done to cope with a speed mismatch between the producer and consumer of a data stream or to adapt between devices that have different data transfer sizes.
โข Caching โ Kernel maintains cache memory which is region of fast
memory that holds copies of data. Access to the cached copy is more efficient than access to the original.
โข Spooling and Device Reservation โ A spool is a buffer that holds output
for a device, such as a printer, that cannot accept interleaved data streams. The spooling system copies the queued spool files to the printer one at a time. In some operating systems, spooling is managed by a system daemon process. In other operating systems, it is handled by an in kernel thread.
โข Error Handling โ An operating system that uses protected memory can
guard against many kinds of hardware and application errors.