0% found this document useful (0 votes)
239 views11 pages

Operating System Notes-1

Uploaded by

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

Operating System Notes-1

Uploaded by

nagakiran9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

OPERATING SYSTEM NOTES

UNIT-I & II
An Operating System (OS) is an interface between a computer user and computer hardware. An
operating system is a software which performs all the basic tasks like file management, memory
management, process management, handling input and output, and controlling peripheral
devices such as disk drives and printers.
Some popular Operating Systems include Linux Operating System, Windows Operating
System, VMS, OS/400, AIX, z/OS, etc.
Definition
An operating system is a program that acts as an interface between the user and the computer
hardware and controls the execution of all kinds of programs.

Q. Explain functions of an operating System.


● Memory Management
● Processor Management
● Device Management
● File Management
● Security
● Control over system performance
● Job accounting
● Error detecting aids
● Coordination between other software and users
Memory Management
Memory management refers to management of Primary Memory or Main Memory. Main
memory is a large array of words or bytes where each word or byte has its own address.
Main memory provides a fast storage that can be accessed directly by the CPU. For a program
to be executed, it must in the main memory. An Operating System does the following activities
for memory management −
● Keeps tracks of primary memory, i.e., what part of it are in use by whom, what part are
not in use.
● In multiprogramming, the OS decides which process will get memory when and how
much.
● Allocates the memory when a process requests it to do so.
● De-allocates the memory when a process no longer needs it or has been terminated.
Processor Management
In multiprogramming environment, the OS decides which process gets the processor when and
for how much time. This function is called process scheduling. An Operating System does the
following activities for processor management −
● Keeps tracks of processor and status of process. The program responsible for this task
is known as traffic controller.
● Allocates the processor (CPU) to a process.
● De-allocates processor when a process is no longer required.
Device Management
An Operating System manages device communication via their respective drivers. It does the
following activities for device management −
● Keeps tracks of all devices. Program responsible for this task is known as the I/O
controller.
● Decides which process gets the device when and for how much time.
● Allocates the device in the efficient way.
● De-allocates devices.
File Management
A file system is normally organized into directories for easy navigation and usage. These
directories may contain files and other directions.
An Operating System does the following activities for file management −
● Keeps track of information, location, uses, status etc. The collective facilities are often
known as file system.
● Decides who gets the resources.
● Allocates the resources.
● De-allocates the resources.
Operating System performs −
● Security − By means of password and similar other techniques, it prevents
unauthorized access to programs and data.
● Control over system performance − Recording delays between request for a service
and response from the system.
● Job accounting − Keeping track of time and resources used by various jobs and users.
● Error detecting aids − Production of dumps, traces, error messages, and other
debugging and error detecting aids.
● Coordination between other softwares and users − Coordination and assignment of
compilers, interpreters, assemblers and other software to the various users of the
computer systems.
Q) Explain the types of Operating Systems
Ans: Following are some of the most widely used types of Operating system.
1. Simple Batch System
2. Multiprogramming Batch System
3. Multiprocessor System
4. Distributed Operating System
5. Realtime Operating System
Simple Batch Systems
● In this type of system, there is no direct interaction between user and the computer.
● The user has to submit a job (written on cards or tape) to a computer operator.
● Then computer operator places a batch of several jobs on an input device.
● Jobs are batched together by type of languages and requirement.
● Then a special program, the monitor, manages the execution of each program in the
batch.
● The monitor is always in the main memory and available for execution.
Advantages of Simple Batch Systems
1. No interaction between user and computer.
2. No mechanism to prioritise the processes.

Multiprogramming Batch Systems


● In this the operating system picks up and begins to execute one of the jobs from
memory.
● Once this job needs an I/O operation operating system switches to another job (CPU and
OS always busy).
● Jobs in the memory are always less than the number of jobs on disk(Job Pool).
● If several jobs are ready to run at the same time, then the system chooses which one to
run through the process of CPU Scheduling.
● In Non-multiprogrammed system, there are moments when CPU sits idle and does not
do any work.
● In Multiprogramming system, CPU will never be idle and keeps on processing.
Time Sharing Systems are very similar to Multiprogramming batch systems. In fact time
sharing systems are an extension of multiprogramming systems.
In Time sharing systems the prime focus is on minimizing the response time, while in
multiprogramming the prime focus is to maximize the CPU usage.
Multiprocessor Systems
A Multiprocessor system consists of several processors that share a common physical memory.
Multiprocessor system provides higher computing power and speed. In multiprocessor system all
processors operate under single operating system. Multiplicity of the processors and how they do
act together are transparent to the others.
Advantages of Multiprocessor Systems
1. Enhanced performance
2. Execution of several tasks by different processors concurrently, increases the system's
throughput without speeding up the execution of a single task.
3. If possible, system divides task into many subtasks and then these subtasks can be
executed in parallel in different processors. Thereby speeding up the execution of single
tasks.
Distributed Operating System
The motivation behind developing distributed operating systems is the availability of powerful
and inexpensive microprocessors and advances in communication technology.
These advancements in technology have made it possible to design and develop distributed
systems comprising of many computers that are inter connected by communication networks.
The main benefit of distributed systems is its low price/performance ratio.
Advantages Distributed Operating System
1. As there are multiple systems involved, user at one site can utilize the resources of
systems at other sites for resource-intensive tasks.
2. Fast processing.
3. Less load on the Host Machine.
Real Time Operating System
It is defined as an operating system known to give maximum time for each of the critical
operations that it performs, like OS calls and interrupt handling.
The Real-Time Operating system which guarantees the maximum time for critical operations and
complete them on time are referred to as Hard Real-Time Operating Systems.
While the real-time operating systems that can only guarantee a maximum of the time, i.e. the
critical task will get priority over other tasks, but no assurity of completeing it in a defined time.
These systems are referred to as Soft Real-Time Operating Systems.
Define Process. Explain about different process states with neat diagram.
Process
A process is a program in execution. Process is not as same as program code but a lot more than
it. A process is an 'active' entity as opposed to program which is considered to be a 'passive'
entity. Attributes held by process include hardware state, memory, CPU etc
Process States
Processes in the operating system can be in any of the following states:
● NEW- The process is being created.
● READY- The process is waiting to be assigned to a processor.
● RUNNING- Instructions are being executed.
● WAITING- The process is waiting for some event to occur(such as an I/O completion or
reception of a signal).

