0% found this document useful (0 votes)
303 views36 pages

OS Unit-1

Best notes

Uploaded by

roushangupta919
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
303 views36 pages

OS Unit-1

Best notes

Uploaded by

roushangupta919
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 36
Tae ENGINEERING ba xpress SIMPLE AND EASY LANGUAGE + HANDWRITTEN NOTES PDF TOPIC Introduction: Operating system and functions, Classification of Operating systems- Batch, Interactive, Time-sharing, Real-Time System, Multiprocessor Systems, Multiuser Systems, Multiprocess Systems, Multithreaded Systems, Operating System Structure- Layered structure, System Components, Operating System services, Reentrant Kernels, Monolithic and Microkernel Systems. ENGINEERING EXPRESS Concurrent Processes: Process Concept, Principle of Concurrency, Producer / Consumer Problem, Mutual Exclusion, Critical Section Problem, Dekker’s solution, Peterson’s.solution, Semaphores, Test and Set operation; Classical Problem in Concurrency: Dining Philosopher Problem, Sleeping Barber Problem; Inter Process Communication models and Schemes, Process generation. CPU Scheduling: Scheduling Concepts, Performance Criteria, Process States, Process Transition Diagram, Schedulers, Process Control Block (PCB), Protess address space, Process identification information, Threads and their management, Scheduling Algorithms, Multiprocessor Scheduling Deadlock: System model, Deadlock characterization, Prevention, Avoidance and detection, Recovery from deadlock. Memory Management: Basic bare machine, Resident monitor, Multiprogramming with fixed partitions, Multiprogramming with variable partitions, Protection schemes, Paging, Segmentation, Paged segmentation, Virtual memory concepts, Demand paging, Performance of demand paging, Page replacement algorithms, Thrashing, Cache memory organization, Locality of reference. 1/0 Management and Disk Scheduling: 1/0 devices, and 1/O subsystems, 1/O buffering, Disk storage and disk scheduling, RAID. File System: File concept, File organization and access mechanism, File directories, and File sharing, File system implementation issues, File system protection and security. Engineering Express @Q OPERATING SYSTEM cig per Purpose of Operating System An operating system is a program that acts as an mediator between a\|_ f a computer r hard memo! Ir The purpose of an operating system is to provide an environment in which a user can execute programs in a suitable and effective manner. Goal Of Operating System Execute user programs: Functions Of Operating System Booting Copies BIOS programs from Rome chips to main memory. Loads operating system into computer's main memory. Formatting Formats disks so that they can store data and programs. Engineering Express Managing Computer Resources Keep track of locations in main memory where programs and data are secondary storage using partitioning. Managing Files Copies programs from one disk to another. Backup programs. Eases programs Rename files. | Managing Tasks |_It is used to manage tasks like: Multi-tasking Multi-programming ___¢ || Time-sharing ee Multi-processing Classification OF Operating System Batch Operating System The_user of a batch operating Batch Operating System system do not interact with the computer directly. Each user prepares his job on an offline device like punch cards and submit it to the eo "= computer operator. To speed up processing jobs with similar needs are batched together and run as a group. Engineering Express | Advantages: It _can also work offline. Large scale job management. | It can automate repetitive tasks saving time. Cost effective Disadvantages: Lack of interaction between user and the job. Many times a CPU is not working properly or not available. Difficult to provide the desired priority. Interactive Operating System An_ operating system that allows users to run interactive programs | means accepting input from a human. | Interactive operating systems are programs that allow users to enter data or command in between the program execution. ___ || Most popular interactive programs are word processor and spreadsheet. A non-interactive program _is one that does not need human contact in between, it runs continuously after execution | Advantages: — Multitasking yaer domain Quick response — Secured __¢ || User friendly interface ene MaoNQown® Disadvantages: Complex design Costly Engineering Express Timesharing Operating System Time sharing operating system is a technique which enables many people to use a particular computer system at the same time > . P. ‘ime a leu. he tip termed as time sharing. Multiple jobs are executed by the CPU by switching between them Advantages: Provide the advantage of quick response. Avoid duplication of software. Reduces CPU's unavailable time, Disadvantages: It _is not trustworthy operating system. Problem of data communication. User programs and data are not completely secured. Multiprocessor Operating System It is tightly coupled system. Multi-processor systems have more than one processor in close communication. They share the computer bus, memory and other peripheral devices. Engineering Express «|| Th f re hen hic requir to process a large volume of data «|| For example: Satellite Control, her Forecasting, etc. aes _ —— wi : a)|| Symmetric Multiprocessing: ||| In this each processor runs similar or identical copy of the operating — system and they communicate with one another as needed. All the CPU shares the common memory. Engineering Express Asymmetric Multiprocessing: In this each processor is assigned on different tasks and need not to ni ith one another, Th re controlled by master YY = relationship. Advantages: | Fast processing | More trustworthy ___ || Disadvantages; = ea ee 1 Complicated Memory required is more Realtime Operating System: Realtime operating system are used in environments where a large number of events must be accepted and processed in a short time or within certain deadlines. This system is time bound and has a_ fixed deadline. For example Airline Traffic Control Systems, Command Control Systems, Airline Reservation Systems, Robot, etc Timing constraint based types of real time operating system Engineering Express Hard Real Time Operating System This type of system can never miss its deadline. Missing the deadline may have harenfal consequences. and may become negative if ‘ti i increases. For example- Flight Control System, Medical Care System, etc. Soft Real Time Operating System This type of system can miss its deadlines. Missing the deadline may not have harmful consequences. The usefulness of result produced by this system decreases gradually or slowly with increase in delay . F 0 a Jute aT «|| It can be accessed anytime. *“ Can not do multitasking o || Give d «|| Task management * Complex algorithm Multi User Operating System computer operating system whicn allow multiple users single system with one operating ystem on it. As shown in figure in this operating system different users = S| connected at different terminals and we can access these users through network. Using multi user operating system we can perform multiple task at a same time. Engineering Express There are th f j i mn: Distributed System In this different computers are managed in such a way so that they can appear as a single computer. So a sort of network is formed through which they can communicate with each other, b) Time Sliced System In this a short period is assigned or given to each task. As we know : naint ; |_Multiprocessor System In this the operating system use more than one processor, For example- Linux, Unix, Windows XP, etc, Advantages: Disadvantages: © || Resource Sharing * Comple} e || cost effective * User error @ || secured operating system * Performance issues Multiprogramming Operating System A_multi programming operating system is the ability of an operating || system that executes more than one program using a single processor. It allows several programs to be active at once. While one program waits CPU switches to another program. Engineering Express How It Works? Multiple programs are stored in main memory, each prograyn is assigned a specific portion (known as process). The operat nage thes ral d_their | If a program needs to perform input-output operations like write or read operation) it temporarily leaves the main memory and is stored in the secondary storage. The CPU switches to the next ready process. This fast switching makes the user feel like they can run multiple applications at the same time. bohen a program is ready for execution, the operating system select it,|| => (¢|_—_Mrriting—_\ Teele SoU SS Secondary Disk Storage Execution in Progress Bc Multi-Threading Operating System Multi-threading operating system is like having a team of chef: working together In_a busy kitchen. Responding | a [to Keystrokes] Check Thread Thrend Engineering Express What Is Multithreading? Multi-threading is an operating system in which multiple threads can work on a different task at the same time. Imagi itc it Iple cl hi Each chef can work on a different dish (task) at the same time. Multi-threading allows a single process (program) to have multiple threads running at the same time. Code Data Files: code [loses me ef emee a = 3 ‘Thread ——> PS Single-threaded process Multithreaded process > Multithreading Models in Operating System In Operating Systerns, where both User Level and kernel level thread \mapped to Kernel Level Thread by one of the 3 models —_ ists, there exis relationship between the ser Level Thread is Many to one ‘One to One. Many to Many Many To One Mode} Many User Level Threads are mapped to one Kernel level Thread. Does Not support parallel processing of threads in Multicore systems, because only | thread can access kernel at a particular time. If | thread makes o blocking call, then entire process will stop. Engineering Express This is rarel ainly c it Multicore TOOE One To One Model Each of User thread is mapped to kernel thread. Provides more concurrency. Whole process does not gets blocked when one thread makes a blocking call as other threads can run. | Implemented By Linux_and Windows Operating System, corresponding Kernel Thread for it. ion me! | Thi See SSS Hn w IL — 3. Many to Many Model Multiple User Threads are multiplexed to same or less number of Kernel threads. This is the best among the three models, as it improves on shortcoming of one to one model and many to one model. Engineering Express + _| re a of User Thre e want, unlike One iY One Model, __+ || There is no issue of lockin hire n_parallelly in || ____|| multiprocess system unlike Many To One Model. SSS Sm y a ok) (on ard theend > Features Of Multithreading Operating System 1. || Maltitasking || This operating system handles many tasks at the same time, ____|| Instead _of one person or thread doing all the work the computer can || ____|| work on multiple tasks or threads at the same_tim ___2.|| Divide The Work ____|| Operating system split up the work among different threads. Each || __ thread can work on its own task independently. 3.|| Smooth Performance ___|| Multi-threading helps keeps things running smoothly even_if one ___||_thre lon, in | working without waiting. 4, || Effective Use Of Resources By working on multiple tasks at the same time, the computer can make better use of its resources like the CPU, it’s like more work done in the same amount of time. Engineering Express > Difference Between Multi-Tasking And Multi-Threadi Aspect Multitasking Multithreading Technique where a Ability to run multiple . 4 ye oe : single process is divided Definition independent processes or |. - into multiple threads tasks concurrently. that share resources. Each process has its own | Threads within the Process separate memory space same process share the Separation | and resources. same memory and resources. Processes do not directly | Threads share the same Resource . . share resources with each | memory and resources Sharing other, of the parent process. Operating system switches | Threads execute CPU Time | Peraing XY . a CPU time between concurrently within the Division multiple tasks. same process. Improves system Enhances performance efficiency, enhances user |of a single process by Purpose productivity, and optimizes | allowing concurrent resource utilization, execution of different tasks. Running a web browser, | Video editing software music player, and text using threads for Example editor simultaneously. loading files, applying effects, and rendering. Engineering Express # SPOOLING (Simultaneous Peripheral Operations Online) Spooling refer to putting programs or jobs in a buffer, special area in Ya) i vice can acce: em when it is ready. What Is Spooling? It is a technique used by the operating system to manage input output operations effectively. Imagine you have a busy office with multiple tasks. printing document, reading files and other tasks, spooling helps keep things organized. How Does Spooling Work? When you send data froma faster device like computer to_a slower device like printer it’s pulling comes into_play. Instead of waiting for the slower device to process the data immediately, spooling temporarily stores the data in a buffer (waiting room). This buffer is called spool. The data stays in the spool until the slower device is ready to use it. When the slower device is ready it retrieves the data from the spool and performs the necessary operations. Examples of spooling- a) Printing- When you print a document, your computer spools the print program. The printer then pickup the data from the spool and print it. Engineering Express ___b)||_ Disk 1/0- When you files, the is varily stor spool until it is written into the disk. Advantages: || Reduce idle tim Preventing output mix ups STRUCTURE OF OPERATING SYSTEM ‘MONOLITHIC J KERNELA MICRO-KERNEL _. SIMPLE STRUCTURE OF OPERATING SYSTEM. Simple structure of operating system do not have well defined structure . These are small , simple and limited system System Programs The interfaces and level of functionality are not well separated . Example: MS-DOS operating system has four layers a) ROM BIOS device drivers b) MS-DOS device drivers Engineering Express -) || System program ___d)|| Application program Advantages: __a)|| Each level can be defined independently and when needed can interact with one another b)\| It will be simpler to design, manage and update. Disadvantages: __a)|| When a user program fails it causes the whole operating system to crash b)|| These are not well protected structure as all the layers are interconnected ©)|| There is no separation or data hiding as all layer can communicate | with each other __2,||_ LAYERED STRUCTURE OF OPERATING SYSTEM. || In this cture operatin is broken es aa into number of layers(levels), The bottom layer zero is the hardware a topmost layer layer N) is user interface These layers are designed ina way that each layer uses the function of lower level layers only. layered operating system Example: Unix operating system Advantages a) Each layer hides implementation detail from higher level layer b) Layer structure provides modularity with modularity layers are selected such that each layer uses functions and services of only lower level layers Engineering Express ing is ras lower | are nd tl YY layers are checked sib , /t_supports portability. | Disadvantages More layers means risk for a system breakdown b2| Slow operation It takes careful planning for designing the layers as higher layers only use functions of lower layers only. WHAT IS SHELL AND KERNEL ? SHELL The shell in operating system is like personal assistant for your computer It’s a program that takes the command you type and translate them _||_ into actions that the computer's brain the kernel can understand and act on. It gives interface between user and kemel_. So when you tell your computer to open a file or run a program you are actually talking to the shell and it’s making sure your computer follows your command . Engineering Express KERNEL Kernel is like the core or heart of an operating systern, It has full control over everything in the system, Imagine _it as a manager in an office it makes sure all the different parts of your computer like memory, CPU and devices work together smoothly. Each operation of hardware and software is managed by the kernel. It acts as the bridge between applications and data processing done at’ the hardware level. It gives interface between user and hardware. It_is the part of operating system that interacts with hardware Operations performed by kernel a) Process management (conductor ) b) Memory management C librarian ) a Device management (translator J d Interrupt handling Ccomputer- busy restaurant , kernel -manager) e)| 10 communication (post office ) Monolithic Kernel Structure In monolithic kernel structure of operating system all the system components are tightly joined together. It means the operating system components such as process management, memory management, file management, 10 device management are join under a single unit in kernel address space, Since in monolithic structure each component of operating system can directly communicate with other components of operating systern, So it is efficient and fast. Engineering Express @Q in_this lification or i lifficul: modification (changes) in a particular component may affect the functioning of ot wnponents al: | "eee a Program TR WD Kernel Mode ivnple man kernel_only. It is easy to understand, The execution of monolithic kernel_is relatively fast. It is easy to maintain. | Disadvantages: ap If any service in the monolithic kernel fails, the entire system fails. It_is not flexible. It_is less secured. Micro-kemel Structure Of Operating System In_micro-kemel structure only the important functions or system components are present in kernel. A_micro-kernel is a piece of code that contain only the minimum amount of functions and features which are required to _implement_an operating system, Engineering Express @Q In_th ure re ctions like:- Process Management, Memory Management and Inter Process Communication in kernel. pee aang Support, 10 ‘and device management can. n be used as user program or as a server, but to use them the application program of user will send_a request to micro-kemel and micro-kernel provide the access of those functions to the user application program, In micro-kernel structure the components of operating system interact or communicate using message passing mechanism. If the user application program needs the file service then it cannot directly interact with ee file. sein pribalttes it will use the service af [_ Advantages It allows the operating system to be portable between platforms. As each microkernel is isolated, it_is safe and trustworthy. If any component or microkernel fails, the remaining operating system is unaffected and continues to function normally. Disadvantages | System is complex to be constructed. Increased inter module communication reduces system performance. Engineering Express Modular Structure A modular structure of an operating system is like a puzzle where each piece has a specific role and you can add or remove piece: | without affecting the whole picture. The operating system is divided into different modules or sections each responsible for a particular function. For example-File System Module (manage files and directories) Memory Management Module (keep track of memory usage process). Management Module handle creation and execution of process). At the heart of the kernel are the core components that handle the most basic tasks such as process management, memory management and basic input output operations. It is more flexible than a layered structure as a module can call any | other module through a core kernel component. For example: Solaris operating system miscellaneous modules STREAMS modules Engineering Express | Advantages: Modules are loaded as needed which can save memory and improve | performance, | It is easier to manage and update. Each module can be developed and tested independently which make the whole process more efficient. Disadvantages: Increased complexity for developers as developers need to ensure that their modules can work independently as well as the part of large system, When a different vod are loaded gsiorteally there is a ee of security COMPONENTS OF OPERATING SYSTEM Memory Management Maintain boot keeping information: what part of memory are in use by whom what part are not in use. Map processes to memory locations: It decide which process will get memory, when and how much. Allocate the memory when a process requested it. Deallocate the memory when a process no longer needed or has been terminated. Processor Management Allocate the processor to a process. Deallocate processor when a process is no longer required. Engineering Express It_ man Nr ing, pri inchronization, prc communication, deadlock handling. It _keeps track of processor. Device Management Allocate or deallocate devices in the efficient way. Decides which process get the device when and for how much time. Keep track of all devices. Program responsible for this task is known as 1/0 Controller. File Management File creation or deletion. eee j SERVICES PROVIDED BY OPERATING SYSTEM | Program Execution The purpose of computer system is to allow the users to execute programs in an efficient_manner, The operating system provide an environment where the user can conveniently run these programs, To_run_a program, the program is required to be loaded into the RAM first and then to assign CPU time for its execution. 1/0 Operations Each program requires an input and after processing, it produces output. This involves the use of 1/0 devices. The 1/0 service cannot be provided by user level programs and is provided by the operating system. Engineering Express File System Manipulation A program need to read and write a file during its execution rating n. wd writ or deny of fi file to_user program. OS can also create and delete the file. d) Communication Operating system performs the communication among various types of processes in the form of shared memory such as message passing in the form of packets of information which is in predefined format, are moved between processes by the operating system. e)|| Error Detection ella in Me? i ; ike ne A Ae eh 110 devices oe | A ting the errors, operatin rem te Wn appropriate action || ____|| for consistent work flow. f) || Resource Allocation In the multitasking environment when multiple jobs are running at a 2 itis the responsibility of an operating system to allocate _| the required resources like CPU, main memory, disk drive or secondary storage to each process for its better utilization. CPU_scheduling | algorithms are used for better utilization of CPU. Protection And Security The operating system controls the access to the resources, protect the 1/0 devices from invalid access and provide authentication through passwords. Engineering Express h)|| Accounting Operating system keep track of which resource is being used by a user| and for how long it is being used. User Interface Each operating system has an user interface which is used by the user to give instruction to system to execute a particular process. Generally operating system has following type of interfaces: i_Command User Interface (CUI): Using CUI user can enter the command in text form to execute a particular process or task, For Example- MS DOS operating system. ii._Graphical User Interface (GUI): It is an attractive user interface or keyboard. | For Example- Windows operating system Re-Entrant Kernel A _re-entrant kernel is one that consists of executable code which is stored ji) re h_th veral processes can use this code at thout atfecting the working of other processes, Thus in re-entrant kernel several processes may be executed in kernel mode at same time. Since multiple processes execute in kernel mode therefore they also share data and that may affect the functionality of other processes. Hence, to avoid this condition re-entrant function and locking mechanism is used, Re-entrant functions are one which allow processes to modify only the local variable and do not affect global data variables. In locking mechanism several processes can execute re-entrant function concurrently (parallelly) but only one process at a time can Engineering Express re-entrant functio is will en. t ! modified by only one process at a time and thus each process has same copy of global data that is being shared among them. | For Example - UNIX # SYSTEM CALL Think of a system call in_an operating system like asking a librarian to get a book from a locked section of the library you can’t go there yourself but the librarian can fetch the book for you similarly when a program running on your computer need to do something that requires Special permission like accessing hard drive or printing a document it makes a system call asking like the_librarian checks if you have a library card, 5 a ea asked the librarian for a book. The operating system checks if the program is allowed to do what it’s If everything is ok the operating system performs the task on behalf of the program just like librarian brings you the book. After the task i done the operating system gives the result back to Sgstam call we an interface between a process and operating ystem to allow user level processes to request services of the operating system. System calls are the only entry point into the kernel system Engineering Express How System Call Works The process executed into the user mode till the time a system call | interrupts it. After that system call is executed in the kernel mode on a priority basis. Once the system call execution is over control return to the user mode, The execution of user processes resumed in kernel mode. System Calls Used For Process Management |_forkO: creating a duplicate process from the parent process. exit); terminates the process. brkQ. to increase or decrease the data segment size of a proces getpid(); to get a process identifier of the current process. getppidQ): to get parent process identifier. © memory management e file access directory and file system management e device handling © jo protection © networking Engineering Express Dual Mode Operation Of Processor Dual mode operation involves two distinct modes: User Mode and Kernel Mode, In User Mode, programs run with limited privileges and cannot directly access hardware or sensitive system areas. Kernel Mode is where the operating system runs with full privileges, allowing it to access hardware and control critical system operations. A special ‘mode bit’ is used to indicate the current mode of operation. If the mode bit is |, the system is in User Mode; if it’s 0, it’s in Kernel Mode. When a user program needs to perform an operation that requires higher privileges, it makes a system call, which switches the operation |to Kernel Mode, User mode (mode bit = 1) set mode bt = de bit= 1 before switching before switching | eee epee 5 i ae mape ee kernel mode {mode-bit=0) Dual mode operation is essential for the security and stability of modern operating systems, as it clearly defines the boundaries between user activities and system operations. Engineering Express Feature Process Switch Mode Switch A process switch involves A mode switch occurs when changing the CPU from one | the CPU changes from one ae process or thread to another, | privilege level to another, such Definition requiring saving and loading the state of the CPU | registers’. as from user mode to kernel mode, without changing the executing process’, Occurs When When the operating system decides to execute a different process, often for | multitasking}. When a running process requires services from the kernel, typically through system calls or interrupts'. State Saving The state of the current process is saved, and the state of the next process is loaded into the CPU'. The process state is not saved or changed; only the CPU's privilege level changes’. Can affect performance as it Generally has less impact on Performance | involves saving and loading _ a performance as it involves Impact process states, which takes . cama fewer operations’. time’. To protect the operatin To enable multitasking by - Ps . 9 . : ; system by separating user Purpose | allowing multiple processes to share the CPU!. operations from system operations’. Engineering Express Difference Between Keme) And Shell Aspect Kernel Shell Role The core of the operating | A user interface that system that manages allows users to interact hardware and system with the kernel through resources’, commands’, Function Handles critical tasks like | Acts as a command-line memory management, process scheduling, and 1/0 operations', interpreter, translating user commands into actions for the kemel', | | Operation Level Operates at a low level, directly interacting with the computer's hardware’. Operates at a higher level, providing an environment for user interaction’, User Interaction Does not interact directly with users’. Directly interacts with users, allowing them to execute commands’. Types Monolithic kernel, Boume Shell, € Shell, microkernel, hybrid kernel, | Korn Shell, etc’. ete, Complexity | More complex due to its Less complex, focused on extensive range of user command responsibilities', interpretation’. Performance | Directly affects system Affects user experience performance and stability’, | and ease of use’. Customization | Not typically customized by | Can be customized with end-users’, aliases, scripts, and user- defined functions’. Engineering Express Diff B tonolithic And. Micro-K 5 OF | Operating System Feature Monolithic Kernel Microkemel Both user services and kernel User services and kernel Address Space | services are kept in the same services are implemented in address space’, different address spaces', Design and | Generally simpler to design and —_| More complex to design due Implementation | implement'. to the separation of services’. ; Larger in size because it contains Sheth valeimnstieacrhy Size r f contains the essential kernel ‘many device drivers and services’. —- services', ., saciid Easier to add new pomeeamenap: | MAPA TEN petlenals Cat are mat more difficult! ; modularity. Failure of one component can Rs sae epee Failure Impact some usually doesy’t affect the core affect the entire system. : kernel', . . Lower execution speed due to Pertenece eae CMD ya eatin ef Iakei-ibetis yst . communication CIPC)'. Extendlbilty Extending the heel can be Easier to eitene) with new challenging’. services’, Debuggir be difficult; Debugging and gging can Be more cals; | simpler to debug and 7 maintenance can require more ae ‘ Maintenance = maintain due to modularity’. time and resources’.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy