Operating System
Operating System
Operating System
• 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.
Operating System
• 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.
Importance of OS
• O/S provides the interface between the users and hardware.
• O/S allows to User Friendly Graphic Interface for all users because it provides various menus, buttons, icons,
and more for easy navigation
• No required any technical skills for operating GUI O/S.
• Cost effective.
• It has responsible for controlling and manipulate of all computer functions.
• These platforms are comfortable for all programs.
• It allows the best features such as “Plug and play”, means no need any drivers for using their devices like as
mouse, keyboard, and more.
• O/S uses numerous techniques such as memory segmentation, paging, and swapping. Operating system can
manage own memory with using those techniques.
• Operating System provides the assistance for managing the all input and output devices of computer system.
• Operating System can also manage all types of interrupts.
• O/S allows sharing one piece of data with many users.
• It also can share different resources like as Printer, Fax etc.
• O/S can be updated time by time without any hassle.
Functions
Important 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
Function
• Security: The operating system uses password protection to protect user data and similar
other techniques. it also prevents unauthorized access to programs and user data.
• Control over system performance: Monitors overall system health to help improve
performance. records the response time between service requests and system response
to having a complete view of the system health. This can help improve performance by
providing important information needed to troubleshoot problems.
• Job accounting: Operating system Keeps track of time and resources used by various tasks
and users, this information can be used to track resource usage for a particular user or
group of users.
• Error detecting aids: The operating system constantly monitors the system to detect
errors and avoid the malfunctioning of a computer system.
• Coordination between other software and users: Operating systems also coordinate and
assign interpreters, compilers, assemblers, and other software to the various users of the
computer systems.
Functions
• Memory Management : The operating system manages the Primary Memory or Main Memory. Main memory is made up
of a large array of bytes or words where each byte or word is assigned a certain address. Main memory is fast storage and
it can be accessed directly by the CPU. For a program to be executed, it should be first loaded in the main memory. An
Operating System performs the following activities for memory management: It keeps track of primary memory, i.e.,
which bytes of memory are used by which user program. The memory addresses that have already been allocated and the
memory addresses of the memory that has not yet been used. In multiprogramming, the OS decides the order in which
processes are granted access to memory, and for how long. It Allocates the memory to a process when the process
requests it and deallocates the memory when the process has terminated or is performing an I/O operation.
• Processor Management: In a multi-programming environment, the OS decides the order in which processes have access
to the processor, and how much processing time each process has. This function of OS is called process scheduling. An
Operating System performs the following activities for processor management. Keeps track of the status of processes. The
program which performs this task is known as a traffic controller. Allocates the CPU that is a processor to a process.
De-allocates processor when a process is no more required.
• Device Management : An OS manages device communication via their respective drivers. It performs the following
activities for device management. Keeps track of all devices connected to the system. designates a program responsible
for every device known as the Input/Output controller. Decides which process gets access to a certain device and for how
long. Allocates devices in an effective and efficient way. Deallocates devices when they are no longer required.
• File Management : A file system is organized into directories for efficient or easy navigation and usage. These directories
may contain other directories and other files. An Operating System carries out the following file management activities. It
keeps track of where information is stored, user access settings and status of every file, and more… These facilities are
collectively known as the file system.
Operating System Terminology
• Based in Processing model
• Batch Processing OS
• Multitasking/multiprogramming OS
• Time sharing OS
• Real time OS
• Multiprocessing OS
• Distributed OS
• On-line Processing
Operating System Terminology
• Based on Mode of User
• Single User OS
• Multiuser OS
• Based on User Interface
• GUI
• CUI
Batch processing
Batch processing is a technique in which an Operating System collects the programs and data together in a batch before processing starts.
An operating system does the following activities related to batch processing −
•The OS defines a job which has predefined sequence of commands, programs and data as a single unit.
•The OS keeps a number a jobs in memory and executes them without any manual information.
•Jobs are processed in the order of submission, i.e., first come first served fashion.
•When a job completes its execution, its memory is released and the output for the job gets copied into an output spool for later printing or processing.
Advantages
•Batch processing takes much of the work of the operator to the computer.
•Increased performance as a new job get started as soon as the previous job is finished, without any manual intervention.
Disadvantages
•Difficult to debug program.
•A job could enter an infinite loop.
•Due to lack of protection scheme, one batch job can affect pending jobs.
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.
•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.
Multiprogramming
Sharing the processor, when two or more programs reside in memory at the same time, is referred as multiprogramming.
Multiprogramming assumes a single shared processor. Multiprogramming increases CPU utilization by organizing jobs so
that the CPU always has one to execute. The following figure shows the memory layout for a multiprogramming system.
Advantages
•High and efficient CPU utilization.
•User feels that many programs are allotted CPU almost simultaneously.
Disadvantages
•CPU scheduling is required.
•To accommodate many jobs in memory, memory management is required.
Spooling
Spooling is an acronym for simultaneous peripheral operations on line. Spooling refers to putting data of various I/O jobs in a
buffer. This buffer is a special area in memory or hard disk which is accessible to I/O devices.
An operating system does the following activities related to distributed environment −
•Handles I/O device data spooling as devices have different data access rates.
•Maintains the spooling buffer which provides a waiting station where data can rest while the slower device catches up.
•Maintains parallel computation because of spooling process as a computer can perform I/O in parallel fashion. It becomes
possible to have the computer read data from a tape, write data to disk and to write out to a tape printer while it is doing its
computing task.
Advantages
•The spooling operation uses a disk as a very large buffer.
•Spooling is capable of overlapping I/O operation for one job with processor operations for another job.
Process Management
• Process is the execution of a program that performs the actions
specified in that program. It can be defined as an execution unit
where a program runs. The OS helps you to create, schedule, and
terminates the processes which is used by CPU. A process created
by the main process is called a child process.
• Process management involves various tasks like creation,
scheduling, termination of processes, and a dead lock. Process is a
program that is under execution, which is an important part of
modern-day operating systems. The OS must allocate resources that
enable processes to share and exchange information. It also protects
the resources of each process from other methods and allows
synchronization among processes.
• It is the job of OS to manage all the running processes of the system.
It handles operations by performing tasks like process scheduling
and such as resource allocation.
Process States
Process States
• A process state is a condition of the process at a specific instant of time. It also defines the
current position of the process.
• New: The new process is created when a specific program calls from secondary memory/
hard disk to primary memory/ RAM a
• Ready: In a ready state, the process should be loaded into the primary memory, which is
ready for execution.
• Waiting: The process is waiting for the allocation of CPU time and other resources for
execution.
• Executing: The process is an execution state.
• Blocked: It is a time interval when a process is waiting for an event like I/O operations to
complete.
• Suspended: Suspended state defines the time when a process is ready for execution but
has not been placed in the ready queue by OS.
• Terminated: Terminated state specifies the time when a process is terminated
Process Scheduling
• The process scheduling is the activity of the process manager that handles the
removal of the running process from the CPU and the selection of another process
on the basis of a particular strategy.
• 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
• Shortest Remaining Time
• 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.
Deadlock
• Deadlock is a situation where a set of
processes are blocked because each
process is holding a resource and waiting for
another resource acquired by some other
process.