0% found this document useful (0 votes)
4 views18 pages

Understanding Operating Systems Basics

An Operating System (OS) is essential system software that manages computer hardware resources and provides a user interface for application programs. It facilitates multitasking, memory management, and input-output operations, ensuring effective communication between software and hardware. Various types of operating systems exist, including batch, multi-programming, time-sharing, personal computer, parallel, distributed, and real-time operating systems, each serving specific functions and user needs.

Uploaded by

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

Understanding Operating Systems Basics

An Operating System (OS) is essential system software that manages computer hardware resources and provides a user interface for application programs. It facilitates multitasking, memory management, and input-output operations, ensuring effective communication between software and hardware. Various types of operating systems exist, including batch, multi-programming, time-sharing, personal computer, parallel, distributed, and real-time operating systems, each serving specific functions and user needs.

Uploaded by

rishidarshan19
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

UNIT 1 – Operating System

Operating System lies in the category of system software. It basically manages all the
resources of the computer. An operating system acts as an interface between the software
and different parts of the computer or the computer hardware. The operating system is
designed in such a way that it can manage the overall resources and operations of the
computer.
Operating System is a fully integrated set of specialized programs that handle all the
operations of the computer. It controls and monitors the execution of all other programs
that reside in the computer, which also includes application programs and other system
software of the computer. Examples of Operating Systems are Windows, Linux, Mac OS,
etc.
An Operating System (OS) is a collection of software that manages computer hardware
resources and provides common services for computer programs. The operating system
is the most important type of system software in a computer system.
Why Use an Operating System?
The operating system helps in improving the computer software as well as hardware.
Without OS, it became very difficult for any application to be user-friendly. Operating
System provides a user with an interface that makes any application attractive and user-
friendly. The operating System comes with a large number of device drivers that makes
OS services reachable to the hardware environment. Each and every application present
in the system requires the Operating System. The operating system works as a
communication channel between system hardware and system software. The operating
system helps interact an application with the hardware part without knowing about the
actual hardware configuration. It is one of the most important parts of the system and
hence it is present in every device, whether large or small device.
Examples of Operating Systems
• Windows (GUI-based, PC)
• GNU/Linux (Personal, Workstations, ISP, File, and print server, Three-tier
client/Server)
• macOS (Macintosh), used for Apple’s personal computers and workstations
(MacBook, iMac).
• Android (Google’s Operating System for smartphones/tablets/smartwatches)
• iOS (Apple’s OS for iPhone, iPad, and iPod Touch)

Need for Operating System


1. OS as a platform for Application programs: The operating system provides a
platform, on top of which, other programs, called application programs can run.
These application programs help users to perform a specific task easily. It acts as
an interface between the computer and the user. It is designed in such a manner
that it operates, controls, and executes various applications on the computer.

2. Managing Input-Output unit: The operating system also allows the computer to
manage its own resources such as memory, monitor, keyboard, printer, etc.
Management of these resources is required for effective utilization. The operating
system controls the various system input-output resources and allocates them to
the users or programs as per their requirements.

3. Multitasking: The operating system manages memory and allows multiple


programs to run in their own space and even communicate with each other
through shared memory. Multitasking gives users a good experience as they can
perform several tasks on a computer at a time.

4. A platform for other software applications: Different application programs are


needed by users to carry out particular system tasks. These applications are
managed and controlled by the OS to ensure their effectiveness. It serves as an
interface between the user and the applications, in other words.

5. Controls memory: It helps in controlling the computer’s main memory.


Additionally, it allows and deallocates memory to all tasks and applications.

6. Looks after system files: It helps with system file management. As far as we are
aware, all of the data on the system exists as files. It facilitates simple file
interaction.
7. Provides Security: It helps to maintain the system and applications safe through
the authorization process. Thus, the OS provides security to the system.
Operating System Services
The main purpose of the operating system is to provide an environment for the execution
of programs. Thus, an operating system provides certain services to programs and the
users of those programs.
1. Program Execution
• The operating system provides a convenient environment where users can run their
programs.
• The operating system performs memory allocation to programs, and loads them into
appropriate location so that they can execute. The users do not have to worry about
all these tasks.
2. I/O Operations
• In order to execute a program, it usually requires an I/O operation. For example, it
may need to read a file and print the output.
• When all these I/O operations are performed users cannot control I/O devices.
• All I/O is performed under the control of the operating system.
3. Communication
• The various processes executing on a system may need to communicate in order to
exchange data or information.
• The operating system provides this communication by using a facility for message
passing. In message passing packets of information are moved between processes by
the operating system.

