Operating Systems (CSEN1101) Past Paper PDF
Document Details
Uploaded by FreeGarnet6291
GITAM
2023
Tags
Summary
This document contains lecture notes and syllabus for a course on Operating Systems (CSEN1101) from the GITAM University's Department of CSE, GST in 2023. The course covers various modules of operating systems, ranging from operating system structures to process management and security.
Full Transcript
OPERATING SYSTEMS (CSEN1101) 10 January 2023,09:00-09:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 1 Course Educational Objectives: ❖ To introduce students with basic concepts of operating s...
OPERATING SYSTEMS (CSEN1101) 10 January 2023,09:00-09:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 1 Course Educational Objectives: ❖ To introduce students with basic concepts of operating system, its functions, and services. ❖ To provide the basic concepts of process management and synchronization. ❖ To familiarize the dead lock issues. ❖ To understand the various memory management schemes. ❖ To give exposure over mass storage structures and System protection. 10 January 2023,09:00-09:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 2 SYLLABUS Module - I Operating System Structures: 8L Introduction: What operating systems do, computer system organization, computer-system architecture, operating system structure, resource management, Protection and security, kernel data structures Operating system Structures: operating system services, system calls, loaders and linkers, operating system structure, building and booting an operating system. 10 January 2023,09:00-09:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 3 SYLLABUS Module - II Process Management and CPU Scheduling 8 L Process Management: Process concepts, process scheduling, Operations on processes, inter- process communication CPU Scheduling: Multithreaded programming, Multi-core Programming, Multi-threading Models, Scheduling-criteria, scheduling algorithms, algorithm evaluation. 10 January 2023,09:00-09:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 4 SYLLABUS Module - III Process Synchronization and Deadlock 8 L Process Synchronization: Critical section problem, Peterson's solution, synchronization hardware, Mutex locks, semaphores, monitors, classic problems of synchronization. Deadlock: System model, deadlock characterization, deadlock prevention, deadlock avoidance, deadlock detection, recovery from deadlock.. 10 January 2023,09:00-09:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 5 SYLLABUS Module - IV Memory Management and Virtual memory 8 L Memory Management: Swapping, contiguous memory allocation, paging, segmentation, structure of page the table. Virtual memory: Demand paging, Copy-on-Write, page-replacement, allocation of frames, thrashing. 10 January 2023,09:00-09:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 6 SYLLABUS Module - V Mass-storage structure and System Protection 8 L File Concepts: File concept, access Methods, directory and disk structure, protection Mass-storage structure: Overview of Mass-Storage Structure, disk scheduling, Swap space management. System Protection: Goals of protection, principles of protection, Domain of protection, Access matrix. 10 January 2023,09:00-09:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 7 Text Book(s) : 1. Abraham Silberchatz, Peter B. Galvin, Greg Gagne, Operating System Concepts, 10/e, John Wiley, 2018. References : 1. Andrew S Tanenbaum, Modern Operating Systems, 2/e, Pearson/PHI, 2014. 2. Crowley, Operating System- A Design Approach, McGraw-Hill, 2012. 3. Stallings, Operating Systems - Internal and Design Principles, 5/e, 2013. 4. Pal Chaudhary, Operating system principles & Design, 1/e, PHI Learning, 2013. 5. Deitel and Deitel, Operating System, Pearson Education, 2003. 6. D.M. Dhamdhere, Operating systems- A Concept based Approach,2/e, McGraw Hill, 2010.. 10 January 2023,09:00-09:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 8 Course Outcomes: After successful completion of the course the student will be able to: ❖ Illustrate the basic and overall view of operating system ❖ Analyze the concept of a process, process life cycle, process states and state transitions ❖ Implement and practice CPU scheduling strategies, process synchronization techniques and memory- management schemes ❖ Simplify and resolve Deadlock handling situation ❖ Evaluate Disk storage management, protection and security mechanisms 10 January 2023,09:00-09:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 9 CO-PO Mapping: P01 PO2 P03 PO4 P05 P06 P07 P08 P09 P010 P011 P012 PS01 PS02 PS03 CO1 2 2 CO2 2 3 CO3 3 3 2 2 1 1 C04 1 1 1 CO5 1 1 1 Note: 1- Low Correlation 2 - Medium Correlation 3 - High Correlation 10 January 2023,09:00-09:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 10 SYLLABUS Module - I Operating System Structures: 8L Introduction: What operating systems do, computer system organization, computer-system architecture, operating system structure, resource management, Protection and security, kernel data structures Operating system Structures: operating system services, system calls, loaders and linkers, operating system structure, building and booting an operating system. 10 January 2023,09:00-09:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 11 Learning Outcomes: After completion of this unit, the student will be able to ❖ Explain the main responsibilities of an operating system (OS) and the history leading to their current form(L2) ❖ List the most fundamental subsystems and services of OS (L1) ❖ Analyze and list out different system calls (L4) 10 January 2023,09:00-09:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 12 INTRODUCTION ✔ An operating system is a program that manages a computer’s hardware. It also provides a basis for application programs and acts as an intermediary between the computer user and the computer hardware. ✔ Operating systems for mobile computers 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 to be some combination of the two. ✔ 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. 10 January 2023,09:00-09:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 13 INTRODUCTION ✔ The operating system is a system program that serves as an interface between the computing system and the end-user. ✔ Operating systems create an environment where the user can run any programs or communicate with software or applications in a comfortable and well-organized way. ✔ It also helps to manage the software/hardware resource, such as file management, memory management, input/ output and many peripheral devices like a disk drive, printers, etc. 10 January 2023,09:00-09:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 14 Generations of Operating System 1. The First Generation (1940 to early 1950s): 🡪 Created without any operating system. 🡪 Write a program for each task in absolute machine language. 🡪 Solve only simple mathematical calculations. 2. The Second Generation (1955 - 1965) 🡪 First operating system (OS) was created in the early 1950s and was known as GMOS. 🡪 General Motors has developed OS for the IBM computer. 🡪 It collects all similar jobs in groups or batches and then submits the jobs to the operating system using a punch card to complete all jobs in a machine. 10 January 2023,09:00-09:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 15 Generations of Operating System 3. The Third Generation (1965 - 1980): 🡪 New operating system that could simultaneously perform multiple tasks in a single computer program called multiprogramming. 🡪 CPU to be busy every time by performing different tasks on a computer at the same time. 🡪 Solve only simple mathematical calculations. 4. The Fourth Generation (1980 - Present Day): 🡪 Operating systems is related to the development of the personal computer. 🡪 A major factor related to creating personal computers was the birth of Microsoft and the Windows operating system. Microsoft created the first window operating system in 1975. 🡪 Introduced the MS-DOS in 1981, it was very difficult for the person to understand its cryptic commands. 10 January 2023,09:00-09:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 16 ⮚ Windows released various operating systems such as Windows 95, Windows 98, Windows XP and the latest operating system, Vista, Windows 7, Windows 8, Windows 10. ⮚ Introduced the Microsoft Windows OS by Bill Gates and Paul Allen. ⮚ Apple is another popular operating system built in the 1980s, and this operating system was developed by Steve Jobs, a co-founder of Apple. They named the operating system Macintosh OS or Mac OS. 10 January 2023,09:00-09:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 17 Advantages of Operating System ⮚ It is helpful to monitor and regulate resources. ⮚ It can easily operate since it has a basic graphical user interface to communicate with your device. ⮚ It is used to create interaction between the users and the computer application or hardware. ⮚ The performance of the computer system is based on the CPU. ⮚ The response time and throughput time of any process or program are fast. ⮚ It can share different resources like fax, printer, etc. ⮚ It also offers a forum for various types of applications like system and web application. 10 January 2023,09:00-09:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 18 Disadvantage of the Operating System ⮚ It allows only a few tasks that can run at the same time. ⮚ If any error occurred in the operating system; the stored data can be destroyed. ⮚ It is a very difficult task for the OS to provide entire security from the viruses because any threat or virus can occur at any time in a system. ⮚ An unknown user can easily use any system without the permission of the original user. ⮚ The cost of operating system costs is very high. 10 January 2023,09:00-09:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 19 Types of Operating System 1. Batch Operating System 2. Time-Sharing Operating System 3. Embedded Operating System 4. Multiprogramming Operating System 5. Network Operating System 6. Distributed Operating System 7. Multiprocessing Operating System 8. Real-Time Operating System 31 January 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 20 1. Batch Operating System ⮚ In Batch Operating System, there is no direct interaction between user and computer. ⮚ Therefore, the user needs to prepare jobs and save offline mode to punch card or paper tape or magnetic tape. ⮚ After creating the jobs, hand it over to the computer operator; then the operator sort or creates the similar types of batches like B2, B3, and B4. ⮚ Now, the computer operator submits batches into the CPU to execute the jobs one by one. ⮚ After that, CPUs start executing jobs, and when all jobs are finished, the computer operator provides the output to the user. 31 January 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 21 2. Time-Sharing Operating System ⮚ It is the type of operating system that allows us to connect many people located at different locations to share and use a specific system at a single time. ⮚ It represents the CPU's time is shared between many user processes. Or, the processor's time that is shared between multiple users simultaneously termed as time-sharing. 31 January 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 22 3. Embedded Operating System ⮚ The Embedded operating system is the specific purpose operating system used in the computer system's embedded hardware configuration. ⮚ Ex:diGSTal home assistants, and the internet of things (IoT) devices. 31 January 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 23 4. Multiprogramming Operating System ⮚ A multiprogramming operating system refers to the concepts wherein two or more processes or programs activate simultaneously to execute the processes one after another by the same computer system. ⮚ When a program is in run mode and uses CPU, another program or file uses I/O resources at the same time or waiting for another system resources to become available. ⮚ It improves the use of system resources, thereby increasing system throughput. 31 January 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 24 5. Network Operating System ⮚ The operating system that operates on a server using network devices like a switch, router, or firewall to handle data, applications and other network resources. ⮚ It provides connectivity among the autonomous operating system, called as a network operating system. ⮚ The network operating system is also useful to share data, files, hardware devices and printer resources among multiple computers to communicate with each other. ⮚ There are two types: Peer-to-peer network operating system, Client-Server network operating system. 31 January 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 25 6. Distributed Operating system ⮚ A distributed operating system provides an environment in which multiple independent CPU or processor communicates with each other through physically separate computational nodes. ⮚ With the ease of a distributed system, the programmer or developer can easily access any operating system and resource to execute the computational tasks and achieve a common goal. ⮚ It is the extension of a network operating system that facilitates a high degree of connectivity to communicate with other users over the network. 31 January 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 26 7. Multiprocessing Operating System ⮚ It is the type of operating system that refers to using two or more central processing units (CPU) in a single computer system. ⮚ However, these multiprocessor systems or parallel operating systems are used to increase the computer system's efficiency. ⮚ With the use of a multiprocessor system, they share computer bus, clock, memory and input or output device for concurrent execution of process or program and resource management in the CPU. 31 January 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 27 8. Real-Time Operating System ⮚ A real-time operating system is used to provide services and data processing resources for applications in which the time interval required to process & respond to input/output should be so small without any delay real-time system. ⮚ For example, real-life situations governing an automatic car, traffic signal, nuclear reactor or an aircraft require an immediate response to complete tasks within a specified time delay. ⮚ Types of the real-time operating system: Hard Real-Time System, Soft Real-Time System 31 January 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 28 What Operating Systems Do ⮚ The hardware—the central processing unit (CPU), the memory, and the input/output (I/O) devices—provides the basic computing resources for the system. ⮚ The application programs—such as word processors, spreadsheets, compilers, and Web browsers—define the ways in which these resources are used to solve users’ computing problems. ⮚ The operating system controls the hardware and coordinates its use among the various application programs for the various users. 31 January 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 29 User View: ⮚ The user’s view of the computer varies according to the interface being used. ⮚ Single User System: The goal is to maximize the work (or play) that the user is performing. Resource utilization—how various hardware and software resources are shared. ⮚ Mainframe or a minicomputer: These users share resources and may exchange information. Designed to maximize resource utilization by using resources efficiently. ⮚ Workstations: connected to networks of other workstations and servers. These users have dedicated resources at their disposal, but they also share resources such as networking and servers. ⮚ Some computers have little or no user view. For example, embedded computers in home devices and automobiles may have numeric keypads and may turn indicator lights on or off to show status, but they and their operating systems are designed primarily to run without user intervention 31 January 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 30 System View: ⮚ We can view an operating system as a resource allocator. ⮚ Facing numerous and possibly conflicting requests for resources, the operating system must decide how to allocate them to specific programs and users so that it can operate the computer system efficiently and fairly. ⮚ An operating system is a control program. ⮚ A control program manages the execution of user programs to prevent errors and improper use of the computer. It is especially concerned with the operation and control of I/O devices. 31 January 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 31 Computer-System Organization Computer-System Operation: ✔ when it is powered up or rebooted—it needs to have an initial program to run. This initial program, or bootstrap program ✔ Typically, it is stored within the computer hardware in read-only memory (ROM). ✔ 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. 1 February 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 32 ⮚ The occurrence of an event is usually signaled by an interrupt from either the hardware or the software. ⮚ Hardware may trigger an interrupt at any time by sending a signal to the CPU. ⮚ Software may trigger an interrupt by executing a special operation called a system call. ⮚ When the CPU is interrupted, it stops what it is doing and immediately transfers execution to a fixed location. ⮚ The interrupt service routine executes; on completion, the CPU resumes the interrupted computation. 1 February 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 33 Computer-System Organization Storage Structure: ✔ The CPU can load instructions only from memory, so any programs to run must be stored there. ✔ General-purpose computers run most of their programs from rewritable memory, called main memory (also called random-access memory, or RAM). ✔ All forms of memory provide an array of bytes. Each byte has its own address. Interaction is achieved through a sequence of load or store instructions to specific memory addresses. ✔ The load instruction moves a byte or word from main memory to an internal register within the CPU. ✔ The store instruction moves the content of a register to main memory. 1 February 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 34 Computer-System Organization Storage Structure: ✔ A typical instruction–execution cycle, as executed on a system with a von Neumann architecture. ▪ First fetches an instruction from memory and stores that instruction in the instruction register. ▪ The instruction is then decoded and may cause operands to be fetched from memory and stored in some internal register. ▪ After the instruction on the operands has been executed, the result may be stored back in memory. ✔ We can ignore how a memory address is generated by a program. We are interested only in the sequence of memory addresses generated by the running program. ✔ Main memory is usually too small to store all needed programs and data permanently. ✔ Main memory is a volatile storage device that loses its contents when power is turned off or otherwise lost. 1 February 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 35 Computer-System Organization Storage Structure: ✔ Most computer systems provide secondary storage as an extension of main memory. ✔ The most common secondary-storage device is a magnetic disk, which provides storage for both programs and data. Most programs (system and application) are stored on a disk until they are loaded into memory. ✔ The main differences among the various storage systems lie in speed, cost, size, and volatility. ✔ The wide variety of storage systems can be organized in a hierarchy (Figure) according to speed and cost. ✔ The higher levels are expensive, but they are fast. ✔ As we move down the hierarchy, the cost per bit generally decreases, whereas the access time generally increases. 1 February 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 36 1 February 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 37 Computer-System Organization I/O Structure: ✔ A large portion of operating system code is dedicated to managing I/O, both because of its importance to the reliability and performance of a system and because of the varying nature of the devices. ✔ A general-purpose computer system consists of CPUs and multiple device controllers that are connected through a common bus. ✔ A device controller maintains some local buffer storage and a set of special-purpose registers. ✔ The device controller is responsible for moving the data between the peripheral devices that it controls and its local buffer storage. ✔ Typically, operating systems have a device driver for each device controller. ✔ To start an I/O operation, the device driver loads the appropriate registers within the device controller. The device controller, in turn, examines the contents of these registers to determine what action to take. ✔ This form of interrupt-driven I/O is fine for moving small amounts of data but can produce high overhead when used for bulk data movement such as disk I/O. To solve this problem, direct memory access (DMA) is used. ✔ The device controller transfers an entire block of data directly to or from its own buffer storage to memory, with no intervention by the CPU. 1 February 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 38 Computer-System Architecture Single-Processor Systems ✔ On a single processor system, there is one main CPU capable of executing a general-purpose instruction set, including instructions from user processes. ✔ They may come in the form of device-specific processors, such as disk, keyboard, and graphics controllers. Multiprocessor Systems ✔ Multiprocessor systems (also known as parallel systems or multicore systems) have two or more processors in close communication, sharing the computer bus and sometimes the clock, memory, and peripheral devices. ✔ Multiprocessor systems have three main advantages: 1. Increased throughput: By increasing the number of processors, we expect to get more work done in less time. 2. Economy of scale: Multiprocessor systems can cost less than equivalent multiple single-processor systems, because they can share peripherals, mass storage, and power supplies. 3. Increased reliability: If we have ten processors and one fails, then each of the remaining nine processors can pick up a share of the work of the failed processor. 7 February 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 39 Computer-System Architecture Multiprocessor Systems ✔ The ability to continue providing service proportional to the level of surviving hardware is called graceful degradation. Some systems go beyond graceful degradation and are called fault tolerant, because they can suffer a failure of any single component and still continue operation. ✔ Fault tolerance requires a mechanism to allow the failure to be detected, diagnosed, and, if possible, corrected. ✔ The multiple-processor systems are of two types. 1. Asymmetric multiprocessing: in which each processor is assigned a specific task. A boss processor controls the system. The boss processor schedules and allocates work to the worker processors. 2. Symmetric multiprocessing (SMP): in which each processor performs all tasks within the operating system. SMP means that all processors are peers; no boss–worker relationship exists between processors. In a typical SMP architecture each processor has its own set of registers, as well as a private—or local —cache. However, all processors share physical memory. ✔ The difference between symmetric and asymmetric multiprocessing may result from either h/w or s/w. 7 February 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 40 Computer-System Architecture Multiprocessor Systems Symmetric multiprocessing architecture 7 February 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 41 Computer-System Architecture Multiprocessor Systems ✔ Multiprocessing adds CPUs to increase computing power. If the CPU has an integrated memory controller, then adding CPUs can also increase the amount of memory addressable in the system. ✔ A recent trend in CPU design is to include multiple computing cores on a single chip. Such multiprocessor systems are termed multicore. ✔ They can be more efficient than multiple chips with single cores because on-chip communication is faster than between-chip communication. ✔ It is important to note that while multicore systems are multiprocessor systems, not all multiprocessor systems are multicore. 7 February 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 42 Clustered Systems ✔ Multiprocessor systems are composed of two or more individual systems—or nodes—joined together. Such systems are considered loosely coupled. Each node may be a single processor system or a multicore system. ✔ Clustered computers share storage and are closely linked via a local-area network LAN. ✔ Clustering is usually used to provide high-availability service—that is, service will continue even if one or more systems in the cluster fail. ✔ Clustering can be structured asymmetrically or symmetrically. 1. In asymmetric clustering, one machine is in hot-standby mode while the other is running the applications. 2. In symmetric clustering, two or more hosts are running applications and are monitoring each other. 7 February 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 43 Operating-System Structure ✔ One of the most important aspects of operating systems is the ability to multiprogram. ✔ Multiprogramming increases CPU utilization by organizing jobs (code and data) so that the CPU always has one to execute.(keep either the CPU or the I/O devices busy at all times.) ✔ The operating system keeps several jobs in memory simultaneously (Figure). Since, in general, main memory is too small to accommodate all jobs, the jobs are kept initially on the disk in the job pool. ✔ This pool consists of all processes residing on disk awaiting allocation of main memory. 7 February 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 44 Operating-System Structure ✔ The operating system picks and begins to execute one of the jobs in memory. ✔ In a multiprogrammed system, the operating system simply switches to, and executes, another job. When that job needs to wait, the CPU switches to another job, and so on. ✔ Multiprogrammed systems provide an environment in which the various system resources (for example, CPU, memory, and peripheral devices) are utilized effectively, but they do not provide for user interaction with the computer system. ✔ Time sharing (or multitasking) is a logical extension of multiprogramming. In time-sharing systems, the CPU executes multiple jobs by switching among them, but the switches occur so frequently that the users can interact with each program while it is running. 7 February 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 45 ✔ A time-shared operating system allows many users to share the computer simultaneously, only a little CPU time is needed for each user. ✔ A program loaded into memory and executing is called a process. ✔ If several jobs are ready to be brought into memory, and if there is not enough room for all of them, then the system must choose among them. Making this decision involves job scheduling. 7 February 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 46 Operating-System Operations ✔ Modern operating systems are interrupt driven. ✔ Events are almost always signaled by the occurrence of an interrupt or a trap. ✔ A trap (or an exception) is a software-generated interrupt caused either by an error (for example, division by zero or invalid memory access) or by a specific request from a user program that an operating-system service be performed. Dual-Mode and Multimode Operation ✔ We need two separate modes of operation: user mode and kernel mode (also called supervisor mode, system mode, or privileged mode). ✔ A bit, called the mode bit, is added to the hardware of the computer to indicate the current mode: kernel (0) or user (1). 7 February 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 47 Process Management ✔ A program in execution, as mentioned, is a process. A time-shared user program such as a compiler is a process. ✔ A process needs certain resources—including CPU time, memory, files, and I/O devices—to accomplish its task. ✔ A program is a passive entity, like the contents of a file stored on disk, whereas a process is an active entity. ✔ A single-threaded process has one program counter specifying the next instruction to execute.(one instruction at most is executed on behalf of the process.) ✔ A multithreaded process has multiple program counters, each pointing to the next instruction to execute for a given thread. ✔ A system consists of a collection of processes, some of which are operating-system processes (those that execute system code) and the rest of which are user processes. 7 February 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 48 Process Management ✔ The operating system is responsible for the following activities in connection with process management: ▪ Scheduling processes and threads on the CPUs ▪ Creating and deleting both user and system processes ▪ Suspending and resuming processes ▪ Providing mechanisms for process synchronization ▪ Providing mechanisms for process communication 7 February 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS 49 GVSN Memory Management ✔ The central processor reads instructions from main memory during the instruction-fetch cycle and both reads and writes data from main memory during the data-fetch cycle. ✔ For a program to be executed, it must be mapped to absolute addresses and loaded into memory. ✔ As the program executes, it accesses program instructions and data from memory by generating these absolute addresses. ✔ The operating system is responsible for the following activities in connection with memory management: ▪ Keeping track of which parts of memory are currently being used and who is using them ▪ Deciding which processes (or parts of processes) and data to move into and out of memory ▪ Allocating and de-allocating memory space as needed 7 February 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 50 Storage Management ✔ The operating system abstracts from the physical properties of its storage devices to define a logical storage unit, the file. ✔ The operating system maps files onto physical media and accesses these files via the storage devices. File-System Management ✔ Computers can store information on several different types of physical media. Magnetic disk, optical disk, and magnetic tape are the most common. ✔ A file is a collection of related information defined by its creator. Commonly, files represent programs and data. ✔ The operating system implements the abstract concept of a file by managing mass-storage media, such as tapes and disks, and the devices that control them. ✔ In addition, files are normally organized into directories to make them easier to use. 7 February 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 51 Storage Management File-System Management ✔ The operating system is responsible for the following activities in connection with file management: ▪ Creating and deleting files ▪ Creating and deleting directories to organize files ▪ Supporting primitives for manipulating files and directories ▪ Mapping files onto secondary storage ▪ Backing up files on stable (nonvolatile) storage media. 7 February 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 52 Storage Management Mass-Storage Management ✔ Most modern computer systems use disks as the principal on-line storage medium for both programs and data. ✔ Most programs—including compilers, assemblers, word processors, editors, and formatters—are stored on a disk until loaded into memory. ✔ The operating system is responsible for the following activities in connection with disk management: ▪ Free-space management ▪ Storage allocation ▪ Disk scheduling 7 February 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 53 Storage Management Caching ✔ Caching means information is normally kept in some storage system (such as main memory). ✔ As it is used, it is copied into a faster storage system—the cache—on a temporary basis. When we need a particular piece of information, we first check whether it is in the cache. ✔ If it is, we use the information directly from the cache. ✔ If it is not, we use the information from the source, putting a copy in the cache under the assumption that we will need it again soon. ✔ Because caches have limited size, cache management is an important design problem. ✔ Main memory can be viewed as a fast cache for secondary storage. Migration of integer A from disk to register 7 February 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS 54 GVSN Storage Management Caching Performance of various levels of storage. 7 February 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 55 Storage Management Caching ✔ In a computing environment where only one process executes at a time, this arrangement poses no difficulties, since an access to integer A will always be to the copy at the highest level of the hierarchy. ✔ The situation becomes more complicated in a multiprocessor environment where, in addition to maintaining internal registers, each of the CPUs also contains a local cache. ✔ In such an environment, a copy of A may exist simultaneously in several caches. ✔ This situation is called cache coherency, and it is usually a hardware issue. I/O Systems ✔ The I/O subsystem consists of several components: ▪ A memory-management component that includes buffering, caching, and spooling ▪ A general device-driver interface ▪ Drivers for specific hardware devices 7 February 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 56 Protection and Security ✔ Protection, is any mechanism for controlling the access of processes or users to the resources defined by a computer system. ✔ Protection can improve reliability by detecting latent errors at the interfaces between component subsystems. ✔ Early detection of interface errors can often prevent contamination of a healthy subsystem by another subsystem that is malfunctioning. ✔ The job of security is to defend a system from external and internal attacks. ✔ Such attacks spread across a huge range and include viruses and worms, denial-of service attacks (which use all of a system’s resources and so keep leGSTimate users out of the system), identity theft, and theft of service. ✔ Most operating systems maintain a list of user names and associated user identifiers (user IDs). ✔ In Windows parlance, this is a security ID (SID). These numerical IDs are unique, one per user. 7 February 2023,9:00-9:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 57 Kernel Data Structures Lists, Stacks, and Queues ✔ An array is a simple data structure in which each element can be accessed directly. For example, main memory is constructed as an array. ✔ A list represents a collection of data values as a sequence. ✔ The most common method for implementing this structure is a linked list, in which items are linked to one another. ✔ Linked lists are of several types: ▪ In a singly linked list, each item points to its successor. ▪ In a doubly linked list, a given item can refer either to its predecessor or to its successor. ▪ In a circularly linked list, the last element in the list refers to the first element, rather than to null. Singly linked list 4 February 2023,10:00-10:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 58 Kernel Data Structures Lists, Stacks, and Queues Doubly linked list Circularly linked list ✔ Linked lists accommodate items of varying sizes and allow easy insertion and deletion of items. 4 February 2023,10:00-10:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 59 Kernel Data Structures Lists, Stacks, and Queues ✔ A stack is a sequentially ordered data structure that uses the last in, first out (LIFO) principle for adding and removing items, meaning that the last item placed onto a stack is the first item removed. ✔ The operations for inserting and removing items from a stack are known as push and pop, respectively. ✔ An operating system often uses a stack when invoking function calls. ✔ A queue, in contrast, is a sequentially ordered data structure that uses the first in, first out (FIFO) principle: items are removed from a queue in the order in which they were inserted. ✔ Example of queues in OS is jobs that are sent to a printer are typically printed in the order in which they were submitted. 4 February 2023,10:00-10:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 60 Kernel Data Structures Tree s ✔ A tree is a data structure that can be used to represent data hierarchically. Data values in a tree structure are linked through parent–child relationships. ✔ General Tree ✔ Binary Tree ✔ Binary search Tree ✔ Balanced binary search tree 4 February 2023,10:00-10:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 61 Kernel Data Structures Hash Functions and Maps ✔ A hash function takes data as its input, performs a numeric operation on this data, and returns a numeric value. ✔ This numeric value can then be used as an index into a table (typically an array) to quickly retrieve the data. ✔ One potential difficulty with hash functions is that two inputs can result in the same output value—that is, they can link to the same table location. ✔ We can accommodate this hash collision by having a linked list at that table location that contains all of the items with the same hash value. 4 February 2023,10:00-10:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 62 Kernel Data Structures Hash Functions and Maps ✔ One use of a hash function is to implement a hash map, which associates (or maps) [key:value] pairs using a hash function. ✔ Once the mapping is established, we can apply the hash function to the key to obtain the value from the hash map. 4 February 2023,10:00-10:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS GVSN 63 Kernel Data Structures Bitmaps ✔ A bitmap is a string of n binary diGSTs that can be used to represent the status of n items. ✔ For example, suppose we have several resources, and the availability of each resource is indicated by the value of a binary diGST: 0 means that the resource is available, while 1 indicates that it is unavailable (or vice-versa). ✔ The value of the ith position in the bitmap is associated with the ith resource. ✔ As an example, consider the bitmap shown below: 001011101 Resources 2, 4, 5, 6, and 8 are unavailable; resources 0, 1, 3, and 7 are available. 4 February 2023,10:00-10:50 A.M Department of CSE, GST Course Code and Title:CSEN1101 and OPERATING SYSTEMS 64 GVSN THANK YOU 65