Operating Systems Past Paper PDF
Document Details
Uploaded by Deleted User
Tags
Summary
This document appears to be lecture notes or study material on operating systems. It covers topics such as operating system overview, instruction execution, interrupts, computer system organization, and I/O. It's likely intended for students studying computer science.
Full Transcript
SSUU20BBJEJECSCCPTTCCC40OO2DDEE TTOYYpPPerEEatinTTHEHEg SSSyUBUBstemJJEECTCTs NANAMEME HEHERERE UNIT NO 1 OPERATING SYSTEM OVERVIEW Operating Sy...
SSUU20BBJEJECSCCPTTCCC40OO2DDEE TTOYYpPPerEEatinTTHEHEg SSSyUBUBstemJJEECTCTs NANAMEME HEHERERE UNIT NO 1 OPERATING SYSTEM OVERVIEW Operating System Overview – Basic Elements, Instruction Execution, II Interrupts III 20CSPC401 OPERATING SYSTEMS 20CSPC402 Operating Systems UNIT I OPERATING SYSTEM OVERVIEW Computer System Overview-Basic Elements, Instruction Interrupts Execution, Memory Hierarchy, Cache Memory, Access, Direct Memory , Multiprocessor and Multicore Organization. Operating system overview- objectives and functions, Evolution of Operating System.- Computer System Organization Operating System Structure and Operations- System Calls, System Programs, OS Generation and System Boot. 20CSPC402 Operating Systems What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer hardware Operating system goals: ○ Execute user programs and make solving user problems easier. ○ Make the computer system convenient to use. ○ Use the computer hardware in an efficient manner. 20CSPC402 Operating Systems Computer System Structure - Abstract view of the components of a computer system 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 ○ Software and 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 20CSPC402 Operating Systems Four Components of a Computer System 20CSPC402 Operating Systems Operating System Definition 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 “The one program running at all times on the computer” is the kernel. (Along with the kernel, there are two other types of programs: system programs, which are associated with the operating system but are not necessarily part of the kernel, and Application programs, which include all programs not associated with the operation of the system.) 20CSPC402 Operating Systems Computer Startup Bootstrap program is loaded at power-up or reboot ○ Typically stored in ROM or EPROM, generally known as firmware ○ Initializes all aspects of system ○ Loads operating system kernel and starts execution ○ It initializes all aspects of the system, from CPU registers to device controllers to memory contents. ○ The bootstrap program must know how to load the operating system and how to start executing that system. ○ Once the kernel is loaded and executing, it can start providing services to the system and its users. ○ Some services are provided outside of the kernel, by system programs that are loaded into memory at boot time to become system processes, or system daemons that run the entire time the kernel is running. 20CSPC402 Operating Systems Computer System Organization Computer-system operation ○ One or more CPUs, device controllers connect through common bus providing access to shared memory ○ Concurrent execution of CPUs and devices competing for memory cycles 20CSPC402 Operating Systems Computer-System Operation I/O devices and the CPU can execute concurrently Each device controller is in charge of a particular device type Each device controller has a local buffer CPU moves data from/to main memory to/from local buffers I/O is from the device to local buffer of controller Device controller informs CPU that it has finished its operation by causing an interrupt I/O Structure ▪ System call – request to the OS to allow user to wait for I/O completion ▪ Device-status table contains entry for each I/O device indicating its type, address, and state ▪ OS indexes into I/O device table to determine device status and to modify table entry to include interrupt 20CSPC402 Operating Systems COMPUTER SYSTEM OVERVIEW: BASIC ELEMENTS OF A COMPUTER A computer consists of processor, memory, I/O components and system bus i)Processor: It Controls the operation of the computer and performs its data processing functions. When there is only one processor, it is often referred to as the central processing unit. ii)Main memory: It Stores data and programs. This memory is typically volatile; that is, when the computer is shut down, the contents of the memory are lost. Main memory is also referred to as real memory or primary memory. 20CSPC402 Operating Systems 20CSPC402 Operating Systems iii)I/O modules: It moves data between the computer and its external environment. The external environment consists of a variety of devices, including secondary memory devices (e. g., disks), communications equipment, and terminals. iv)System bus: It provides the communication among processors, main memory, and I/O modules. One of the processor’s functions is to exchange data with memory. For this purpose, it typically makes use of two internal registers i)A memory address registers (MAR), which specifies the address in memory for the next read or write. ii)A memory buffer register (MBR), which contains the data to be written into memory or which receives the data read from memory. 20CSPC402 Operating Systems An I/O address register (I/OAR) specifies a particular I/O device. An I/O buffer register (I/OBR) is used for the exchange of data between an I/O module and the processor. A memory module consists of a set of locations, defined by sequentially numbered addresses. An I/O module transfers data from external devices to processor and memory, and vice versa. It contains internal buffers for temporarily holding data until they can be sent on. 20CSPC402 Operating Systems PROCESSOR REGISTERS: A processor includes a set of registers that provide memory that is faster and smaller than main memory. Processor registers serve two functions: i)User-visible registers: Enable the machine or assembly language programmer to minimize main memory references by optimizing register use. ii)Control and status registers: Used by the processor to control the operation of the processor and by privileged OS routines to control the execution of programs. 1. User-Visible Registers: A user-visible register is generally available to all programs, including application programs as well as system programs. The types of User visible registers are i) Data Registers ii) Address Register 20CSPC402 Operating Systems Data Registers can be used with any machine instruction that performs operations on data. Address registers contain main memory addresses of data and instructions. Examples of address registers include the following: Index register. Segment pointer Stack pointer 2. Control and status register: A variety of processor registers are employed to control the operation of the processor. In addition to the MAR, MBR, I/OAR, and I/OBR register the following are essential to instruction execution: 20CSPC402 Operating Systems For the Interfacing with Primary Memory 20CSPC402 Operating Systems INSTRUCTION FETCH Program gets into the memory through an input device Execution of a program starts by setting the PC to point to the first instruction of the program. The contents of PC are transferred to the MAR and a Read control signal is sent to the memory The addressed word (here it is the first instruction of the program) is read out of memory and loaded into the MDR The contents of MDR are transferred to the IR for instruction decoding 20CSPC402 Operating Systems INSTRUCTION EXECUTION The operation field of the instruction in IR is examined to determine the type of operation to be performed by the ALU The specified operation is performed by obtaining the operand(s) from the memory locations or from GP registers. ✔ Fetching the operands from the memory requires sending the memory location address to the MAR and initiating a Read cycle. ✔ The operand is read from the memory into the MDR and then from MDR to the ALU. ✔ The ALU performs the desired operation on one or more operands fetched in this manner and sends the result either to memory location or to a GP register. ✔ The result is sent to MDR and the address of the location where the result is to be stored is sent to MAR and Write cycle is initiated. Thus, the execute cycle ends for the current instruction and the PC is incremented to point to the next instruction for a new fetch cycle. 20CSPC402 Operating Systems Interrupt Normal execution of programs may be interrupted if some device requires urgent servicing ✔ To deal with the situation immediately, the normal execution of the current program must be interrupted. Procedure of interrupt operation ✔ The device raises an interrupt signal ✔ The processor provides the requested service by executing an appropriate interrupt- service routine ✔ The state of the processor is first saved before servicing the interrupt Normally, the contents of the PC, the general registers, and some control information are stored in memory ✔ When the interrupt-service routine is completed, the state of the processor is restored so that the interrupted program may continue 20CSPC402 Operating Systems Classes of Interrupts Program ○ Generated by some condition that occurs as a result of an instruction execution such as arithmetic overflow, division by zero, attempt to execute an illegal machine instruction, or reference outside user’s allowed memory space Timer ○ Generated by a timer within the processor. This allows the operating system to perform certain functions on a regular basis I/O Generated by an I/O controller, to signal normal completion of an operation or to ○ signal a variety of error conditions Hardware failure ○ Generated by a failure such as power failure or memory parity error 20CSPC402 Operating Systems Interrupt Handling The operating system preserves the state of the CPU by storing registers and the program counter. Determines which type of interrupt has occurred: ○ Polling :It is specific type of I/O interrupt containing i/o interface that notifies a device is ready to read. ○ Vectored interrupt system: It directs the processor to the appropriate ISR. Separate segments of code determine what action should be taken for each type of interrupt. 20CSPC402 Operating Systems Interrupt Timeline 20CSPC402 Operating Systems Common Functions of Interrupts Interrupt transfers control to the interrupt service routine generally, through the interrupt vector, which contains the addresses of all the service routines Interrupt architecture must save the address of the interrupted instruction A trap or exception is a software-generated interrupt caused either by an error or a user request An operating system is interrupt driven 20CSPC402 Operating Systems VIDEO LINKS https://www.youtube.com/watch?v=jO75YV9viII&feature=emb_logo https://www.youtube.com/watch?v=a2B69vCtjOU&list=PL3-wYxbt4yCjpcfUDz- TgD_ainZ2K3MUZ&index=2 https://nptel.ac.in/courses/106/106/106106144/ - LEC 16 SSUU20BBJEJECSCCPTTCCC40OO1DDEE TTOYYpePPrEEatiTTngHEHESSSysUBUBtemJJEEsCTCT NANAMEME HEHERERE UNIT NO 1 OPERATING SYSTEM OVERVIEW 1.2 Memory Hierarchy, Cache Memory, Direct Memory Access II III 20CSPC401 OPERATING SYSTEMS 20CSPC401 Operating Systems Storage Definitions and Notation Review The basic unit of computer storage is the bit. A bit can contain one of two values, 0 and 1. All other storage in a computer is based on collections of bits. A byte is 8 bits, and on most computers it is the smallest convenient chunk of storage. A less common term is word, which is a given computer architecture’s native unit of data. A word is made up of one or more bytes. For example, a computer that has 64-bit registers and 64-bit memory addressing typically has 64-bit (8-byte) words. A computer executes many operations in its native word size rather than a byte at a time. 20CSPC401 Operating Systems Storage Definitions and Notation Review Computer storage, along with most computer throughput, is generally measured and manipulated in bytes and collections of bytes. A kilobyte, or KB, is 1,024 bytes a megabyte, or MB, is 1,0242 bytes a gigabyte, or GB, is 1,0243 bytes a terabyte, or TB, is 1,0244 bytes a petabyte, or PB, is 1,0245 bytes Computer manufacturers often round off these numbers and say that a megabyte is 1 million bytes and a gigabyte is 1 billion bytes. Networking measurements are an exception to this general rule; they are given in bits (because networks move data a bit at a time). 20CSPC401 Operating Systems Storage Hierarchy Storage systems organized in hierarchy ○ Speed ○ Cost ○ Volatility Caching – copying information into faster storage system; main memory can be viewed as a cache for secondary storage Device Driver for each device controller to manage I/O ○ Provides uniform interface between controller and kernel 20CSPC401 Operating Systems Storage-Device Hierarchy 20CSPC401 Operating Systems Memory Hierarchy - Diagram 20CSPC401 Operating Systems Performance Access time ○ Time between presenting the address and getting the valid data Memory Cycle time ○ Time may be required for the memory to “recover” before next access ○ Cycle time is access + recovery Transfer Rate ○ Rate at which data can be moved 20CSPC401 Operating Systems Caching Important principle, performed at many levels in a computer (in hardware, operating system, software) Information in use copied from slower to faster storage temporarily Faster storage (cache) checked first to determine if information is there ○ If it is, information used directly from the cache (fast) ○ If not, data copied to cache and used there Cache smaller than storage being cached ○ Cache management important design problem ○ Cache size and replacement policy 20CSPC401 Operating Systems Cache Small amount of fast memory Sits between normal main memory and CPU May be located on CPU chip or module 20CSPC401 Operating Systems Cache/Main Memory Structure 20CSPC401 Operating Systems Cache operation – overview CPU requests contents of memory location Check cache for this data If present, get from cache (fast) If not present, read required block from main memory to cache Then deliver from cache to CPU Cache includes tags to identify which block of main memory is in each cache slot 20CSPC401 Operating Systems Cache Read Operation - Flowchart 20CSPC401 Operating Systems Cache Design Size Mapping Function Replacement Algorithm Write Policy Block Size Number of Caches 20CSPC401 Operating Systems Size is important Cost ○ More cache is expensive Speed ○ More cache is faster (up to a point) ○ Checking cache for data takes time 20CSPC401 Operating Systems Typical Cache Organization 20CSPC401 Operating Systems Direct Mapping Each block of main memory maps to only one cache line ○ i.e. if a block is in cache, it must be in one specific place Address is in two parts Least Significant w bits identify unique word Most Significant s bits specify one memory block The MSBs are split into a cache line field r and a tag of s-r (most significant) 20CSPC401 Operating Systems Direct Mapping Address Structure Tag s-r Line or Slot r Word w 14 2 8 24 bit address 2 bit word identifier (4 byte block) 22 bit block identifier 8 bit tag (=22-14) 14 bit slot or line No two blocks in the same line have the same Tag field Check contents of cache by finding line and checking Tag 20CSPC401 Operating Systems Direct Mapping pros & cons Simple Inexpensive Fixed location for given block ○ If a program accesses 2 blocks that map to the same line repeatedly, cache misses are very high 20CSPC401 Operating Systems VIDEO LINKS https://www.youtube.com/watch?v=_eAL-v5oNOw https://nptel.ac.in/courses/106/105/106105163/ - [ Lecture 28 to Lecture 32] https://www.youtube.com/watch?v=MkR947q8hTs – Animation Video for Cache Memory https://www.youtube.com/watch?v=46dfG0nW3v4 - Animation Video for Cache Memory SSUU20BBJEJECSCCPTTCCC40OO1DDEE TTOYYpePPrEEatiTTngHEHESSSysUBUBtemJJEEsCTCT NANAMEME HEHERERE UNIT NO 1 OPERATING SYSTEM OVERVIEW 1.4.Multiprocessor and Multicore organization II III 20CSPC401 OPERATING SYSTEMS 20CSPC401 Operating Systems Computer-System Architecture Most systems use a single general-purpose processor ○ Most systems have special-purpose processors as well Multiprocessors systems growing in use and importance ○ Also known as parallel systems, tightly-coupled systems ○ Advantages include: 1. Increased throughput 2. Economy of scale 3. Increased reliability – graceful degradation or fault tolerance ○ Two types: 1. Asymmetric Multiprocessing – each processor is assigned a specific task. 2. Symmetric Multiprocessing – each processor performs all tasks 20CSPC401 Operating Systems Symmetric Multiprocessing Architecture 20CSPC401 Operating Systems A Dual-Core Design Multi-chip and multicore Systems containing all chips Chassis containing multiple separate systems 20CSPC401 Operating Systems Clustered Systems Like multiprocessor systems, but multiple systems working together ○ Usually sharing storage via a storage-area network (SAN) ○ Provides a high-availability service which survives failures Asymmetric clustering has one machine in hot-standby mode Symmetric clustering has multiple nodes running applications, monitoring each other ○ Some clusters are for high-performance computing (HPC) Applications must be written to use parallelization ○ Some have distributed lock manager (DLM) to avoid conflicting operations 20CSPC401 Operating Systems Clustered Systems 20CSPC401 Operating Systems Multiprogramming System Multiprogramming (Batch system) needed for efficiency ○ Single user cannot keep CPU and I/O devices busy at all times ○ Multiprogramming organizes jobs (code and data) so CPU always has one to execute ○ A subset of total jobs in system is kept in memory ○ One job selected and run via job scheduling ○ When it has to wait (for I/O for example), OS switches to another job 20CSPC401 Operating Systems Memory Layout for Multiprogrammed System 20CSPC401 Operating Systems Multiprocessor Operating System Multiprocessor operating system allows the multiple processors, and these processors are connected with physical memory, computer buses, clocks, and peripheral devices. Main objective of using a multiprocessor operating system is to consume high computing power and increase the execution speed of the system. 20CSPC401 Operating Systems Components of Multiprocessor Operating System There are four major components, which are used in the Multiprocessor Operating System. CPU – CPU is capable to access memories as well as controlling the entire I/O tasks. IOP – I/P processor can access direct memories, and every I/O processor has to be responsible for controlling all input and output tasks. Input / Output Devices – These devices are used for inserting the input commands, and producing output after processing. Memory Unit-Multiprocessor system uses the two types of memory modules such as shared memory and distributed shared memory. 20CSPC401 Operating Systems Types of Multiprocessor Operating System Symmetric Multiprocessor In this system, every processor has its own identical copy of the operating system, and they can make communication between each other. In which all processors are connected to each other with peer to peer relationship nature, it means no master & slave relation. 20CSPC401 Operating Systems Asymmetric Multiprocessor In this system, every processor is allotted predefined tasks, and the master processor has power for controlling the entire system. In which, It use the master- slave relationship. 20CSPC401 Operating Systems Shared Memory Multiprocessor In this system, each CPU contains sharable common memory. Distributed Memory Multiprocessor In this system, all types of processors consist of their own private memory. UMA Multiprocessor UMA Multiprocessor stands for “Uniform Memory Access Multiprocessor”. In which, it allows access to all memory at the uniform speed rate for all processors. NUMA Multiprocessor NUMA Multiprocessor stands for “Non Uniform Memory Access Multiprocessor”. In this system, it involves some areas of the memory for accessing at the faster rate, and left parts of memory are utilized for other tasks. Difference Between Asymmetric and Symmetric Multiprocessing: S. No. Asymmetric Multiprocessing Symmetric Multiprocessing ▪ In asymmetric multiprocessing, the processors are not treated 1. ▪ In symmetric multiprocessing, all the processors are treated equally. equally. 2. ▪ Tasks of the operating system are done by master processor. ▪ Tasks of the operating system are done individual processor. ▪ No Communication between Processors as they are controlled by the ▪ All processors communicate with another processor by a shared 3. master processor. memory. ▪ In asymmetric multiprocessing, process scheduling approach used is ▪ In symmetric multiprocessing, the process is taken from the ready 4. master-slave. queue. 5. ▪ Asymmetric multiprocessing systems are cheaper. ▪ Symmetric multiprocessing systems are costlier. 6. ▪ Asymmetric multiprocessing systems are easier to design. ▪ Symmetric multiprocessing systems are complex to design. 7. ▪ All processors can exhibit different architecture. ▪ The architecture of each processor is the same. ▪ It is complex as synchronization is required of the processors in order 8. ▪ It is simple as here the master processor has access to the data, etc. to maintain the load balance. ▪ In case a master processor malfunctions then slave processor ▪ In case of processor failure, there is reduction in the system’s 9. continues the execution which is turned to master processor. When a computing capacity. slave processor fails then other processors take over the task. 10. ▪ It is suitable for homogeneous or heterogeneous cores. ▪ It is suitable for homogeneous cores. 20CSPC401 Operating Systems Advantages of Multiprocessor Operating System There are list of several advantages of Multiprocessor operating system such as Great Reliability If due to any reason, any one processor fails then do not worry because, entire system will do work properly. For example – if a multiprocessor has 6 processors and any one processor does not perform properly, at this stage rest of them processors have to responsibilities for handling this system. Improve Throughput Enhancing the throughput of the system, the entire system is improved, if couples of processors work with getting collaboration. 20CSPC401 Operating Systems Advantages of Multiprocessor Operating System Cost Effective System Multiprocessor systems are cost effective compared to single processor systems in long life because this system is capable of sharing all input/output devices, power supplies systems, and data storage centers. In a multiprocessor, you do not need to connect all peripheral terminals separately with each processor. Parallel Processing Multiprocessor O/S gets high performance due to parallel processing. In this system, a single job is divided into various same small jobs, and executed as Parallel nature. 20CSPC401 Operating Systems Disadvantages of Multiprocessor Operating System Multiprocessors have complicated nature in both forms such as H/W and S/W. It is more expensive due to its large architecture. Multiprocessor operating system has a daunting task for scheduling processes due to its shareable nature. Multiprocessor system needs large memory due to sharing its memory with other resources. Its speed can get degraded due to fail any one processor It has more time delay when the processor receives a message and takes appropriate action. It has big challenges related to skew and determinism. It needs context switching which can impact its performance. Difference between MultiCore and MultiProcessor System S.No. MultiCore MultiProcessor A single CPU or processor with two or more independent processing units called cores that are A system with two or more CPU’s that allows 1. capable of reading and executing program simultaneous processing of programs. instructions. 2. It executes single program faster. It executes multiple programs Faster. More reliable since failure in one CPU will not 3. Not as reliable as multiprocessor. affect other. 4. It has less traffic. It has more traffic. 5. It does not need to be configured. It needs little complex configuration. It is Expensive (Multiple separate CPU’s that It’s very cheaper (single CPU that does not require 6. require system that supports multiple processors) multiple CPU support system). as compared to MultiCore. 20CSPC401 Operating Systems Characteristics of Multiprocessor Operating System There are numerous characteristics of Multiprocessor operating system, explain below The Multi processor system allows communication between multiple CPUs with their shared memory and input/output devices. Multi processor system can use different types of processor as per its own need, such as a central processing unit (CPU) or an input- output processor (IOP). Multiprocessors are split into multiple instruction streams and multiple data stream (MIMD) systems. Entire multi processor system is managed by the operating system, and it allows the communication between all processors and I/O devices as well. Multi processors have better reliability. If any processor fails due to any reason, then other processors can handle all functions of faulty processors. 20CSPC401 Operating Systems Characteristics of Multiprocessor Operating System Multiprocessor organization provides many benefits for enhancing the system performance. Multiprocessing system has an optimized architecture due to parallel processing. In multiprocessors use different compilers, those are able to identify the parallelism in a user’s program in automation mode. Main objective of using the compilers is to determine the all data dependency in the entire program. If, any program totally depends upon the data, which are created by other programs, then that data is executed firstly without getting any delay. If any data is executed concurrently, then other parts of the programs can use them. Multiprocessors are categorized with their memory management such as shared memory or tightly coupled multiprocessors. Every processor is known as a loosely coupled system because they contain their own private local memory. 20CSPC401 Operating Systems VIDEO LINKS https://www.youtube.com/watch?v=kOhxhhrTuC w https://www.youtube.com/watch?v=NVthAibTSCg SSUU20BBJEJECSCCPTTCCC40OO1DDEE TTOYYpePPrEEatiTTngHEHESSSysUBUBtemJJEEsCTCT NANAMEME HEHERERE UNIT NO 1 OPERATING SYSTEM OVERVIEW 1.4 Operating System overview, objectives, functions, Evolution of Operating System II III 20CSPC401 OPERATING SYSTEMS 20CSPC401 Operating Systems Introduction Definition History Of OS Types of Operating System (OS) Objectives of Operating System Characteristics of Operating System /Operating system Functions Features of Operating System (OS) Advantage of using Operating System Disadvantages of using Operating System 20CSPC401 Operating Systems INTRODUCTION An Operating System (OS) is an interface between a computer user and computer hardware. An operating system is a software which performs all the basic tasks like file management, memory management, process management, handling input and output, and controlling peripheral devices such as disk drives and printers. Some popular Operating Systems include Linux Operating System, Windows Operating System, VMS, OS/400, AIX, z/OS, etc. 20CSPC401 Operating Systems DEFINITION OF OPERATING SYSTEM An operating system is a program that acts as an interface between the user and the computer hardware and controls the execution of all kinds of programs. The OS helps you to communicate with the computer without knowing how to speak the computer's language. It is not possible for the user to use any computer or mobile device without having an operating system. 20CSPC401 Operating Systems HISTORY OF OS Operating systems were first developed in the late 1950s to manage tape storage The General Motors Research Lab implemented the first OS in the early 1950s for their IBM 701 In the mid-1960s, operating systems started to use disks In the late 1960s, the first version of the Unix OS was developed The first OS builtby Microsoft was DOS. It was builtin 1981 by purchasing the 86-DOS software from a Seattle company The present-day popular OS Windows first came to existence in 1985 when a GUI was created and paired with MS-DOS. 20CSPC401 Operating Systems OBJECTIVES OF OPERATING SYSTEM The objectives of the operating system are − To make the computer system convenient to use in an efficient manner. To hide the details of the hardware resources from the users. To provide users a convenient interface to use the computer system. To act as an intermediary between the hardware and its users, making it easier for the users to access and use other resources. To manage the resources of a computer system. To keep track of who is using which resource, granting resource requests, and mediating conflicting requests from different programs and users. To provide efficient and fair sharing of resources among users and programs. 20CSPC401 Operating Systems FUNCTIONS OF OPERATING SYSTEM Characteristics of Operating System /Operating system Functions: Following are some of the important 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 20CSPC401 Operating Systems FUNCTIONS OF OS 20CSPC401 Operating Systems MEMORY MANAGEMENT Memory Management An Operating System does the following activities for memory management − Keeps track of primary memory, i.e., what part of it are in use by whom, what part is 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. 20CSPC401 Operating Systems PROCESSOR MANAGEMENT An Operating System does the followingactivitiesfor processor management − Keeps tracks of processor and status of program process. The 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. 20CSPC401 Operating Systems DEVICE MANAGEMENT An Operating System manages device communication via their respective drivers. It does the following activities for device management − 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. 20CSPC401 Operating Systems FILE MANAGEMENT A file system is normally organized into directories for easy navigation and usage. These directories may contain files and other directions. An Operating System does the following activities for file management − 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. 20CSPC401 Operating Systems OTHER IMPORTANT ACTIVITIES Following are some of the important activities that an Operating System performs − 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. 20CSPC401 Operating Systems FEATURES OF OPERATING SYSTEM Here is a list important features of OS: Protected and supervisor mode Allows disk access and file systems Device drivers Networking Security Program Execution Memory management Virtual Memory Multitasking Handling I/O operations Manipulation of the file system Error Detection and handling Resource allocation Information and Resource Protection 20CSPC401 Operating Systems ADVANTAGES OF OPERATING SYSTEM Allows you to hide details of hardware by creating an abstraction Easy to use with a GUI Offers an environment in which a user may execute programs/applications The operating system must make sure that the computer system convenient to use hardware Operating System acts as an intermediary among applications and the components It provides the computer system resources with easy to use format Acts as an intermediary between all hardware and software of the system 20CSPC401 Operating Systems DISADVANTAGES OF OPERATING SYSTEM If any issue occurs in OS, you may lose all the contents which have been stored in your system Operating system's software is quite expensive for small size organizations which adds burden on them. Example Windows It is never entirely secure as a threat can occur at any time 20CSPC401 Operating Systems 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). ▪ Varies between Command-Line (CLI), Graphics User Interface (GUI), Batch ▪ 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 20CSPC401 Operating Systems Operating System Services ▪ One set of operating-system services provides functions that are helpful to the user (Cont.): ▪ 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 20CSPC401 Operating Systems Operating System Services Another set of OS functions exists for ensuring the efficient operation of the system itself via resource sharing 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 20CSPC401 Operating Systems A View of Operating System Services 20CSPC401 Operating Systems User Operating System Interface - CLI ▪ CLI or command interpreter allows direct command entry ▪ Sometimes implemented in kernel, sometimes by systems program ▪ Sometimes multiple flavors implemented – shells ▪ Primarily fetches a command from user and executes it ▪ Sometimes commands built-in, sometimes just names of programs ▪ If the latter, adding new features doesn’t require shell modification 20CSPC401 Operating Systems Bourne Shell Command Interpreter 20CSPC401 Operating Systems User Operating System Interface - GUI ▪ User-friendly desktop metaphor interface ▪ Usually mouse, keyboard, and monitor ▪ Icons represent files, programs, actions, etc ▪ Various mouse buttons over objects in the interface cause various actions (provide information, options, execute function, open directory (known as a folder) ▪ Invented at Xerox PARC ▪ Many systems now include both CLI and GUI interfaces ▪ Microsoft Windows is GUI with CLI “command” shell ▪ Apple Mac OS X is “Aqua” GUI interface with UNIX kernel underneath and shells available ▪ Unix and Linux have CLI with optional GUI interfaces (CDE, KDE, GNOME) 20CSPC401 Operating Systems Touchscreen Interfaces nTouchscreen devices require new interfaces lMouse not possible or not desired lActions and selection based on gestures lVirtual keyboard for text entry lVoice commands. 20CSPC401 Operating Systems The Mac OS X GUI 20CSPC401 Operating Systems Introduction What is an Operating System? Mainframe Systems Desktop Systems Multiprocessor Systems Distributed Systems Clustered System Real -Time Systems Handheld Systems Computing Environments 20CSPC401 Operating Systems What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer hardware. Operating system goals: Execute user programs and make solving user problems easier. Make the computer system convenient to use. Use the computer hardware in an efficient manner. 20CSPC401 Operating Systems Computer System Components 1. Hardware – provides basic computing resources (CPU, memory, I/O devices). 2. Operating system – controls and coordinates the use of the hardware among the various application programs for the various users. 3. Applications programs – define the ways in which the system resources are used to solve the computing problems of the users (compilers, database systems, video games, business programs). 4. Users (people, machines, other computers). 20CSPC401 Operating Systems Abstract View of System Components 20CSPC401 Operating Systems Operating System Definitions Resource allocator – manages and allocates resources. Control program – controlsthe execution of user programs and operations of I/O devices. Kernel – the one program running at all times (all else being application programs). 20CSPC401 Operating Systems Mainframe Systems Reduce setup time by batching similar jobs Automatic job sequencing – automatically transfers control from one job to another.First rudimentary operating system. Resident monitor initial control in monitor control transfers to job when job completes control transfers pack to monitor 20CSPC401 Operating Systems TYPES OF OS Following are the popular types of Operating System: Batch Operating System Multitasking/Time Sharing OS Multiprocessing OS Real Time OS Distributed OS Network OS Mobile OS 20CSPC401 Operating Systems Memory Layout for a Simple Batch System 20CSPC401 Operating Systems Multiprogrammed Batch Systems 20CSPC401 Operating Systems OS Features Needed for Multiprogramming I/O routine supplied by the system. Memory management – the system must allocate the memory to several jobs. CPU scheduling – the system must choose among several jobs ready to run. Allocation of devices. 20CSPC401 Operating Systems Time-Sharing Systems–Interactive Computing The CPU is multiplexed among several jobs that are kept in memory and on disk (the CPU is allocated to a job only if the job is in memory). A job swapped in and out of memory to the disk. On-line communication between the user and the system is provided; when the operating system finishes the execution of one command, it seeks the next “control statement” from the user’s keyboard. On-line system must be available for users to access data and code. 20CSPC401 Operating Systems Desktop Systems Personal computers – computer system dedicated to a single user. I/O devices – keyboards, mice, display screens, small printers. User convenience and responsiveness. Can adopt technology developed for larger operating system’ often individuals have sole use of computer and do not need advanced CPU utilization of protection features. May run several different types of operating systems (Windows, MacOS, UNIX, Linux) 20CSPC401 Operating Systems Parallel Systems Multiprocessor systems with more on CPU in close than communication. Tightly coupledsystem – processors share memory and a clock; communication usually takes place through the shared memory. Advantages of parallel system: Increased throughput Economical Increased reliability graceful degradation fail-soft systems 20CSPC401 Operating Systems Parallel Systems (Cont.) Symmetric multiprocessing (SMP) Each processor runs and identical copy of the operating system. Many processes can run at once without performance deterioration. Most modern operating systems support SMP Asymmetric multiprocessing Each processor is assigned a specific task; master processor schedules and allocated work to slave processors. More common in extremely large systems 20CSPC401 Operating Systems Symmetric Multiprocessing Architecture 20CSPC401 Operating Systems 20CSPC401 Operating Systems Distributed Systems Distribute the computation among several physical processors. Loosely coupledsystem – each processor has its own processors communicate with memory local one throug ; various communications another h lines, such as high-speed telephonebuses lines. or Advantages of distributed systems. Resources Sharing Computation speed up – load sharing Reliability Communications Requires networking infrastructure. Local area networks (LAN) or Wide area networks (WAN) May be either client-server or peer-to-peer systems. 20CSPC401 Operating Systems General Structure of Client-Server 20CSPC401 Operating Systems Clustered Systems Clustering allows two or more systems to share storage. Provides high reliability. Asymmetric clustering: one server runs the application while other servers standby. Symmetric clustering: all N hosts are running the application. 20CSPC401 Operating Systems Real-Time Systems Often used as a control device in a dedicated application such as controlling scientific experiments, medical imaging systems, industrial control systems, and some display systems. Well-defined fixed-time constraints. Real-Time systems may be either hard or soft real-time. 20CSPC401 Operating Systems Real-Time Systems (Cont.) Hard real-time: Secondary storage limited or absent, data stored in short term memory, or read-only memory (ROM) Conflicts with time-sharing systems, not supported by general- purpose operating systems. Soft real-time Limited utility in industrial control of robotics Useful in applications (multimedia, virtual reality) requiring advanced operating-system features. 20CSPC401 Operating Systems Handheld Systems Personal Digital Assistants (PDAs) Cellular telephones Issues: Limited memory Slow processors Small display screens. 20CSPC401 Operating Systems Migration of Operating-System Concepts and Features 20CSPC401 Operating Systems Computing Environments Traditional computing Web-Based Computing Embedded Computing 20CSPC401 Operating Systems VIDEO LINK https://www.youtube.com/watch?v=5c5AfNJn0Ik https://www.youtube.com/watch?v=vBURTt97EkA https://incomputersolutions.com/qa/what-is-operating-system-objectives-a nd- functions.html SSUU20BBJEJECSCCPTTCCC40OO1DDEE OTTYYpePPrEEatiTTngHEHESSSysUBUBtemJJEEsCTCT NANAMEME HEHERERE UNIT NO 1 OPERATING SYSTEM OVERVIEW 1.5 Computer System Organization, OS structures and operations, OS generation II III 20CSPC401 OPERATING SYSTEMS 20CSPC401 Operating Systems Computer-System Organization 1.2.1 Computer-System Operation 1.2.2 Storage Structure 1.2.3 I/O Structure 20CSPC402 Operating Systems Computer System Organization Computer-system operation ○ One or more CPUs, device controllers connect through common bus providing access to shared memory ○ Concurrent execution of CPUs and devices competing for memory cycles 20CSPC402 Operating Systems 1.2.1 Computer-System Operation I/O devices and the CPU can execute concurrently Each device controller is in charge of a particular device type Each device controller has a local buffer CPU moves data from/to main memory to/from local buffers I/O is from the device to local buffer of controller Device controller informs CPU that it has finished its operation by causing an interrupt 20CSPC401 Operating Systems 1.2.2 Storage Definitions and Notation Review The basic unit of computer storage is the bit. A bit can contain one of two values, 0 and 1. All other storage in a computer is based on collections of bits. A byte is 8 bits, and on most computers it is the smallest convenient chunk of storage. A less common term is word, which is a given computer architecture’s native unit of data. A word is made up of one or more bytes. For example, a computer that has 64-bit registers and 64-bit memory addressing typically has 64-bit (8-byte) words. A computer executes many operations in its native word size rather than a byte at a time. 20CSPC401 Operating Systems Storage Definitions and Notation Review Computer storage, along with most computer throughput, is generally measured and manipulated in bytes and collections of bytes. A kilobyte, or KB, is 1,024 bytes a megabyte, or MB, is 1,0242 bytes a gigabyte, or GB, is 1,0243 bytes a terabyte, or TB, is 1,0244 bytes a petabyte, or PB, is 1,0245 bytes Computer manufacturers often round off these numbers and say that a megabyte is 1 million bytes and a gigabyte is 1 billion bytes. Networking measurements are an exception to this general rule; they are given in bits (because networks move data a bit at a time). 20CSPC401 Operating Systems Storage Hierarchy Storage systems organized in hierarchy ○ Speed ○ Cost ○ Volatility Caching – copying information into faster storage system; main memory can be viewed as a cache for secondary storage Device Driver for each device controller to manage I/O ○ Provides uniform interface between controller and kernel 20CSPC401 Operating Systems Storage-Device Hierarchy 1.2.3 I/O Structure ▪ System call – request to the OS to allow user to wait for I/O completion ▪ Device-status table contains entry for each I/O device indicating its type, address, and state ▪ OS indexes into I/O device table to determine device status and to modify table entry to include interrupt 20CSPC401 Operating Systems OS STRUCTURES AND OPERATIONS- INTRODUCTION An operating system is a construct that allows the user application programs to interact with the system hardware. For efficient performance and implementation an OS should be partitioned into separate subsystems, each with defined tasks,inputs, outputs, and performance carefully characteristics. Operating systems structures. The structure can be implemented with the help of various of the OS depends of the operating mainly on how the various common components system are interconnected and melded into the kernel. 20CSPC401 Operating Systems SIMPLE STRUCTURE A common example of this is MS-DOS. MS-DOS – written to provide the most functionality in the least space. Not divided into modules Although MS-DOS has some structure, its interfaces and levels of functionality are not well separated It does break not the system into subsystems, and has no distinction between user and kernel modes, allowing all programs direct access to the underlying hardware. 20CSPC401 Operating Systems NON SIMPLE STRUCTURE- COMPLEX A common example of this is UNIX UNIX – limited by hardware functionality, the original UNIX operating system had limited structuring. The UNIX OS consists of two separable parts ○ Systems programs ○ The kernel Consists of everything below the system-call interface and above the physical hardware Provides the file system, CPU scheduling, memory management, and other operating-system functions; a large number of functions for one level 20CSPC401 Operating Systems NON SIMPLE STRUCTURE- COMPLEX 20CSPC401 Operating Systems Layered Approach 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. With modularity, layers are selected such that each uses functions (operations) and services of only lower-level layers 20CSPC401 Operating Systems Microkernel System Structure Moves as much from the kernel into user space Mach example of microkernel ○ Mac OS X kernel (Darwin) partly based on Mach Communication takes place between user modules using message passing Benefits: ○ Easier to extend a microkernel ○ Easier to port the operating system to new architectures ○ More reliable (less code is running in kernel mode) ○ More secure Detriments: ○ Performance overhead of user space to kernel space communication 20CSPC401 Operating Systems MICROKERNELS 20CSPC401 Operating Systems MODULES Many modern operating systems implement loadable kernel modules ○ Uses object-oriented approach ○ Each core component is separate ○ Each talks to the others over known interfaces ○ Each is loadable as needed within the kernel Overall, similar to layers but with more flexible ○ Linux, Solaris, etc 20CSPC401 Operating Systems MODULES 20CSPC401 Operating Systems HYBRID SYSTEMS Most modern operating systems are actually not one pure model ○ Hybrid combines multiple approaches to address performance, security, usability needs ○ Linux and Solaris kernels in kernel address space, so monolithic, plus modular for dynamic loading of functionality ○ Windows mostly monolithic, plus microkernel for different subsystem personalities Apple Mac OS X hybrid, layered, Aqua UI plus Cocoa programming environment ○ Below is kernel consisting of Mach microkernel and BSD Unix parts, plus I/O kit and dynamically loadable modules (called kernel extensions) 20CSPC401 Operating Systems Mac OS X Structure graphical user interface Aqua application environments and services Java Cocoa Quicktime BSD kernel environment BSD Mach I/O kit kernel extensions 20CSPC401 Operating Systems iOS Apple mobile OS for iPhone, iPad ○ Structured on Mac OS X, added functionality ○ Does not run OS X applications natively Also runs on different CPU architecture (ARM vs. Intel) ○ Cocoa Touch Objective-C API for developing apps ○ Media services layer for graphics, audio, video ○ Core services provides cloud computing, databases ○ Core operating system, based on Mac OS X kernel 20CSPC401 Operating Systems Android Developed by Open Handset Alliance (mostly Google) ○ Open Source Similar stack to IOS Based on Linux kernel but modified ○ Provides process, memory, device-driver management ○ Adds power management Runtime environment includes core set of libraries and Dalvik virtual machine ○ Apps developed in Java plus Android API Java class files compiled to Java bytecode then translated to executable than runs in Dalvik VM Libraries include frameworks for web browser (webkit), database (SQLite), multimedia, smaller libc 20CSPC401 Operating Systems Android Architecture Application Framework Libraries Android runtime SQLite openGL Core Libraries surface media Dalvik manager framework virtual machine webkit libc 20CSPC401 Operating Systems Operating-System Debugging Debugging is finding and fixing errors, or bugs OS generate log files containing error information Failure of an application can generate core dump file capturing memory of the process Operating system failure can generate crash dump file containing kernel memory Beyond crashes, performance tuning can optimize system performance ○ Sometimes using trace listings of activities, recorded for analysis ○ Profiling is periodic sampling of instruction pointer to look for statistical trends Kernighan’s Law: “Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” 20CSPC401 Operating Systems Performance Tuning Improve performance by removing bottlenecks OS must provide means of computing and displaying measures of system behavior For example, “top” program or Windows Task Manager 20CSPC401 Operating Systems DTrace DTrace tool in Solaris, FreeBSD, Mac OS X allows live instrumentation on production systems Probes fire when code is executed within a provider, capturing state data and sending it to consumers of those probes Example of following XEventsQueued system call move from libc library to kernel and back 20CSPC401 Operating Systems Dtrace (Cont.) DTrace code to record amount of time each process with UserID 101 is in running mode (on CPU) in nanoseconds 20CSPC401 Operating Systems Operating System Generation Operating systems are designed to run on any of a class of machines; the system must be configured for each specific computer site SYSGEN program obtains information concerning the specific configuration of the hardware system Used to build system-specific compiled kernel or system-tuned Can general more efficient code than one general kernel 20CSPC401 Operating Systems System Boot When power initialized on system, execution starts at a fixed memory location ○ Firmware ROM used to hold initial boot code Operating system must be made available to hardware so hardware can start it ○ Small piece of code – bootstrap loader, stored in ROM or EEPROM locates the kernel, loads it into memory, and starts it ○ Sometimes two-step process where boot block at fixed location loaded by ROM code, which loads bootstrap loader from disk Common bootstrap loader, GRUB, allows selection of kernel from multiple disks, versions, kernel options Kernel loads and system is then running 20CSPC401 Operating Systems System Boot When power initialized on system, execution starts at a fixed memory location ○ Firmware ROM used to hold initial boot code Operating system must be made available to hardware so hardware can start it ○ Small piece of code – bootstrap loader, stored in ROM or EEPROM locates the kernel, loads it into memory, and starts it ○ Sometimes two-step process where boot block at fixed location loaded by ROM code, which loads bootstrap loader from disk Common bootstrap loader, GRUB, allows selection of kernel from multiple disks, versions, kernel options Kernel loads and system is then running 20CSPC401 Operating Systems VIDEO LINK https://www.youtube.com/watch?v=LuG-14Da_J c SSUU20BBJEJECSCCPTTCCC40OO1DDEE OTTYYpePPrEEatiTTngHEHESSSysUBUBtemJJEEsCTCT NANAMEME HEHERERE UNIT NO 1 OPERATING SYSTEM OVERVIEW 1.6 System Calls, System Programs II III 20CSPC401 OPERATING SYSTEMS 20CSPC401 Operating Systems SYSTEM CALLS System call is the programmatic way in which a requests computer a service programfrom the kernel of the operating system it is executed on. A system call is a way for programs to interact with the operating system. A computer program makes a system call when it makes a request to the operating system’s kernel. System call provides the services of the operating system to the user programs via Application Program Interface(API). It provides an interface between a process and operating system to allow user-level processes to request services of the operating system. 20CSPC401 Operating Systems SYSTEM CALLS Example:-Consider that we have to write a program to read data from one file and to copy them to another file. The first input that the program will need is the names of the two files the input file and the output file. In an interactive system this approach will require a sequence of system calls first to write a prompting message on the screen and then to read from the keyboard the characters that define the two files. After file names are obtained , the program must open the input file and has to create the output file, Each of these operations require additional system calls Even simple programs may make heavy use of the operating systems. Frequently system executes thousands of system calls per second. Three of the most common API available to application Programmer are 1. Windows API for windows Systems 2. POSIX API (used virtually all versions of Unix, Linux and Mac OS 3. Java APL for Java Virtual Machine 20CSPC401 Operating Systems SYSTEM CALLS 20CSPC401 Operating Systems Example of Standard API 20CSPC401 Operating Systems 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 Managed by run-time support library (set of functions built into libraries included with compiler) 20CSPC401 Operating Systems SYSTEM CALLS The figure shows handling of a user application invoking open() system call 20CSPC401 Operating Systems 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 20CSPC401 Operating Systems Parameter Passing via Table 20CSPC401 Operating Systems SYSTEM CALLS C program invoking printf() library call, which call write() system Calls 20CSPC401 Operating Systems SYSTEM CALLS System Calls occur in different ways, depending on the computer in use. Often, more information is required than simply identify the system call. For Example, to get input, we may need to specify the file or device to use as the source, as well as the address and length of the memory Size Types of System Calls 1.Process Control 2.File Management 3.Device Management 4.Information Maintenance 5.Communication 6.Protection 20CSPC401 Operating Systems SYSTEM CALLS 1. Process control: end, abort load ,Execute create process, terminate process get process attribute, set process wait for attribute time event, Signal Event wait allocate and free memory. 2. File management: Create file, delete file open, close read, write ,reposition get file attributes, set file attributes 20CSPC401 Operating Systems SYSTEM CALLS 3. Device Management Request device, Release Device Read, Write, Reposition Get Device attributes, set device attributes Logically attach or detach device 5. Information Maintenance Get time or date, set time or date Get system date, set system date Get process, device attributes 20CSPC401 Operating Systems SYSTEM CALLS 5. Communications Create, delete communications connections Send, Receive message Transfer status information Attach or detach remote devices 6. Protection Set permission(), get permission() Allow_user(), deny_user() Control access to resources Get and set permissions Allow and deny user access 20CSPC401 Operating Systems SYSTEM CALLS Types of System Calls Windows Linux Process Control CreateProcess() fork() ExitProcess() exit() WaitForSingleObject() wait() File Management CreateFile() open() ReadFile() read() WriteFile() write() CloseHandle() close() Device Management SetConsoleMode() ioctl() ReadConsole() read() WriteConsole() write( ) 20CSPC401 Operating Systems SYSTEM CALLS Types of System Calls Windows Linux Information Maintenance GetCurrentProcessID() getpid() SetTimer() alarm( Sleep() ) sleep() Communication CreatePipe() pipe() CreateFileMapping() shmget( MapViewOfFile() ) mmap() 20CSPC401 Operating Systems SYSTEM PROGRAMS ★ According to Computer Hierarchy, one which comes at last is Hardware. ★ Then it is Operating System, System Programs, and finally Application Programs. ★ Program Development and conveniently in beSystem Execution can done Programs. ★ Some of System are complex. It Programs are simply user interfaces, others traditionally lies between user interface and system calls They can be divided into these categories 20CSPC401 Operating Systems Types of SYSTEM PROGRAMS File Manipulation These system programs are used to manipulate system files. This can be done using various commands like create, delete, copy, rename, print etc. These commands can create files, delete files, copy the contents of one file into another, rename files, print them etc. Status Information The status information system programs provide required data on the current or past status of the system. This may include the system date, system time, and available memory in system, disk space, logged in users etc. File Modification System programs that are used for file modification basically change the data in the file or modify it in some other way. Text editors are a big example of file modification system programs. 20CSPC401 Operating Systems SYSTEM PROGRAMS Programming Language Support These system programs provide additional support features for different programming languages. Some examples of these are compilers, debuggers etc. These compile a program and make sure it is error free respectively. Program Loading and Execution The system programs that deal with program loading and execution make sure that programs can be loaded into memory and executed correctly. Loaders and Linkers are a prime example of this type of system programs. Communications These system programs are needed for system communications such as web browsers. Web browsers allow systems to communicate and access information from the network as required. 20CSPC401 Operating Systems SYSTEM PROGRAMS Application Programs Application programs can perform a wide range of services as per the needs of the users. These include programs for database systems, word processors, plotting tools, spreadsheets, games, scientific applications etc. 20CSPC401 Operating Systems System Programs System programs provide a convenient environment for program development and execution. They can be divided into: ○ File manipulation ○ Status information sometimes stored in a File modification ○ Programming language support ○ Program loading and execution ○ Communications ○ Background services ○ Application programs Most users’ view of the operation system is defined by system programs, not the actual system calls 20CSPC401 Operating Systems System Programs Provide a convenient environment for program development and execution ○ Some of them are simply user interfaces to system calls; others are considerably more complex File management - Create, delete, copy, rename, print, dump, list, and generally manipulate files and directories Status information ○ Some ask the system for info - date, time, amount of available memory, disk space, number of users ○ Others provide detailed performance, logging, and debugging information ○ Typically, these programs format and print the output to the terminal or other output devices ○ Some systems implement a registry - used to store and retrieve configuration information 20CSPC401 Operating Systems System Programs (Cont.) File modification ○ Text editors to create and modify files ○ Special commands to search contents of files or perform transformations of the text Programming-language support - Compilers, assemblers, debuggers and interpreters sometimes provided Program loading and execution- Absolute loaders, relocatable loaders, linkage editors, and overlay-loaders, debugging systems for higher-level and machine language Communications - Provide the mechanism for creating virtual connections among processes, users, and computer systems ○ Allow users to send messages to one another’s screens, browse web pages, send electronic-mail messages, log in remotely, transfer files from one machine to another 20CSPC401 Operating Systems System Programs (Cont.) Background Services ○ Launch at boot time Some for system startup, then terminate Some from system boot to shutdown ○ Provide facilities like disk checking, process scheduling, error logging, printing ○ Run in user context not kernel context ○ Known as services, subsystems, daemons Application programs ○ Don’t pertain to system ○ Run by users ○ Not typically considered part of OS ○ Launched by command line, mouse click, finger poke SSUU20BBJEJECSCCPTTCCC40OO1DDEE OTTYYpePPrEEatiTTngHEHESSSysUBUBtemJJEEsCTCT NANAMEME HEHERERE UNIT NO 1 OPERATING SYSTEM OVERVIEW 1.7 EVOLUTION OF OS,OS GENERATION AND SYSTEM BOOT II III 20CSPC401 OPERATING SYSTEMS EVOLUTION OF OPERATING SYSTEM Below are four generations of operating systems. The First Generation The Second Generation The Third Generation The Fourth Generation First Generation (Serial Processing) (1940 to early 1950s) Time Period: The 1940s and 1950s marked the start of electronic computers. They were the new trend, replacing old mechanical ones. Size and Cost: These early computers were huge! And they came with a big price tag too. Basic Functions: Despite their size and cost, they could only do simple tasks. No Operating System: Imagine a computer without an operating system! That’s how they were. They just did tasks one by one. Serial Processing: This means they finish one task before starting the next. No multitasking here! Limitations of First Generation Wasted Power: The main computer brain, the CPU, often just sat there doing nothing. It waited a lot, especially during tasks like reading data, which wasted its power. One Task at a Time: These systems were like a person who can’t multitask. They could only handle one job at a time, making things slow. Long Wait Times: Imagine giving someone a job and waiting ages to see the result. That’s how these systems were. You’d give them a task, and it took forever to get the outcome. Second Generation (Batch System)(1950-60) Due to the inefficiencies of serial processing, the need for a more optimized approach became evident. This led to the development of a batch-processing system. This era (1950-60) is called the second generation of operating systems. In a batch system, similar tasks (or jobs) are grouped into batches and then processed sequentially without any user interaction. The goal was to automate the processing of jobs and minimize the setup time. A scripting language, Job Control Language (JCL), was introduced to manage these batches. It allows operators to specify the sequence of jobs to be executed. Advantages The system optimizes the processing sequence by grouping similar tasks, reducing the overhead and setup time between jobs. It allows for automated processing of tasks, i.e., reduces the need for manual intervention. The system could better utilize CPU and minimum idle time by processing tasks in batches. Limitations It lacks real-time user interaction, i.e., users have to wait for the entire batch to be processed. If the batches contain multiple tasks, giving output takes a longer time. Once the batch is processed, corrections can’t be done. Third Generation (Multi-Programmed Batch System) In the previous two generations, the systems ran jobs one at a time in sequence, which was efficient because the CPU had to wait for I/O operations to complete. To overcome this, multiprogramming was introduced in the next generations of operating systems. Multiprogramming allows multiple jobs to reside in the main memory at once, i.e., the CPU could switch to another job if one job needs to wait for I/O operation. Due to multi-programming CPU could process more jobs in a given amount of time. Since multiple jobs are done at once, there was a need for more advanced memory management. These memory needs led to the development of concepts such as memory partitioning, paging, and segmentation. Since multiple jobs are done at a time, it is important to decide which job to execute first, second, or last. Algorithms like First-Come-First-Serve, Shortest Job Next (SJN), and Round Robin are developed. The complexity of the OS was increased, and system utilities were developed to help manage files, devices, and other system resources. Operating systems were accompanied by hardware like Integrated Circuit, which allowed for smaller, faster, and more reliable computers. Fourth Generation (Time-Sharing Operating System) The fourth-generation operating system was more commonly associated with programming languages that were close to human language and often used for database-related tasks. The fourth generation has features like: Graphical User Interface that allows users to interact with the system using windows, icons, and menus. Ability to run multiple applications simultaneously. Built-in capabilities to connect to and function on networks, including the Internet. Automatically recognize and configure hardware devices. Advanced security mechanism to protect against malware, unauthorized access. Compatibility with a wide range of hardware devices and architecture. The OS allocates a small time slice or quantum to each task. Advantages of Operating System User-friendly: Makes computers easy to use. Manages resources: Handles CPU, memory, and storage well. Multitasking: This lets you run many apps at once. Error handling: Keeps the system running smoothly. Developer-friendly: Ensures apps work well and consistently. Disadvantages of the Operating System Can Perform Slow: Extra software layer might reduce speed. Needs specific setups: It might not work well on old computers. Can be costly: Some, like Windows or macOS, aren’t free. Software limits: Not all apps work on every system. Learning new systems: Switching can be tough for users. 20CSPC401 Operating Systems SYSTEM GENERATION (SYSGEN) The OS program is normally distributed on disk or tape. A special program SYSGEN reads from a given file and asks the operator regarding specific configuration of the system. ○ Probes the hardware directly to determine what components are there. Regenerate/Configure the OS for new machine parameters CPU type Machine parameters include Memory size, I/O device parameters, address maps etc. Mechanisms describe how things are done Devices Options of OS CPU scheduling algorithm, buffer size. 20CSPC401 Operating Systems OPERATING SYSTEM GENERATION Operating systems are designed to run on any of a class of machines ○ The system must be configured or generated for each specific computer site SYSGEN program obtains information concerning the specific configuration of the hardware system ○ Read from file, ask the operator or probe ○ Generation methods Modify source code and completely recompile Select modules from precompiled library and link together 20CSPC401 Operating Systems OPERATING SYSTE