Types of Operating Systems


Batch Operating System
This type of operating system does not interact with the computer directly. There is an
operator which takes similar jobs having the same requirement and groups them into
batches. It is the responsibility of the operator to sort jobs with similar needs.

Advantages of Batch Operating System


• It is very difficult to guess or know the time required for any job to complete.
Processors of the batch systems know how long the job would be when it is in the
queue.
• 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.
Disadvantages of Batch Operating System
• The computer operators should be well known with batch systems.
• Batch systems are hard to debug.
• It is sometimes costly.
• The other jobs will have to wait for an unknown time if any job fails.
Examples of Batch Operating Systems: Payroll Systems, Bank Statements, etc.

Multi-Programming Operating System

Multiprogramming Operating Systems can be simply illustrated as more than one


program is present in the main memory and any one of them can be kept in execution.
This is basically used for better execution of resources.

Advantages of Multi-Programming Operating System


• Multi Programming increases the Throughput of the System.
• It helps in reducing the response time.

Disadvantages of Multi-Programming Operating System


• There is not any facility for user interaction of system resources with the system.
Time-Sharing Operating Systems
Each task is given some time to execute so that all the tasks work smoothly. Each user
gets the time of the CPU as they use a single system. These systems are also known as
Multitasking Systems. The task can be from a single user or different users also. The time
that each task gets to execute is called quantum. After this time interval is over OS
switches over to the next task.

Advantages of Time-Sharing OS
• Each task gets an equal opportunity.
• Fewer chances of duplication of software.
• CPU idle time can be reduced.
• Resource Sharing: Time-sharing systems allow multiple users to share hardware
resources such as the CPU, memory, and peripherals, reducing the cost of hardware
and increasing efficiency.
• Improved Productivity: Time-sharing allows users to work concurrently, thereby
reducing the waiting time for their turn to use the computer. This increased
productivity translates to more work getting done in less time.
• Improved User Experience: Time-sharing provides an interactive environment that
allows users to communicate with the computer in real time, providing a better user
experience than batch processing.
Disadvantages of Time-Sharing OS
• Reliability problem.
• One must have to take care of the security and integrity of user programs and data.
• Data communication problem.
• High Overhead: Time-sharing systems have a higher overhead than other operating
systems due to the need for scheduling, context switching, and other overheads that
come with supporting multiple users.
• Complexity: Time-sharing systems are complex and require advanced software to
manage multiple users simultaneously. This complexity increases the chance of bugs
and errors.
• Security Risks: With multiple users sharing resources, the risk of security breaches
increases. Time-sharing systems require careful management of user access,
authentication, and authorization to ensure the security of data and software.
Personal Computer Operating System
A personal computer's operating system provides a good interface for a single user.

Personal computer operating systems are widely used for word processing, spreadsheets, and Internet
access.

Personal computer operating systems are made only for personal use.

You can say that your laptops, computer systems, tablets, etc. are your personal computers, and the
operating systems such as Windows 7, Windows 10, Android, etc. are your personal computer operating
systems.

And you can use your personal computer operating system for your personal purposes, for example,
chatting with your friends using some social media sites, reading some articles from the internet, making
some projects through Microsoft PowerPoint or any other program, designing your website,
programming something, watching some videos and movies, listening to some songs, and many more.

Examples of Personal Computer Operating Systems

• Android
• Windows 10
• Windows 7
• Windows XP
• Windows 11
• Windows Vista
• iOS 14
• iOS 15
• iOS 16
• Mac OS X Panther
• Mac OS X Tiger
• Mac OS X Leopard
• Mac OS X Lion
• Mac OS X Ventura
• Linux Mint
• Ubuntu
• Fedora

The first of the above-mentioned personal computer operating systems, "Android,"


is the most well-known and widely used operating system worldwide. This
operating system is used in smartphones.
Parallel Operating System

Parallel operating systems are designed to speed up the execution of programs by dividing
them into multiple segments. It is used for dealing with multiple processors
simultaneously by using computer resources which include a single computer with
multiple processors and several computers connected by a network to form a cluster of
parallel processing or a combination of both. A few examples of the parallel operating
system can be VMware, Microsoft Hyper-V, Red hat enterprise, Oracle VM, KVM/QEMU, and
Sun xVM Server.

