Summary

These lecture notes cover advanced operating system concepts, including CPU scheduling algorithms, operating system structure, computer system organization, and other related topics.

Full Transcript

23MCAC103- ADVANCED OPERATING SYSTEMS by Dr.Gobi Natesan Course Outcome –Unit 1 ◻ Compare the different kinds of CPU Scheduling algorithms in an Operating System based on processes arrival time, burst time and Turnaround time. Sy...

23MCAC103- ADVANCED OPERATING SYSTEMS by Dr.Gobi Natesan Course Outcome –Unit 1 ◻ Compare the different kinds of CPU Scheduling algorithms in an Operating System based on processes arrival time, burst time and Turnaround time. Syllabus- Unit 1 Fundamentals of Operating Systems: Computer System organization, Operating System structure, Operating System operations, Operating System Services, System calls, Processes- CPU Scheduling - Case Study Computer System Structure 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 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 Four Components of a Computer System Operating System-Definition 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 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 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 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 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. 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 vectored interrupt system Separate segments of code determine what action should be taken for each type of interrupt Interrupt Timeline Byte Storage Notations Metric Value Bytes Byte (B) 1 1 Kilobyte (KB) 1,0241 1,024 Megabyte (MB) 1,0242 1,048,576 Gigabyte (GB) 1,0243 1,073,741,824 Terabyte (TB) 1,0244 1,099,511,627,776 Petabyte (PB) 1,0245 1,125,899,906,842,624 Exabyte (EB) 1,0246 1,152,921,504,606,846,976 1,180,591,620,717,411,303, Zettabyte (ZB) 1,0247 424 1,208,925,819,614,629,174,706,176 Yottabyte (YB) 1,0248 Storage Structure Main memory – only large storage media that the CPU can access directly Random access Typically volatile Secondary storage – extension of main memory that provides large nonvolatile storage capacity Magnetic disks – rigid metal or glass platters covered with magnetic recording material Disk surface is logically divided into tracks, which are subdivided into sectors The disk controller determines the logical interaction between the device and the computer 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 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 Multiprogramming Multiprogramming needed for efficiency 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 Multitasking Timesharing (multitasking) is logical extension in which CPU switches jobs so frequently that users can interact with each job while it is running, creating interactive computing Response time should be < 1 second Each user has at least one program executing in memory -process If several jobs ready to run at the same time - CPU scheduling If processes don’t fit in memory, swapping moves them in and out to run Virtual memory allows execution of processes not completely in memory Operating-System Operations ◻ Modern operating systems are interrupt driven. ◻ When there is no process, no I/O routine, no user  CPU Utilization is Zero ie. System is in Idle State. ◻ A trap (or an exception) is a software- generated interrupt caused either by an error ◻ The interrupt-driven nature of an operating system defines that system’s general structure. ◻ For each type of interrupt, separate segments of code in the operating system determine what action should be taken. ◻ An interrupt service routine is provided to deal with the interrupt. ◻ User request the OS to perform some services/Operations. ◻ Two Modes of Operations : Dual Mode Operations Timer based Operations DUAL-MODE AND MULTIMODE OPERATION ◻ In order to ensure the proper execution of the operating system, we must be able to distinguish between the execution of operating-system code and user defined code. ◻ Approach taken by most computer systems is to provide hardware support that allows us to differentiate among various modes of execution ◻ 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). ◻ With the mode bit, we can distinguish between a task that is executed on behalf of the operating system and one that is executed on behalf of the user. Transition from User to Kernel Mode ◻ When user switched on the system, it is in Kernel mode later user mode. Timer Timer to prevent infinite loop / process hogging resources Set interrupt after specific period Operating system decrements counter When counter zero generate an interrupt Set up before scheduling process to regain control or terminate program that exceeds allotted time User Interface Most operating systems have a user interface (UI). Command-line (CLI), Graphics User Interface (GUI), or batch Program Execution Load and execute an program in the memory End execution, either normally or abnormally I/O Operations Running program may require I/O such as file or I/O device File System Manipulation Read, write, create and delete files and directories Search or list files and directories Permission management Communication Processes exchange information, on the same system or over a network via shared memory or through message passing Error Detection OS needs to be constantly aware of possible errors Errors in CPU, memory, I/O devices, programs It should take appropriate actions to ensure correctness and consistency Resource Allocation Allocate resources for multiple users or multiple jobs running concurrently Many types of resources: CPU, memory, file, I/O devices Accounting To keep track of which users use how much and what kinds of resources Protection and Security Protection provides a mechanism to control access to system resources access control: control access to resources isolation: processes should not interfere with each other Security authenticates users and prevent invalid access to I/O devices Protection is the mechanism, security towards the policy System Calls ◻ Acts as an interface between the Kernel and User programs. ◻ It provides services to the user program through OS via API. ◻ Typically written in a high-level language (C or C++) ◻ Three most common APIs are Win32 API for Windows, POSIX API for POSIX-based systems (including virtually all versions of UNIX, Linux, and Mac OS X), and Java API for the Java virtual machine (JVM) Example of System Calls ◻ System call sequence to copy the contents of one file to another file API – System Call – OS Relationship 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 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 Parameter Passing via Table Types of System Calls ◻ Process control create process, terminate process end, abort load, execute get process attributes, set process attributes wait for time wait event, signal event allocate and free memory Debugger for determining bugs, single step execution Locks for managing access to shared data between processes Types of System Calls ◻ File management create file, delete file open, close file read, write, reposition get and set file attributes ◻ Device management request device, release device read, write, reposition get device attributes, set device attributes logically attach or detach devices Types of System Calls (Cont.) ◻ Information maintenance get time or date, set time or date get system data, set system data get and set process, file, or device attributes ◻ Communications create, delete communication connection send, receive messages if message passing model to host name or process name From client to server Shared-memory model create and gain access to memory regions transfer status information attach and detach remote devices Types of System Calls (Cont.) ◻ Protection Control access to resources Get and set permissions Allow and deny user access

Use Quizgecko on...
Browser
Browser