● TERMINATED- The process has finished execution.

Process Control Block


There is a Process Control Block for each process, enclosing all the
information about the process. It is a data structure, which contains the
following:
● Process State: It can be running, waiting etc.
● Process ID and the parent process ID.
● CPU registers and Program Counter. Program Counter holds the
address of the next instruction to be executed for that process.
● CPU Scheduling information: Such as priority information and
pointers to scheduling queues.
● Memory Management information: For example, page tables or
segment tables.
● Accounting information: The User and kernel CPU time consumed,
account numbers, limits, etc.
● I/O Status information: Devices allocated, open file tables, etc.
Process Scheduling Algorithms
A Process Scheduler schedules different processes to be assigned to the CPU based on
particular scheduling algorithms. There are six popular process scheduling algorithms which
we are going to discuss in this chapter −
● First-Come, First-Served (FCFS) Scheduling
● Shortest-Job-Next (SJN) Scheduling
● Priority Scheduling
● Round Robin(RR) Scheduling
These algorithms are either non-preemptive or preemptive. Non-preemptive algorithms are
designed so that once a process enters the running state, it cannot be preempted until it
completes its allotted time, whereas the preemptive scheduling is based on priority where a
scheduler may preempt a low priority running process anytime when a high priority process
enters into a ready state.
First Come First Serve (FCFS)
● Jobs are executed on first come, first serve basis.
● It is a non-preemptive, pre-emptive scheduling algorithm.
● Easy to understand and implement.
● Its implementation is based on FIFO queue.
● Poor in performance as average wait time is high.

Wait time of each process is as follows −


Process Wait Time : Service Time - Arrival Time

P0 0-0=0

P1 5-1=4

P2 8-2=6
P3 16 - 3 = 13
Average Wait Time: (0+4+6+13) / 4 = 5.75
Shortest Job Next (SJN)
● This is also known as shortest job first, or SJF
● This is a non-preemptive, pre-emptive scheduling algorithm.
● Best approach to minimize waiting time.
● Easy to implement in Batch systems where required CPU time is known in advance.
● Impossible to implement in interactive systems where required CPU time is not known.
● The processer should know in advance how much time process will take.
Given: Table of processes, and their Arrival time, Execution time
Process Arrival Time Execution Time Service Time

P0 0 5 0

P1 1 3 5

P2 2 8 14

P3 3 6 8

Waiting time of each process is as follows −


Process Waiting Time

P0 0-0=0

P1 5-1=4

P2 14 - 2 = 12

P3 8-3=5
Average Wait Time: (0 + 4 + 12 + 5)/4 = 21 / 4 = 5.25
Priority Based Scheduling
● Priority scheduling is a non-preemptive algorithm and one of the most common
scheduling algorithms in batch systems.
● Each process is assigned a priority. Process with highest priority is to be executed first
and so on.
● Processes with same priority are executed on first come first served basis.
● Priority can be decided based on memory requirements, time requirements or any
other resource requirement.
Given: Table of processes, and their Arrival time, Execution time, and priority. Here we are
considering 1 is the lowest priority.
Process Arrival Time Execution Time Priority Service Time

P0 0 5 1 0

P1 1 3 2 11

P2 2 8 1 14

P3 3 6 3 5

Waiting time of each process is as follows −


Process Waiting Time

P0 0-0=0

P1 11 - 1 = 10

P2 14 - 2 = 12

P3 5-3=2
Average Wait Time: (0 + 10 + 12 + 2)/4 = 24 / 4 = 6
Round Robin Scheduling
● Round Robin is the preemptive process scheduling algorithm.
● Each process is provided a fix time to execute, it is called a quantum.
● Once a process is executed for a given time period, it is preempted and other process
executes for a given time period.
● Context switching is used to save states of preempted processes.

Wait time of each process is as follows −


Process Wait Time : Service Time - Arrival Time

P0 (0 - 0) + (12 - 3) = 9
P1 (3 - 1) = 2

P2 (6 - 2) + (14 - 9) + (20 - 17) = 12

P3 (9 - 3) + (17 - 12) = 11
Average Wait Time: (9+2+12+11) / 4 = 8.5

You might also like