Advantages of Parallel Operating System

• It saves time and allows the execution of applications simultaneously


• Solves the large complex problem of operating system
• Multiple resources can be used simultaneously
• Has larger memory for the allocation of resources and tasks
• Faster as compared to another operating system

Disadvantages of Parallel Operating System

• The architecture of the parallel operating system is complex


• High cost since more resources are used for synchronization, data transfer, thread,
and communication. In the case of clusters, better cooling techniques are required.
• Huge power consumption.
• High maintenance.

Application of Parallel Operating System

• Databases and data mining


• Advanced graphics
• Argument reality
• Real-time simulation of a system
• Science and engineering

Distributed Operating System


These types of operating system are a recent advancement in the world of computer
technology and are being widely accepted all over the world and, that too, at a great pace.
Various autonomous interconnected computers communicate with each other using a
shared communication network. Independent systems possess their own memory unit
and CPU. These are referred to as loosely coupled systems or distributed systems. These
systems’ 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.

Advantages of Distributed Operating System


• Failure of one will not affect the other network communication, as all systems are
independent of each other.
• Electronic mail increases the data exchange speed.
• 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.
Disadvantages of Distributed Operating System
• Failure of the main network will stop the entire communication.
• To establish distributed systems the language is used not well-defined yet.
• These types of systems are not readily available as they are very expensive. Not only
that the underlying software is highly complex and not understood well yet.
Examples of Distributed Operating Systems are LOCUS, etc.

Real-Time Operating System


These types of OSs 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.

Types of Real-Time Operating Systems


• Hard Real-Time Systems:
Hard Real-Time OSs are meant for applications where time constraints are very
strict and even the shortest possible delay is not acceptable. These systems are built
for saving life like automatic parachutes or airbags which are required to be readily
available in case of an accident. Virtual memory is rarely found in these systems.
• Soft Real-Time Systems:
These OSs are for applications where time-constraint is less strict.
Advantages of RTOS
• Maximum Consumption: Maximum utilization of devices and systems, thus more
output from all the resources.
• Task Shifting: The time assigned for shifting tasks in these systems is very less. For
example, in older systems, it takes about 10 microseconds in shifting from one task to
another, and in the latest systems, it takes 3 microseconds.
• Focus on Application: Focus on running applications and less importance on
applications that are in the queue.
• Real-time operating system in the embedded system: Since the size of programs is
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.

Disadvantages of RTOS
• Limited Tasks: Very few tasks run at the same time and their concentration is very
less on a 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
signal 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.

Examples of Real-Time Operating Systems are Scientific experiments, medical imaging


systems, industrial control systems, weapon systems, robots, air traffic control systems,
etc.
Process management

Process management refers to the techniques and strategies used by organizations to


design, monitor, and control their business processes to achieve their goals efficiently
and effectively. It involves identifying the steps involved in completing a task, assessing
the resources required for each step, and determining the best way to execute the task.
If the operating system supports multiple users then services under this are very
important. In this regard, operating systems have to keep track of all the completed
processes, Schedule them, and dispatch them one after another. But the user should feel
that he has full control of the CPU.
Some of the systems calls in this category are as follows.
1. Create a child’s process identical to the parent’s.
2. Terminate a process
3. Wait for a child process to terminate
4. Change the priority of the process
5. Block the process
6. Ready the process
7. Dispatch a process
8. Suspend a process
9. Resume a process
10. Delay a process
11. Fork a process

Operation on a Process
The execution of a process is a complex activity. It involves various operations. Following
are the operations that are performed while execution of a process:

Creation
This is the initial step of the process execution activity. Process creation means the
construction of a new process for execution. This might be performed by the system, the
user, or the old process itself. There are several events that lead to the process creation.
Some of the events are the following:
1. When we start the computer, the system creates several background processes.
2. A user may request to create a new process.
3. A process can create a new process itself while executing.
4. The batch system takes initiation of a batch job.

Scheduling/Dispatching
The event or activity in which the state of the process is changed from ready to run. It
means the operating system puts the process from the ready state into the running state.
Dispatching is done by the operating system when the resources are free or the process
has higher priority than the ongoing process. There are various other cases in which the
process in the running state is preempted and the process in the ready state is dispatched
by the operating system.

