Operating System
CAT 202
Prepared By:
Ms. Shivani Jaswal
Assistant Professor
1
Syllabus
Unit I
Basics of Operating Systems: Definition, Generations of operating systems,
Types of Operating Systems: Mainframe, Desktop, Multiprocessor, Distributed,
Clustered, Multiprogramming, Real time, Embedded and Time sharing.
Fundamentals of Operating System: Multitasking, Multiprogramming,
Timesharing, Buffering, Spooling
Operating System Components: Process Management Component , Memory
Management component, I/O Management component , File Management
component, Protection System, Networking management component,
Command interpreter.
2
Syllabus
UNIT- II
Process Scheduling: Definition , Scheduling objectives, Types of Schedulers,
Scheduling criteria , CPU utilization, Throughput, Turnaround Time, Waiting Time,
Response Time Scheduling Algorithms: Preemptive and Non – preemptive, FCFS,
SJF, RR, Multiprocessor scheduling, Types, Performance evaluation of the
scheduling.
Interprocess Communication and Synchronization: Definition, Shared Memory
System, Message passing, Critical section, Mutual Exclusion, Semaphores.
3
Syllabus
Unit-III
Overview of Unix/Linux, Unix / Linux Startup, User accounts, Logging in and out,
Shutting out, Dual Booting, Command line, Getting Help using man and info pages,
creating files, Unix / Linux file and directory structure, Browsing the file system,
Mail, Unix / Linux Commands, Using Linux GUI- KDE and Gnome, Processes in
Unix / Linux, Bash Shell introduction, Command line shortcuts, Standard I/O,
Redirecting I/O and errors, using pipes, Using vi-editor.
Shell Programming.
4
Operating System
• Operating system is an integrated set of programs that manages the
various hardware resources such as processors, memory, I/O
devices, communication devices and the overall operations of a computer
system.
• Its primary objective is to improve the performance and efficiency of a
computer system and make it user friendly.
• An operating system also acts as a platform on which various application
programs such as word processors and excel are executed.
5
Operating System contd…
• An operating system is a layer of software on the top of the bare
hardware of a computer system.
• This operating system manages all parts of the system, and presents to
the user with an interface or virtual machine, that is easier to program
and use.
• It means, the OS hides the details of the hardware resources from the
programmer and provides the programmer with a convenient interface
for using the computer system.
6
Operating System contd…
7
Fundamentals of Operating System
Multitasking
Multiprogramming
Time Sharing
Spooling
Buffering
8
Multitasking
• Technically, multitasking is same as multiprogramming.
• In a multitasking system, a single user can execute multiple programs
at the same time.
• Multitasking is the system’s capability to work on more than one job
or process at the same time. It means that whenever a job needs to
perform I/O operations, the CPU can be used for executing some other
job or process that is also residing in the system and is ready to use the
CPU.
9
Multitasking contd….
• Thus, multitasking is the method of processing the multiple tasks
concurrently in a single user system.
• For example: a user is running a separate program in four different
windows at the same time.
• Program 1– printing a document.
• Program 2- displaying an e-mail of user.
• Program 3- spreadsheet window preparing sales report.
• Program 4- compilation of a simple program.
10
Multitasking contd….
Cooperative
Pre-emptive Multitasking
11
Multitasking contd….
Cooperative Scheduling:
In this type of multitasking, a program can acquire the CPU for the
required amount of time. A program can share CPU with any other
program that is executing simultaneously, if it does not currently
require the CPU. Microsoft Windows 3.x are the examples of
cooperative multitasking
12
Multitasking contd….
Preemptive Scheduling:
In this type of multitasking, the operating system allocates particular time
a program. The CPU is preempted if a higher priority job arrives in a
system. In this type of multitasking, programs are forces to share the
CPU whether they want to use it or not.
Windows NT, Linux are example of Preemptive scheduling.
13
Multiprogramming
Same as in PPT 2.(Types of Operating System)
14
Multiprogramming contd….
In case of Multiprogramming, the various jobs residing in the main
memory.
Running: CPU is being used by the program.
Blocked: Performing I/O operations.
Ready: Waiting for CPU to be assigned to it.
15
Advantages of Multiprogramming contd….
1. Increased throughput: Throughput is increased by utilizing the idle
time of CPU for running other programs that are already present in the
memory.
2. Lowered response time: The response time is lowered by recognizing
the priority of a job as it enters the system and by processing jobs on a
priority basis.
3. Ability to assign priorities to jobs: Most multiprogramming systems
have schemes for setting priorities for rotating programs. They specify
when the CPU will rotate to another program, and which program it
will rotate to.
16
Disadvantages of Multiprogramming contd….
1. Multiprogramming is implemented through an operating system,
which is a program that requires space in primary storage since it must
be executed by the CPU.
2. Jobs may have different sizes, therefore memory management is
needed to accommodate in memory.
3. Many jobs may be ready to run on the CPU, which means that CPU
scheduling is required
17
Timesharing system
1. Timesharing refers to the allocation of computer resources in a time
dependent fashion to several programs simultaneously.
2. A timesharing system has many user terminals that are connected to
same computer simultaneously. Using these terminal, different users
can work on a system at the same time.
3. Thus, it uses multiprogramming with a special CPU scheduling
algorithm to achieve this.
4. In timesharing system, the CPU is divided among all the users in
scheduled basis
18
Timesharing system contd…
5. Each user program is allocated a very short period of CPU time one by
one beginning from the first user program and proceeding the last one,
and then again beginning from the first one.
6. This short period of time during which user gets the attention of the
CPU is known as time slice, time slot or quantum. It is typically of order
of 10 to 100 milliseconds.
7. Thus, in timesharing, when the CPU is allocated to a user program, the
user uses the CPU for the period of time slot.
19
Timesharing system contd…
8. It releases the CPU under any of the following three conditions:
When the allotted time slices expires.
When the program needs to perform I/O operations.
When the execution of the program is over during the time slice.
9. In timesharing system, the various programs can be in one of the
following three states:
Running: The user’s program currently has control of the CPU. Only
one user will be active at a time.
Ready: The user’s program is ready to execute but is waiting for its
turn to get the CPU.
Blocked: the user’s program is waiting for some I/O operations.
20
Timesharing system contd…
Job is allocated to CPU for execution
New job Ready Running Exit
Allocated time slice is over
I/O Job must
completed wait for I/O
completion
Blocked
21
Advantages of Timesharing
• Reduces CPU idle time: Timesharing reduces idle time of CPU and
increases the utilization of CPU by switching from one program to
another in rapid succession.
• Provides advantage of quick response time: The special CPU
scheduling algorithm used in time sharing systems ensures quick
response time to all users.
22
Thank You
23