Professional Documents
Culture Documents
Unit1 OS Surbhi jha
Unit1 OS Surbhi jha
Unit1 OS Surbhi jha
Noida
Operating Systems
ACSE0403A
Unit: 1
Operating System
Surbhi Jha
Assistant Professor
B Tech 4th Sem Dept. of CSE
CO5 Understand and analyze the I/O management and File systems K2, K4
9
3/1/2023 Surbhi Jha OS Unit Number:1
COs and POs Mapping
OPERATING SYSTEM (ACSE0403A )
CODE PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12
ACSE0403A .1 3 3 2 2 1 2 - 2 3 2 2 3
ACSE0403A .2 3 3 3 2 2 3 2 2 3 - 1 3
ACSE0403A .3 3 3 2 2 2 2 2 2 2 3 1 3
ACSE0403A .4 3 2 2 3 1 2 2 - 2 - 2 3
ACSE0403A .5 3 1 2 2 2 2 - - 2 2 2 3
• PSO1: The ability to identify, analyze real world problems and design their ethical solutions using artificial
intelligence, robotics, virtual/augmented reality, data analytics, block chain technology and cloud
computing.
• PSO2: The ability to design and develop the hardware sensor devices and related interfacing software
systems for solving complex engineering problems.
• PSO 3: The ability to understand inter disciplinary computing techniques and to apply them in the design
of advanced computing.
• PSO 4: The ability to conduct investigation of complex problem with the help of technical, managerial,
leadership qualities, and modern engineering tools provided by industry sponsored laboratories.
ACSE0403A .1 2 1 2 2
ACSE0403A .2 2 2 1 2
ACSE0403A .3 2 3 3 2
ACSE0403A .4 2 2 1 2
ACSE0403A .5 2 2 2 2
• PEO 1: To have an excellent scientific and engineering breadth so as to comprehend, analyze, design and
provide sustainable solutions for real life problems using state of the art technologies.
• PEO 2: To have a successful career in industries, to pursue higher studies or to support entrepreneurial
endeavors and to face the global challenges.
• PEO 3: To have an effective communication skills, professional attitude, ethical values and a desire to learn
specific knowledge in emerging trends, technologies for research, innovation and product development
and contribution to society.
• PEO 4: To have life-long learning for up-skilling and re-skilling for successful professional career as
engineer, scientist, entrepreneur and bureaucrat for betterment of society.
PO9
Function effectively as an individual, and as a member or leader in
9 (Individual and team
diverse teams and multidisciplinary settings.
work)
19
3/1/2023 Surbhi Jha OS Unit Number:1
End Semester Question Paper Templates (Offline
Pattern/Online Pattern
20
3/1/2023 Surbhi Jha OS Unit Number:1
End Semester Question Paper Templates (Offline
Pattern/Online Pattern
21
3/1/2023 Surbhi Jha OS Unit Number:1
End Semester Question Paper Templates (Offline
Pattern/Online Pattern
22
3/1/2023 Surbhi Jha OS Unit Number:1
End Semester Question Paper Templates (Offline
Pattern/Online Pattern
23
3/1/2023 Surbhi Jha OS Unit Number:1
End Semester Question Paper Templates (Offline
Pattern/Online Pattern
24
3/1/2023 Surbhi Jha OS Unit Number:1
Prerequisite and Recap
• https://www.youtube.com/watch?v=YwqexcfbucE&list=PLmXKhU9FNesSFvj6gASuWmQ
d23Ul5omtD&index=1
CO1: Understand the fundamentals of an operating systems, functions and their structure and
functions.
Topic CO
Introduction to Operating System CO1
Types of operating System CO1
Interrupt Handling CO1
Operating System Structure CO1
Operating System Services CO1
Topic Objective
Students will be able to
Introduction of Operating System Understand the basics of Operating System, its features
characteristics and functions
2. Booting
Booting is basically the process of starting the computer. When the CPU is first switched ON it has
nothing inside the memory. So, to start the computer, we load the operating system into the main
memory. Therefore, loading the OS to the main memory to start the computer is booting. Hence, the
OS helps to start the computer when the power is switched ON.
4. Multitasking
The OS helps to run more than one application at a time on the computer. It plays an important role
while multitasking. Since it manages memory and other devices during multitasking. Therefore, it
provides smooth multitasking on the system.
3/1/2023 Surbhi Jha OS Unit Number:1 36
Need of Operating System
5. Platform for other application software
Users require different application programs to perform specific tasks on the system.
The OS manages and controls these applications so that they can work efficiently. In
other words, it acts as an interface between the user and the applications.
Some other uses/need for operating system are:
6. Manages the memory
It helps in managing the main memory of the computer. Moreover, It allocates and de
allocates memory to all the applications/tasks.
7. Manages the system files
It helps to manage files on the system. As we know, all the data on the system is in the
form of files. It makes interaction with the files easy.
8. Provides Security
It keeps the system and applications safe through authorization. Thus, the OS provides
security to the system.
• Memory Management — It keeps tracks of primary memory i.e what part of it are in use by whom,
what part are not in use etc. Allocates the memory when the process or program request it.
• Processor Management — Allocate the processor(CPU) to a process. De allocate processor when
processor is no longer required.
• Device Management — Keep tracks of all devices. This is also called I/O controller. Decides which
process gets the device when and for how much time.
• File Management — Allocates the resources. De-allocates the resource. Decides who gets the
resources.
• Security — By means of passwords & similar other techniques, preventing unauthorized access to
programs & data.
• Error-detecting aids — Production of dumps, traces, error messages and other debugging and error-
detecting methods.
• Storage Management
Memory Management:
• It is the management of the main or primary memory. Whatever program is executed, it has to be
present in the main memory. Main memory is a quick storage area that may be accessed directly by
the CPU. When the program execution is completed, the memory region is released and can be used
by other programs. Therefore, there can be more than one program present at a time. Hence, it is
required to manage the memory.
The operating system:
• Allocates and de allocates the memory.
• Keeps a record of which part of primary memory is used by whom and how much.
• Distributes the memory while multiprocessing.
• In multiprogramming, the operating system selects which processes acquire memory when and how
much memory they get.
Processor Management:
• Every software that runs on a computer, whether in the background or in the frontend, is a process.
Processor management is an execution unit in which a program operates. The operating system
determines the status of the processor and processes, selects a job and its processor, allocates the
processor to the process, and de-allocates the processor after the process is completed.
• When more than one process runs on the system, the OS decides how and when a process will use the
CPU. Hence, the name is also CPU Scheduling.
The OS:
• Allocates and de allocates processor to the processes.
• Keeps record of CPU status.
Certain algorithms used for CPU scheduling are as follows:
• First Come First Serve (FCFS)
• Shortest Job First (SJF)
• Round-Robin Scheduling
• Priority-based scheduling etc.
• Computer-System Operation
• I/O Structure
• Storage Structure
• Storage Hierarchy
• Hardware Protection
• General System Architecture
• A modern computer system consists of a CPU, memory, system bus and a number of
device controllers.
• I/O devices and the CPU can execute concurrently.
• Each device controller is in charge of a particular device type.
• A device controller for each device contains local buffer storage and special purpose
registers.
• A bootstrap program is required to initialize the computer system.
• CPU moves data from /to main memory and 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.
• The Computer System has a number of device controllers connected through a common bus.
• A device controller contains local buffer storage and a set of special purpose registers.
• The device driver is responsible for moving the data between the peripheral devices and it controls its
local buffer storage.
• I/O interrupts are used by the device controllers for transfer of data.
• I/O methods
a) Synchronous
b) Asynchronous
• In synchronous method , after I/O starts, control returns to user program only upon I/O completion.
• In asynchronous method, after I/O starts, control returns to user program without waiting for I/O
completion. It requires system call which is a request to the operating system to allow user to wait for
I/O completion.
• Registers
• Cache Memory
• Main Memory
• Electronic Disk
• Magnetic Disk
• Optical Disk
• Hard Disk
• Magnetic Tape
• I/O Protection
• Memory Protection
• CPU Protection
I/O Protection :
a) All I/O instructions are defined as privileged instructions so users cannot issue I/O
instructions from user mode.
b) To do I/O , a user program executes a system call to request that the OS perform
I/O on its behalf and returns the control to the users after completion of I/O
operation.
Memory Protection:
Two registers are used to determine the range of legal addresses a program may access:
1. Base register: holds the smallest legal physical memory address.
2. Limit register: contains the size of the range
• CPU Protection :
➢ A user program may:
a) be stuck in an infinite loop
b) fail to call system services
c) fail to return control to the OS.
➢ Timer: Interrupts computer after specified period to ensure operating system maintains control.
➢ Timer is also commonly used to implement time sharing mechanism.
➢ Timer can be used to compute the current time.
Multitasking
Multitasking is when multiple jobs are executed by the CPU simultaneously by
switching between them. Switches occur so frequently that the users may interact with
each program while it is running. An OS does the following activities related to
multitasking −
•The user gives instructions to the operating system or to a program directly, and
receives an immediate response.
•The OS handles multitasking in the way that it can handle multiple operations/executes
multiple programs at a time.
•Multitasking Operating Systems are also known as Time-sharing systems.
•These Operating Systems were developed to provide interactive use of a computer
system at a reasonable cost.
•A time-shared operating system uses the concept of CPU scheduling and
multiprogramming to provide each user with a small portion of a time-shared CPU.
•Each user has at least one separate program in memory.
Multitasking
•A program that is loaded into memory and is executing is commonly
referred to as a process.
•When a process executes, it typically executes for only a very short
time before it either finishes or needs to perform I/O.
•Since interactive I/O typically runs at slower speeds, it may take a long
time to complete. During this time, a CPU can be utilized by another
process.
•The operating system allows the users to share the computer
simultaneously. Since each action or command in a time-shared system
tends to be short, only a little CPU time is needed for each user.
•As the system switches CPU rapidly from one user/program to the
next, each user is given the impression that he/she has his/her own
CPU, whereas actually one CPU is being shared among many users.
Time-Sharing Systems
• 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 is 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” not from a card reader, but rather
from the user’s keyboard.
• On-line system must be available for users to access data and code.
The response time of the OS needs to be short, since the user submits and
waits for the result.
Multithreaded System
• A thread is a flow of execution through the process code, with its own
program counter that keeps track of which instruction to execute next,
system registers which hold its current working variables, and a stack
which contains the execution history.
• A thread shares with its peer threads few information like code segment,
data segment and open files. When one thread alters a code segment,
memory item, all other threads see that.
• A thread is also called a lightweight process. Threads provide a way to
improve application performance through parallelism. Threads represent
a software approach to improving performance of operating system by
reducing the overhead, thread is equivalent to a classical process.
Multithreaded System
2 Process switching needs interaction with Thread switching does not need to interact
operating system. with operating system.
3 In multiple processing environments, All threads can share same set of open files,
each process executes the same code but child processes.
has its own memory and file resources.
4 Multiple processes without using threads Multiple threaded processes use fewer
use more resources. resources.
5 In multiple processes each process One thread can read, write or change
operates independently of the others. another thread's data.
Multithreaded System
• Most modern applications are multithreaded.
• Threads run within application.
• Multiple tasks within the application can be implemented by separate
threads
• Update display.
• Fetch data.
• Spell checking.
• Answer a network request.
• Process creation is heavy-weight while thread creation is light-weight.
• Can simplify code, increase efficiency.
• Kernels are generally multithreaded.
End , abort
● Load, Execute
● Create process, terminate process
● Wait for time
● Allocate and free memory
● Wait event, signal event
● Get process attributes, set PA
Polling: In polling, the first device encountered with the IRQ bit set is the
device that is to be serviced first. Appropriate ISR is called to service the same. It
is easy to implement but a lot of time is wasted by interrogating the IRQ bit of all
devices.
Interrupt Timeline
• 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.
Applications
Monolithic Kernel
Hardware
Applications Server
Microkernel
Hardware
➢ Reentrant functions only modify local variables but do not alter global
data structures. To provide reentrant kernel, the kernel is implemented as a
collection of reentrant functions.
•Process Management
•Main Memory Management
•Secondary-Storage Management
•I/O System Management
•File Management
•Protection System
•Networking
•Command-Interpreter System
• Memory is a large array of words or bytes, each with its own address. It is a
repository of quickly accessible data shared by the CPU and I/O devices.
• Main memory is a volatile storage device. It loses its contents in the case of
system failure.
• The operating system is responsible for the following activities in connections
with memory management:
– Keep track of which parts of memory are currently being used and by
whom.
– Decide which processes to load when memory space becomes available.
– Allocate and deallocate memory space as needed.
Additional functions exist not for helping the user, but rather for ensuring
efficient system operations.
• Resource allocation – allocating resources to multiple users or
multiple jobs running at the same time.
• Accounting – keep track of and record which users use how much
and what kinds of computer resources for account billing or for
accumulating usage statistics.
• Protection – ensuring that all access to system resources is
controlled.
•An I/O subsystem comprises of I/O devices and their corresponding driver
software. Drivers hide the peculiarities of specific hardware devices from
the users.
•An Operating System manages the communication between user and
device drivers.
•I/O operation means read or write operation with any file or any specific
I/O device.
•Operating system provides the access to the required I/O device when
required.
•A file represents a collection of related information. Computers can store files on the disk
(secondary storage), for long-term storage purpose. Examples of storage media include
magnetic tape, magnetic disk and optical disk drives like CD, DVD. Each of these media has
its own properties like speed, capacity, data transfer rate and data access methods.
•A file system is normally organized into directories for easy navigation and usage. These
directories may contain files and other directories. Following are the major activities of an
operating system with respect to file management −
•Program needs to read a file or write a file.
•The operating system gives the permission to the program for operation on file.
•Permission varies from read-only, read-write, denied and so on.
•Operating System provides an interface to the user to create/delete files.
•Operating System provides an interface to the user to create/delete directories.
•Operating System provides an interface to create the backup of file system.
Communication
•In case of distributed systems which are a collection of processors that do not share
memory, peripheral devices, or a clock, the operating system manages communications
between all the processes. Multiple processes communicate with one another through
communication lines in the network.
•The OS handles routing and connection strategies, and the problems of contention and
security. Following are the major activities of an operating system with respect to
communication −
•Two processes often require data to be transferred between them
•Both the processes can be on one computer or on different computers, but are connected
through a computer network.
•Communication may be implemented by two methods, either by Shared Memory or by
Message Passing.
Error Handling
•Errors can occur anytime and anywhere. An error may occur in CPU, in I/O devices or in
the memory hardware. Following are the major activities of an operating system with respect
to error handling −
•The OS constantly checks for possible errors.
•The OS takes an appropriate action to ensure correct and consistent computing.
Resource Management
•In case of multi-user or multi-tasking environment, resources such as main memory, CPU
cycles and files storage are to be allocated to each user or job. Following are the major
activities of an operating system with respect to resource management −
•The OS manages all kinds of resources using schedulers.
•CPU scheduling algorithms are used for better utilization of CPU.
User
Interface
UNIX Kernel
• https://www.youtube.com/playlist?list=PLBlnK6fEyqRiVhbXDGLXDk_OQAeuVcp2O
• https://nptel.ac.in/courses/106108101
2.To access the services of operating system, the interface is provided by the
___________
A. System calls
B. API
C. Library
D. Assembly instructions
4. Hard real time operating system has ______________ jitter than a soft real time
operating system.
a) equal
b) more
c) less
d) none of the mentioned
8. The ________ keeps state information about the use of I/O components.
a) CPU
b) OS
c) kernel
d) shell