Blocking
When a process invokes an input-output system call that blocks the process, and
operating system is put in block mode. Block mode is basically a mode where the process
waits for input-output. Hence on the demand of the process itself, the operating system
blocks the process and dispatches another process to the processor. Hence, in process-
blocking operations, the operating system puts the process in a ‘waiting’ state.

Preemption
When a timeout occurs that means the process hadn’t been terminated in the allotted
time interval and the next process is ready to execute, then the operating system
preempts the process. This operation is only valid where CPU scheduling supports
preemption. Basically, this happens in priority scheduling where on the incoming of high
priority process the ongoing process is preempted. Hence, in process preemption
operation, the operating system puts the process in a ‘ready’ state.

Process Termination
Process termination is the activity of ending the process. In other words, process
termination is the relaxation of computer resources taken by the process for the
execution. Like creation, in termination also there may be several events that may lead to
the process of termination. Some of them are:
1. The process completes its execution fully and it indicates to the OS that it has finished.
2. The operating system itself terminates the process due to service errors.
3. There may be a problem in hardware that terminates the process.
4. One process can be terminated by another process.
Cooperating Process
There are various processes in a computer system, which can be either independent or
cooperating processes that operate in the operating system. It is considered independent
when any other processes operating on the system may not impact a process. Process-
independent processes don't share any data with other processes. On the other way, a
collaborating process may be affected by any other process executing on the system. A
cooperating process shares data with another.

Advantages of Cooperating Process in Operating System

There are various advantages of cooperating process in the operating system. Some
advantages of the cooperating system are as follows:

1. Information Sharing

Cooperating processes can be used to share information between various processes. It


could involve having access to the same files. A technique is necessary so that the processes
may access the files concurrently.

2. Modularity

Modularity refers to the division of complex tasks into smaller subtasks. Different
cooperating processes can complete these smaller subtasks. As a result, the required tasks
are completed more quickly and efficiently.

3. Computation Speedup

Cooperating processes can be used to accomplish subtasks of a single task simultaneously.


It improves computation speed by allowing the task to be accomplished faster. Although, it
is only possible if the system contains several processing elements.

4. Convenience

There are multiple tasks that a user requires to perform, such as printing, compiling,
editing, etc. It is more convenient if these activities may be managed through cooperating
processes.

Concurrent execution of cooperating processes needs systems that enable processes to


communicate and synchronize their actions.
Methods of Cooperating Process

Cooperating processes may coordinate with each other by sharing data or messages. The
methods are given below:

1. Cooperation by sharing

The processes may cooperate by sharing data, including variables, memory, databases, etc.
The critical section provides data integrity, and writing is mutually exclusive to avoid
inconsistent data.

In this diagram, Process P1 and P2 may cooperate by using shared data like files, databases,
variables, memory, etc.

2. Cooperation by Communication

The cooperating processes may cooperate by using messages. If every process waits for a
message from another process to execute a task, it may cause a deadlock. If a process does
not receive any messages, it may cause starvation.

Here, you have seen a diagram that shows cooperation by communication. In this diagram,
Process P1 and P2 may cooperate by using messages to communicate.
Threads and its types in Operating System
Thread is a single sequence stream within a process. Threads have same properties as of
the process so they are called as light weight processes. Threads are executed one after
another but give the illusion as if they are executing in parallel. Each thread has different
states. Each thread has
1. A program counter
2. A register set
3. A stack space
Threads are not independent of each other as they share the code, data, OS resources etc.

Similarity between Threads and Processes –


• Only one thread or process is active at a time
• Within process both execute sequential
• Both can create children
• Both can be scheduled by the operating system: Both threads and processes can be
scheduled by the operating system to execute on the CPU. The operating system is
responsible for assigning CPU time to the threads and processes based on various
scheduling algorithms.
• Both have their own execution context: Each thread and process has its own execution
context, which includes its own register set, program counter, and stack. This allows
each thread or process to execute independently and make progress without
interfering with other threads or processes.
• Both can communicate with each other: Threads and processes can communicate with
each other using various inter-process communication (IPC) mechanisms such as
shared memory, message queues, and pipes. This allows threads and processes to
share data and coordinate their activities.
• Both can be preempted: Threads and processes can be preempted by the operating
system, which means that their execution can be interrupted at any time. This allows
the operating system to switch to another thread or process that needs to execute.
• Both can be terminated: Threads and processes can be terminated by the operating
system or by other threads or processes. When a thread or process is terminated, all
of its resources, including its execution context, are freed up and made available to
other threads or processes.

