Operating System Lecture Notes PDF

Document Details

Icon C. Obmerga

Tags

operating systems computer science system software computer architecture

Summary

This document provides an overview of operating systems, their purpose, and components. It covers topics including hardware and software components, operating system functions, and system structure. The document also explains how an operating system facilitates operation, and manages resources. The lecture notes also contain discussions about different operating system components and common OS structures.

Full Transcript

OPERATING SYSTEM Prepared by: ICON C. OBMERGA Instructor I OVERVIEW The computer system is composed of the hardware (computer itself), the software (programs or instructions installed in the hardware), and the people who use the hardware. The software maybe categorized as either systems...

OPERATING SYSTEM Prepared by: ICON C. OBMERGA Instructor I OVERVIEW The computer system is composed of the hardware (computer itself), the software (programs or instructions installed in the hardware), and the people who use the hardware. The software maybe categorized as either systems software or application software. The former are programs or instructions developed to handle the performance and control of the hardware while the latter are programs written to facilitate the work of the user. The hardware must provide appropriate mechanisms to ensure the correct operation of the computer system and to prevent user programs from interfering with the proper operation of the system. Internally, operating systems vary greatly in their makeup, since they are organized along many different lines. The design of a new operating system is a major task. It is important that the goals of the system be well defined before the design begins. These goals form the basis for choices among various algorithms and strategies. Because an operating system is large and complex, it must be created piece by piece. Each of these pieces should be a well delineated portion of the system, with carefully defined inputs, outputs, and functions. Operating systems for handheld computers are designed to provide an environment in which a user can easily interface with the computer to execute programs. Thus, some operating systems are designed to be convenient, others to be efficient, and others some combination of the two. INTRODUCTION To understand an operating system is to understand the workings of an entire computer system, because the operating system manages each and every piece of hardware and software. This module explores what operating systems are, how they work, what they do, and why. WHAT IS OPERATING SYSTEM? It is a program that manages all the resources of the computer system. It is a software component of the computer system that is responsible for the management and coordination of activities and the sharing of the resources of the computer. It is a program that acts as an intermediary between the user of the computer and the computer hardware. As such, it manages the communication among the different components of the computer system, the different application programs residing in memory and the user of the computer system. Further, it controls the whole computer system and acts as the supervisor that handles all activities within the hardware. It is intimately involved with everything inside the hardware like sending data here, retrieving data there, keeping everything in its place, and providing each component with matching orders. STEPS PERFORMED BY THE OPERATING SYSTEM WHEN THE USER SAVES THE DOCUMENT SHE IS DOING: 1. The user issues a save command while using an application program such as word processor. 2. The word processing application signals the operating system that a document must be saved to a disk. 3. The operating system communicates the document to the disk device driver for saving. 4. The disk device driver controls the disk drive as it saves the document. PURPOSE OF OPERATING SYSTEM 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. For the system, the operating system sustains the efficiency in the management and use of the computer system and its resources. For the user, the user-friendly operating system provides ease and accessibility. THE OPERATING SYSTEM ACTS AS: 1. Receptionist 2. Dispatcher 3. Security guard 4. Manager 5. Traffic officer 6. Accountant 1. Receptionist - it handles the user interface. As the computer is booted, the first point of contact will be the operating system. It is considered the welcoming committee which assists the user all throughout his/her contact with the hardware. 2. Dispatcher - it provides services for managing the queue of programs scheduled for processing and activation. 3. Security guard - it controls the access to the system and files. It prohibits unauthorized users access to the system. It also prevents user from accidentally or intentionally interfering with each other. 4. Manager, it handles the efficient allocation of resources. A resource is any object that can be allocated within the system. Examples are processor use, input/output devices, files and memory (RAM). It performs the following tasks: 1) Monitors resources continuously 2) Enforces policies and decides which gets what, how much and when 3) Allocates the resources 4) De-allocates the resources 5. Traffic officer - it directs the passage of data through the CPU and guides the CPU when to look in memory, when to read or write on the data storage, when to display on screen the data or provide a hard copy using the printer. 6. Accountant - it monitors the users who logs-on to the system, what kinds of resources are utilized by each user, and what resources are requested by each user. In other words, it keeps track of how a file has been accessed, who accessed it, what file, and when it was accessed. FUNCTIONS OF OPERATING SYSTEM 1. Convenience: An OS makes a computer more convenient to use. 2. Efficiency: An OS allows the computer system resources to be used in an efficient manner. 3. 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. EVOLUTION OF OPERATING SYSTEMS GENERATION TYPE OF DESCRIPTION OS 1st Gen. None Programmers operated the machine 1945-1955 themselves. 2nd Gen. Batch ▪ A type of system developed for the earliest 1955-1965 Operating computers that used punched cards or paper tapes as input and is entered in System “batches”. ▪ Jobs were processed serially without user interaction. ▪ Efficiency of the system was measured in throughput (the number of jobs completed in a given period of time) and turn-around (measured in hours or days) GENERATION TYPE OF DESCRIPTION OS Single User Operating An operating system controlled by one System user at a time who dealt with one set of input devices. Handheld computers and personal computers may be categorized for single user. Examples are DOS, Palm OS, Windows CE, Inferno, Newton OS, and Internet Tablet OS. GENERATION TYPE OF DESCRIPTION OS 3rd Gen Multiuser 1965-1985 Operating Allowed a single computer – often System mainframe – to deal with simultaneous input, output, and processing request from many users. The most difficult responsibility was to schedule all the processing requests that a centralized computer must perform. Examples are Linux, Unix, Windows 2000 and Windows XP. GENERATION TYPE OF DESCRIPTION OS Multi- programming The operating system that allows multiple Operating software processes to run simultaneously. Systems Also called multi-tasking operating system which can either be cooperative multitasking or preemptive multitasking. Cooperative multitasking hands over control to a program, sits back, and waits for the program to hand control back to the OS. In Preemptive multitasking, the OS is in control of the computer at all times. Examples are Unix, Windows NT, Mac OS, Windows 95, and Windows 9X. GENERATION TYPE OF DESCRIPTION OS Time Sharing Operating Also called Interactive systems. System A system that allows each user to interact directly with the operating system via commands entered from a keyboard. Services of the computer delivered directly to user via terminal. Security and access control became a problem Provides immediate feedback to the user and response time can be measured in minutes or seconds. GENERATION TYPE OF DESCRIPTION OS Personal OS used for personal computers which Computer supports single user environment. Operating OS is less complicated than mainframe System operating system Main goal is user-friendliness rather than resource optimization. Operating system designed for desktop, notebook, or tablet computer and usually used by a single user. Examples are Linux, Macintosh, MS-DOS, Windows 2000. GENERATION TYPE OF DESCRIPTION OS 4th gen 1985 Real Time ▪ Type of operating system that uses time as a Operating key parameter for its operation. System ▪ Also considered to be multi-tasking operating (RTOS) system intended for real-time applications such as programmable thermostat, household appliance controllers, mobile phones. ▪ It may be a Hard-Real Time OS or Soft Real- Time OS ▪ Hard Real-Time OS requires 100% compliance with the time requirement while Soft Real-Time OS is a type of real-time OS where in the time to complete a task can deviate from the original time constraint or is more flexible in terms of response time. GENERATION TYPE OF DESCRIPTION OS Real Time Operating Examples are JavaFx Mobile, System BeRTOS , INtime RTOS for Windows, (RTOS) iRMX (originally developed by Intel), OS-9 by Microware. GENERATION TYPE OF DESCRIPTION OS Embedded An OS implanted or rooted inside Operating System other pieces of equipment to control their operation. Usually perform dedicated function Examples are BlackBerry OS, embedded Linux, iPhone OS. GENERATION TYPE OF DESCRIPTION OS Network Operating Also known as Server Operating Systems, System Distributed Operating System or Loosely (NOS) Coupled System Enables a computer to communicate with other computers through network cable or wireless transmissions. Enables coordination of network communications from sharing files and printers to sending e-mail. GENERATION TYPE OF DESCRIPTION OS Network Operating Network Operating System creates a virtual System machine that extends beyond the (NOS) boundaries of the local system on which the user is working. It hides the underlying details of telecommunications and let the user see a huge pool of resources accessible as though they are connected to the computer. Examples are Novell NetWare, Windows NT, 2000, 2003, 2008 Server, Sun Solaris and IBM OS/2. GENERATION TYPE OF DESCRIPTION OS 5th gen Parallel An OS that will manage systems containing Operating hundreds or even thousands of processors. System Recognize opportunities for parallel execution, send the separate tasks to the appropriate processor, and coordinate their concurrent execution, all in a transparent way. Also known as Multi-processor Operating Systems or tightly coupled System. Examples are Linux, Unix, Windows NT OPERATING SYSTEM PLATFORM OPERATING SYSTEMS PLATFORM A platform is a description of the overall standard of a computer's hardware and/or software. In relation to hardware, it describes the set of hardware components that make up the computer itself and where the software is written, referred to as hardware architecture. In relation to software, it is an environment or a venue where other software are launched. For example, when referring to a hardware platform, X86 PLATFORM DESCRIPTION Microsoft Windows Windows collectively describes any or all of several generations of Microsoft (MS) operating system (OS) products developed by Microsoft Corporation usually categorized as 16 bit OS environment, hybrid 16/32 bit OS, 32 bit OS environment, and 64 bit OS. Examples are Windows XP, Windows Vista, Windows 2000, Windows 98, Windows ME and Windows CE. PLATFORM DESCRIPTION Linux A Unix-like operating systems built around the Linux Kernel written by Linus Torvalds. Developed as an open source and free software. Examples are BSD, GNU, MINIX, Reactos, Haiku. PLATFORM DESCRIPTION Solaris A Unix-Based operating system introduced by Sun Microsystems Developed originally as a proprietary software but now considered a mixed closed source / open source. Its open sourced software is OpenSolaris Examples are Solaris 10, Solaris 9, Solaris 2.5 PLATFORM DESCRIPTION MacOs Graphical user interface based operating systems developed by Apple Inc. for their Macintosh line of computer systems. Compatible with both PowerPC and Intel Processors. Considered a mixed closed source / open source. Its open source software is Darwin. Examples are Mac OS X, Apple DOS, A/UX, A/ROSE, Rhapsody, MkLinux, Taligent, and Lisa OS. SYSTEM STRUCTURE SYSTEM COMPONENTS SYSTEM COMPONENTS These components are physically connected using a system bus which is a set of parallel wires attached together that carries several bits at a time. There are three basic buses used in linking the different components: data bus address bus control bus. 1. DATA BUS Data bus is the common type of the system bus, It is used to transfer data from one components to another. It is an electrical path that connected the CPU memory and input-output devices and also secondary storage devices. Data bus consists of different parallel lines. A bus with more lines can transfer a large number of data. A bus with 16 lines can transfer 16 bits of data if the bus contain 32 line it transfers 32 bit of bus. In old computers the data bus is used to transfer the only one byte of data at a time. But nowadays our data bus in our modern computer can be used to transfer a more data that improve the speed and performance of the computer system data bus design in such a way that allow all the components to communicate with each other efficiently. 2. ADDRESS BUS Address bus is used to carry the address from one component to another. it also consists of different wires like a data bus. It is used to connect the central Processing Unit (CPU) and main memory, and main memory like RAM. When the CPU wants to transfer the data to the main memory and take the data from the main memory following steps are performed. CPU put the address of required data on the address bus The address has carried the address to the main memory the data from the main memory cache according to the address and put on the date bus. Then that carry the data to the CPU 3. CONTROL BUS This type of bus is used to transfer an address from one component to another. If the CPU wants to read data from the main memory or write data to the main memory. CPU can send a signal on the control was like a memory read our memory write If CPU wants to read data from the main memory put the signal of reading data on the control bus and if the CPU wants to write that on the main memory signal memory Write on the control bus. COMPUTER OPERATION THROUGH THE OPERATING SYSTEM The operating system must ensure the correct operation of the computer system. To ascertain that the user-programs do not interfere with the proper operation of the system, the hardware must provide appropriate mechanisms to assure correct behavior. The appropriate mechanism that makes a functional operating system which will ensure smooth operation should include hardware protection, I/O protection, CPU protection and memory protection. 1. HARDWARE PROTECTION Hardware must support two modes of operation such as user mode and monitor mode (sometimes called supervisor mode, system mode, and privilege mode). A mode bit is added to the hardware to identify the current mode. A mode bit of 1 means that the computer is currently executing on behalf of the user and a mode bit of 0 means that it is currently executing on behalf of the operating system. 3. MEMORY PROTECTION To protect user programs from one another and also protect it from the operating system, one possible way is to separate each program’s memory space by providing a range of legal addresses it can access. The hardware protection must use two registers namely, the base and limit registers. The base register holds the smallest legal physical address and the limit register provides the size of the range. Assuming Program 1 uses a base register = 100500 and a limit register = 12400. This means that Program 1 can only legally access memory address 100500 to 112900 inclusive. This method prevents the user program from intentionally or unintentionally modifying other user programs. 4. CPU PROTECTION To prevent a user program from getting stuck in an infinite loop, and never returning control to the operating system, a timer should be set to interrupt the hardware at specific time interval. Before relinquishing the control to the user program, the operating system ensures that a timer is set to interrupt. If the timer interrupts, control transfers automatically to the operating system, which may treat the interrupt as a fatal error or provide additional time to program to finish processing. The setting of an interrupt is a privilege instruction. A timer will protect the user program from running too long. Setting the timer to a 5 minute limit will initialize the counter to 300. Every second, the counter decrements by one and control is given to the user program as long as the counter is positive. Operating system takes control when the counter becomes negative. A timer is useful in implementing time sharing where in each user is given a time slice to execute. When the timer becomes negative, the operating system gives the floor to the next user and so on. OPERATING SYSTEM COMPONENTS Many processes compete for the attention of the microprocessor. In a given time, commands may be coming from program the user is currently using, inputs are coming in from the mouse and the keyboard, data are sent to the display screen or printer and web pages come from the internet connection. These are all competing for the attention of the operating system so that each of these processes will receive its share of the microprocessor cycle. With this scenario, the OS hands are full in controlling each of these processes waiting for their turn. This examples gives us an idea of the services done by OS. Each of these services is performed by a specific component of the OS. The basic components of the operating system resides in the kernel (see Figure 2.0), which is the central component of most computer operating systems. According to Jochen Liedtke, the kernel denotes the part of the operating system that is mandatory and common to all other software. Other names for kernel are nucleus or core. The primary purpose of the kernel is to manage the computer resources and allow programs to request and use resources. These resources found in Table 2.0 consist of the following: Figure 2.0 The Kernel COMPONENTS OF THE OPERATING SYSTEM COMPONENTS OF THE OPERATING SYSTEM SHELL A program(either in the kernel or as a special system application) which forms the interface between user and OS Separates the user from the OS details and presents the OS simply as a collection of services SHELL Includes the API (Application programming Interface) a software designed to communicate with the application software and the user. a program code that translates requests from an application into code that the operating system kernel can understand and pass on to the hardware device drivers, and translates data from the kernel and device drivers so the application can use it. provides an interface to the BIOS. SHELL A program that interfaces with the OS using CLI and/ or GUI Command Line Interface (CLI) features specific commands which are needed to be types through a keyboard to accomplish a specific task Graphical User Interface (GUI) features menus and icons which can be manipulated by clicking the mouse. SECONDARY STORAGE MANAGER Performs Free space management Provides Storage allocation Carries out Disk scheduling MEMORY MANAGER Manages memory Keeps track of the memory spaces needed by active processes and by the OS itself Brings in and swaps out blocks of data from the secondary storage PROCESS MANAGER Allocates resources to processes Enables processes to share and exchange information Protects the resources of each process from other processes Provides facilities for process sharing and synchronization Schedules the work done by the processor I/O MANAGER Provides buffer management ( region of memory that holds data while it is waiting to be transferred from one device to another) Allocates the I/o channels to communicate with specific device accepting commands to and/or receive data from devices which in turn interfaces with the OS and software application Includes device manager which controls communications with the systems peripheral devices such as keyboard, monitor, disks, tape drives, printers and modems. FILE MANAGER Service users and applications pertaining to the use of files Provides services on: How to create, delete, read and change files? How to move data between files? How to back up and recover files? How a user may rapidly access files? Guarantees that the files will not be corrupted and ensures security of access. SECURITY MANAGER Protects data and resources from disclosure Guarantees authenticity of data and messages Protect systems from network based attacks such as preventing users from accidentally or intentionally interfering with each other. Provide available applications to enforce security Provides tracking mechanism of requests for access to resources SYSTEM CALLS AND INTERRUPTS INTERRUPTS AND SYSTEM CALLS Processes inside the computer system need to send information to and from the processor and they expect to get the processor’s attention. This transfer of information may be handled by the processor in two ways: by either polling or interrupt. POLLING requires the processor to ask each device connected if it needs anything to be done. This situation warrants that the processor must extend a helping hand by asking everybody around who ever needs service. INTERRUPTS are signals or events which disrupts the normal processing of the processor. Here, the processor will just wait for any request from the device. It will only offer its services when demanded through a signal or a call for help. Polling is synonymous to a telephone without a ringer or in the silent mode where the person needs to check every second if there is somebody calling because there is no way of knowing if someone is on the other line. On the other hand, an interrupt is synonymous to a telephone with an active ringer which needs to be answered only when it rings. It is a common event within the computer system when either the hardware or the running program requests for an audience to settle some internal problems. When this call for help or an interrupt is received, the hardware automatically suspends whatever it is doing and runs to the rescue. If multiple interrupts occur, the call for help will be based on priority. As it runs to the rescue, programs that are currently running are marked to remember where it has left off. The interrupt can either be a hardware interrupt or a software interrupt. Hardware interrupt means that a specific device has demanded attention and the operating system decides how to deal with it. A program requesting for a specific hardware is considered a software interrupt but a printer issuing an “out of paper” message is a hardware interrupt. Invoking a software interrupt means automatically running a specific operating system routine in the form of instruction set. MOST COMMON CLASSES OF INTERRUPTS PROGRAM Conditions that occurs as a result of an instruction execution like: arithmetic overflow, division by zero, attempt to execute an illegal machine instruction, reference outside a user’s allowed memory space TIMER Generated by a timer within the processor Allows OS to perform certain functions on a regular basis I/O Generated by an I/O controller to signal normal completion of an operation HARDWARE FAILURE Generated by a failure such as power failure or memory parity error TYPES OF SYSTEM CALLS TYPES OF SYSTEM FUNCTION EXAMPLES OF CALLS SYSTEM CALL Process Control controls processes end, abort, load, execute, create/terminate process, wait for time, wait event, signal event, allocate and free memory, get/set process attributes TYPES OF SYSTEM CALLS TYPES OF SYSTEM FUNCTION EXAMPLES OF SYSTEM CALLS CALL Device manages request device, Management devices release device, read, write, get/set device attributes, reposition, logically attach or detach devices TYPES OF SYSTEM CALLS TYPES OF SYSTEM FUNCTION EXAMPLES OF SYSTEM CALLS CALL File manages create file, delete Management files file, open, close, read, write, reposition, get/set file attributes TYPES OF SYSTEM CALLS TYPES OF SYSTEM FUNCTION EXAMPLES OF SYSTEM CALLS CALL Information provides get/set time or date, Maintenance information get/set system data, about the get/set process system attributes, get/set device attributes TYPES OF SYSTEM CALLS TYPES OF SYSTEM FUNCTION EXAMPLES OF SYSTEM CALLS CALL Communications exchanges create, delete information communication with another connection, send, process receive messages, transfer status information, attach or detach remote devices OPERATING SYSTEMS STRUCTURES COMMON OS STRUCTURES 1. Simple Structure, early monolithic UNIX structure COMMON OS STRUCTURES Operating System Kernel Part of OS that resides in memory at all times, OS nucleus Core of the OS that coordinates operating system functions, such as control of memory and storage. Performs the most essential OS tasks, and is protected by hardware from user tampering. Portion of the OS which includes most heavily used portion of software COMMON OS STRUCTURES 2. Layered Approach Advantage of modularity which simplifies programming, testing and debugging Example: OS/2 Windows NT COMMON OS STRUCTURES 3. MicroKernel Approach is to keep the essential functionality in the kernel itself and provide everything also as a system program Main function is to communicate between user program and the services running in user / application space Use message passing Examples: MACH, Digital UNIX, MacOS COMMON OS STRUCTURES 4. Other Structures Hybrid Structure Given that microkernel merely acts as a server for client requests, it is possible to provide support for more than one API at a time with a separate server for each, router through the microkernel Example: Windows NT which support the interfaces Win32, POSIX, OS/2 Modular Kernel Similar to monolithic layer structure but allows for partial loading / running of various kernel components For Example, If PCMCIA card services are not required then the module which handles them is not loaded into the kernel at boot time Example: LINUX

Use Quizgecko on...
Browser
Browser