Module 1
Module 1
Module 1
Introduction to Operating
System
CO1: Understand the role of an operating system, its function and issues.
2
• A more common definition is that the operating system is
the one program running at all times on the computer
(usually called the kernel), with all else being application
programs.
3
Objective of OS:
The objectives of the operating system are −
▪ To act as an intermediary between the hardware and its users, making it easier for the users to
access and use other resources.
▪ To keep track of who is using which resource, granting resource requests, and mediating
conflicting requests from different programs and users.
▪ To provide efficient and fair sharing of resources among users and programs.
4
Function of operating system:
Operating system performs following basic functions:
3. Drive/disk management: An operating system manages computer drives and divides disks.
4. Device control: An operating system enables you to allow or block access to devices.
7
Types of operating system are:
• Batch OS
• Multi programming OS
• Multi tasking or Time sharing OS
• Distributed OS
• Real Time OS (RTOS)
• Network OS
8
Batch Operating System
9
• operating system does not interact with the computer directly.
• There is an operator which takes similar jobs having the same requirement
and group them into batches.
• It is the responsibility of the operator to sort jobs with similar needs.
• Multiple users can share the batch systems.
• The idle time for the batch system is very less.
• It is easy to manage large work repeatedly in batch systems.
10
Multi programming OS
11
Multiprogramming OS – The main memory consists of jobs waiting for
CPU time. The OS selects one of the processes and assigns it to the CPU.
Whenever the executing process needs to wait for any other operation
(like I/O), the OS selects another process from the job queue and assigns it
to the CPU. This way, the CPU is never kept idle and the user gets the
flavor of getting multiple tasks done at once.
12
Multi tasking OS/Time sharing OS:
• The time-sharing operating system, also known as a multitasking OS, works
by allocating time to a particular task and switching between tasks
frequently. Unlike the batch system, the time-sharing system allows users to
complete their work in the system simultaneously. It allows many users to
be distributed across various terminals to minimize response time.
13
Advantages of time-sharing operating systems include:
• There's a quick response during task performance.
• It minimizes the idle time of the processor.
• All tasks get an equal chance of being accomplished.
Disadvantages of this system are:
• The user's data security might be a problem.
• System failure can lead to widespread failures.
• Problems in data communication may arise.
• The integrity of user programs is not assured.
14
Distributed Operating System
Reference video:
https://www.youtube.com/watch?v=NYBKXzl5bWU 15
• Various autonomous interconnected computers communicate with
each other using a shared communication network.
• Independent systems possess their own memory unit and CPU.
• These system’s processors differ in size and function. The major
benefit of working with these types of the operating system is that it
is always possible that one user can access the files or software
which are not actually present on his system but some other system
connected within this network i.e., remote access is enabled within
the devices connected in that network.
16
Advantages of Distributed Operating System:
• Failure of one will not affect the other network communication, as all systems are
independent from each other
• Since resources are being shared, computation is highly fast and durable.
• Load on host computer reduces.
• These systems are easily scalable as many systems can be easily added to the network
• Delay in data processing reduces
17
Disadvantages of Distributed Operating System:
• These types of systems are not readily available as they are very expensive.
Not only that the underlying software is highly complex
18
Real Time Operating System
• It’s OS specially designed to run application with very precise timing and high
degree of reliability
• These types of OS serve real-time systems. The time interval required to process
and respond to inputs is very small. This time interval is called response time.
• Real-time systems are used when there are time requirements that are very
strict like missile systems, air traffic control systems, robots, etc.
20
Advantages of RTOS:
• Maximum Consumption: Maximum utilization of devices
and system, thus more output from all the resources
• Task Shifting: The time assigned for shifting tasks in these
systems are very less. For example, in older systems, it
takes about 10 microseconds in shifting one task to another,
and in the latest systems, it takes 3 microseconds.
• Focus on Application: Focus on running applications and
less importance to applications which are in the queue.
• Real-time operating system in the embedded
system: Since the size of programs are small, RTOS can
also be used in embedded systems like in transport and
others.
• Error Free: These types of systems are error-free.
• Memory Allocation: Memory allocation is best managed in
these types of systems.
21
Disadvantages of RTOS:
• Limited Tasks: Very few tasks run at the same time and their concentration
is very less on few applications to avoid errors.
• Use heavy system resources: Sometimes the system resources are not so
good and they are expensive as well.
• Complex Algorithms: The algorithms are very complex and difficult for the
designer to write on.
• Device driver and interrupt signals: It needs specific device drivers and
interrupts signals to respond earliest to interrupts.
• Thread Priority: It is not good to set thread priority as these systems are
very less prone to switching tasks.
22
Network Operating System
23
• These systems run on a server and provide the capability to manage data,
users, groups, security, applications, and other networking functions.
• These types of operating systems allow shared access of files, printers,
security, applications, and other networking functions over a small private
network.
• One more important aspect of Network Operating Systems is that all the
users are well aware of the underlying configuration, of all other users within
the network, their individual connections, etc.
25
Evolution of Operating(self study)
System:http://lilly021.com/the-evolution-of-the-operating-syste
m/
26
System calls
27
Services Provided by System Calls :
1.Process creation and management
2.Main memory management
3.File Access, Directory and File system management
4.Device handling(I/O)
5.Protection
6.Networking, etc.
28
Examples of Windows and Unix System CallsSystem
– calls Windows Unix
CreateProcess() fork()
Process
ExitProcess() exit()
Control
WaitForSingleObject() wait()
CreateFile() open()
File ReadFile() read()
Manipulation WriteFile() write()
CloseHandle() close()
SetConsoleMode() ioctl()
Device
ReadConsole() read()
Manipulation
WriteConsole() write()
GetCurrentProcessID() getpid()
Information
SetTimer() alarm()
Maintenance
Sleep() sleep()
CreatePipe() pipe()
Communicati
CreateFileMapping() shmget()
on
MapViewOfFile() mmap()
SetFileSecurity() chmod()
Protection InitlializeSecurityDescriptor() umask()
SetSecurityDescriptorGroup() chown()
29
Structure of operating system
❑ An operating system allows the user application programs to interact with the
system hardware. Since the operating system is such a complex structure, it
should be created with utmost care so it can be used and modified easily.
30
Simple Structure
• It is MS-DOS structure
• The interfaces and levels of functionality are not well
separated.
• All Application program has direct access to BIOS.
• Any harmful program or malicious program may crashes the
operating system.
Advantages of Simple structure:
• It delivers better application performance because of the
few interfaces between the application program and the
hardware.
• Easy for kernel developers to develop such an operating
system.
32
Features of Monolithic System
The monolithic operating system provides the following features to the users, such as:
Simple structure: This type of operating system has a simple structure. All the components
needed for processing are embedded into the kernel.
Works for smaller tasks: It works better for performing smaller tasks as it can handle limited
resources.
Communication between components: All the components can directly communicate with
each other and also with the kernel.
Fast operating system: The code to make a monolithic kernel is very fast and robust.
Limitation:
• Adding and removing features from monolithic OS is very difficult. All the code needs to be
rewritten and recompiled to add or remove any feature.
• Debugging is difficult in case of failure.
33
Layered structure
Why Layering in Operating System?
• Layering provides a distinct advantage in an operating
system. All the layers can be defined separately and interact
with each other as required. Also, it is easier to create,
maintain and update the system if it is done in the form of
layers.
• Change in one layer specification does not affect the rest of
the layers.
• Each of the layers in the operating system can only interact
with the layers that are above and below it.
• The lowest layer handles the hardware and the uppermost
layer deals with the user applications.
34
Details about the six layers are:
Hardware
This layer interacts with the system hardware and coordinates with all the peripheral
devices used such as printer, mouse, keyboard, scanner etc. The hardware layer is the
lowest layer in the layered operating system architecture.
CPU Scheduling
This layer deals with scheduling the processes for the CPU. There are many scheduling
queues that are used to handle processes. When the processes enter the system, they
are put into the job queue. The processes that are ready to execute in the main
memory are kept in the ready queue.
35
Memory Management
Memory management deals with memory and the moving of processes from disk
to primary memory for execution and back again. This is handled by the third layer
of the operating system.
Process Management
This layer is responsible for managing the processes i.e assigning the processor to a
process at a time. This is known as process scheduling. The different algorithms
used for process scheduling are FCFS (first come first served), SJF (shortest job
first), priority scheduling, round-robin scheduling etc.
I/O Buffer
I/O devices are very important in the computer systems. They provide users with
the means of interacting with the system. This layer handles the buffers for the I/O
devices and makes sure that they work correctly.
36
User Programs
This is the highest layer in the layered operating system. This layer deals with the
many user programs and applications that run in an operating system such as
word processors, games, browsers etc.
37
Microkernel
38
Question:-Difference between Microkernel and monolithic operating system
39