Differences between Threads and Processes –


• Resources: Processes have their own address space and resources, such as memory
and file handles, whereas threads share memory and resources with the program that
created them.
• Scheduling: Processes are scheduled to use the processor by the operating system,
whereas threads are scheduled to use the processor by the operating system or the
program itself.
• Creation: The operating system creates and manages processes, whereas the
program or the operating system creates and manages threads.
• Communication: Because processes are isolated from one another and must rely on
inter-process communication mechanisms, they generally have more difficulty
communicating with one another than threads do. Threads, on the other hand, can
interact with other threads within the same programme directly.
Threads, in general, are lighter than processes and are better suited for concurrent
execution within a single programme. Processes are commonly used to run separate
programmes or to isolate resources between programmes.
Types of Threads:
1. User Level thread (ULT) – Is implemented in the user level library, they are not
created using the system calls. Thread switching does not need to call OS and to cause
interrupt to Kernel. Kernel doesn’t know about the user level thread and manages
them as if they were single-threaded processes.
• Advantages of ULT –
• Can be implemented on an OS that doesn’t support multithreading.
• Simple representation since thread has only program counter, register
set, stack space.
• Simple to create since no intervention of kernel.
• Thread switching is fast since no OS calls need to be made.
• Limitations of ULT –
• No or less co-ordination among the threads and Kernel.
• If one thread causes a page fault, the entire process blocks.
2. Kernel Level Thread (KLT) – Kernel knows and manages the threads. Instead of
thread table in each process, the kernel itself has thread table (a master one) that
keeps track of all the threads in the system. In addition kernel also maintains the
traditional process table to keep track of the processes. OS kernel provides system call
to create and manage threads.
• Advantages of KLT –
• Since kernel has full knowledge about the threads in the system,
scheduler may decide to give more time to processes having large
number of threads.
• Good for applications that frequently block.
• Limitations of KLT –
• Slow and inefficient.
• It requires thread control block so it is an overhead.

Interprocess communication is the mechanism provided by the operating system that


allows processes to communicate with each other. This communication could involve a
process letting another process know that some event has occurred or the transferring of
data from one process to another.
A diagram that illustrates interprocess communication is as follows −

Synchronization in Interprocess Communication


Synchronization is a necessary part of interprocess communication. It is either provided
by the interprocess control mechanism or handled by the communicating processes. Some
of the methods to provide synchronization are as follows −

• Semaphore
A semaphore is a variable that controls the access to a common resource by multiple
processes. The two types of semaphores are binary semaphores and counting
semaphores.
• Mutual Exclusion
Mutual exclusion requires that only one process thread can enter the critical section
at a time. This is useful for synchronization and also prevents race conditions.
• Barrier
A barrier does not allow individual processes to proceed until all the processes reach
it. Many parallel languages and collective routines impose barriers.
• Spinlock
This is a type of lock. The processes trying to acquire this lock wait in a loop while
checking if the lock is available or not. This is known as busy waiting because the
process is not doing any useful operation even though it is active.

Approaches to Interprocess Communication

The different approaches to implement interprocess communication are given as follows −

• Pipe
A pipe is a data channel that is unidirectional. Two pipes can be used to create a two-
way data channel between two processes. This uses standard input and output
methods. Pipes are used in all POSIX systems as well as Windows operating systems.
• Socket
The socket is the endpoint for sending or receiving data in a network. This is true for
data sent between processes on the same computer or data sent between different
computers on the same network. Most of the operating systems use sockets for
interprocess communication.
• File
A file is a data record that may be stored on a disk or acquired on demand by a file
server. Multiple processes can access a file as required. All operating systems use
files for data storage.
• Signal
Signals are useful in interprocess communication in a limited way. They are system
messages that are sent from one process to another. Normally, signals are not used
to transfer data but are used for remote commands between processes.
• Shared Memory
Shared memory is the memory that can be simultaneously accessed by multiple
processes. This is done so that the processes can communicate with each other. All
POSIX systems, as well as Windows operating systems use shared memory.
• Message Queue
Multiple processes can read and write data to the message queue without being
connected to each other. Messages are stored in the queue until their recipient
retrieves them. Message queues are quite useful for interprocess communication
and are used by most operating systems.

A diagram that demonstrates message queue and shared memory methods of interprocess
communication is as follows −

You might also like