Unit-1 Os
Unit-1 Os
The devices which display the result generated by the computer are
known as output devices.
Monitor, printer, plotter, speaker etc are the example of output devices.
A program that acts as an intermediary/interface between a user of a computer and the computer
hardware.
An operating system is a program which manages all the computer hardwares.
It provides the base for application program and acts as an intermediary between a user and the
computer hardware.
OS is a resource allocator , it manages all resources
Decides between conflicting requests for efficient and fair resource use
OS is a control program, it controls execution of programs to prevent errors and improper use of
the computer
No universally accepted definition
Everything a vendor ships when you order an operating system‖ is good approximation But varies
wildly The one program running at all times on the computer‖ is the kernel. Everything else is
either a system program (ships with the operating system) or an application program
The operating system has two objectives such as:
Firstly, an operating system controls the computer’s hardware.
The second objective is to provide an interactive interface to the user and
interpret commands so that it can communicate with the hardware
An operating System is a collection of system programs that together control the
operations of a computer system.
Some examples of operating systems are UNIX, Mach, MS-DOS, MS-Windows,
Windows/NT, Chicago, OS/2, MacOS, VMS, MVS, and VM.
Operating system goals:
Execute user programs and make solving user problems easier.
Make the computer system convenient to use. • Use the computer hardware in an
efficient manner
Components of OS
1. User View
2. System View
User View
User View: From the user’s point view, the OS is designed for one user to monopolize
its resources, to maximize the work that the user is performing and for ease of use.
The user view of the computer varies by the interface being used. The examples are -
windows XP, vista, windows 7 etc. Most computer user sit in the in front of personal
computer (pc) in this case the operating system is designed mostly for easy use with
some attention paid to resource utilization.
Some user sit at a terminal connected to a mainframe/minicomputer. In this case other
users are accessing the same computer through the other terminals. There user are
share resources and may exchange the information. The operating system in this case is
designed to maximize resources utilization to assume that all available CPU time,
memory and I/O are used efficiently and no individual user takes more than his/her fair
and share.
The other users sit at workstations connected to network of other workstations and
servers. These users have dedicated resources but they share resources such as
networking and servers like file, compute and print server. Here the operating system is
designed to compromise between individual usability and resource utilization.
Systems View
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.
This type of OS accepts more than one jobs and these jobs are
batched/ grouped together according to their similar requirements.
This is done by computer operator. Whenever the computer
becomes available, the batched jobs are sent for execution and
gradually the output is sent back to the user.
It allowed only one program at a time.
This OS is responsible for scheduling the jobs according to
priority and the resource required.
Advantages of Batch Operating
System
1. Reliability problem.
2. One must have to take care of the security and integrity of user programs and
data.
3. The multiple processors are busier at the same time to complete any task in a
multitasking environment, so the CPU generates more heat.
4. 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.
5. Complexity: Time-sharing systems are complex and require advanced software
to manage multiple users simultaneously. This complexity increases the chance
of bugs and errors.
6. 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.
Network 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.
A real-time operating system (RTOS) is a multitasking operating system
intended for applications with fixed deadlines (real-time computing). Such
applications include some small embedded systems, automobile engine
controllers, industrial robots, spacecraft, industrial control, and some large-
scale computing systems.
Types of Real-Time Operating
Systems
1. 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.
1. Limited Tasks: Very few tasks run at the same time and their concentration is
very less on a few applications to avoid errors.
2. Use heavy system resources: Sometimes the system resources are not so good
and they are expensive as well.
3. Complex Algorithms: The algorithms are very complex and difficult for the
designer to write on.
4. Device driver and interrupt signals: It needs specific device drivers and
interrupts signal to respond earliest to interrupts.
5. Thread Priority: It is not good to set thread priority as these systems are very
less prone to switching tasks.
1. Process Management
A process is a program in execution. A process needs certain resources,
including CPU time, memory, files, and I/O devices, to accomplish its
task.
The operating system is responsible for the following activities in
connection with process management.
✦ Process creation and deletion.
✦ process suspension and resumption.
✦ Provision of mechanisms for:
• process synchronization
• process communication
Functions of Operating
System(Contd.)
2. Main-Memory Management
Memory is a large array of words or bytes, each with its own address. It is
a repository of quickly accessible data shared by the CPU and I/O
devices.
Main memory is a volatile storage device. It loses its contents in the case
of system failure.
The operating system is responsible for the following activities in
connections with memory management:
♦ Keep track of which parts of memory are currently being used and by
whom.
♦ Decide which processes to load when memory space becomes available.
♦ Allocate and de-allocate memory space as needed.
3. Secondary-Storage Management
Since main memory (primary storage) is volatile and too small to
accommodate all data and programs
permanently, the computer system must provide secondary storage to
back up main memory.
Most modern computer systems use disks as the principle on-line storage
medium, for both programs and data.
The operating system is responsible for the following activities in
connection with disk management:
✦ Free space management
✦ Storage allocation
✦ Disk scheduling
4. File Management
A file is a collection of related information defined by its creator.
Commonly, files represent programs (both source and object forms) and
data.
The operating system is responsible for the following activities in
connections with file management:
✦ File creation and deletion.
✦ Directory creation and deletion.
✦ Support of primitives for manipulating files and directories.
✦ Mapping files onto secondary storage.
✦ File backup on stable (non volatile) storage media.
5. I/O System Management
The I/O system consists of:
✦ A buffer-caching system
✦ A general device-driver interface
✦ Drivers for specific hardware devices
6. Networking:
A distributed system is a collection of processors that don’t share memory
peripheral devices or a clock. Each processor has its own local memory & clock
and the processor communicate with one another through various
communication lines such as high speed buses or networks. The processors
in the system are connected through communication networks which are
configured in a number of different ways. The communication network design
must consider message routing & connection strategies are the problems of
connection & security.
7. Protection or security:
If a computer system has multi users & allow the concurrent execution of
multiple processes then the various processes must be protected from one
another’s activities. For that purpose, mechanisms ensure that files,
memory segments, CPU & other resources can be operated on by only
those processes that have gained proper authorization from the OS.
8. Command interpretation:
One of the most important functions of the OS is connected interpretation
where it acts as the interface between the user & the OS.
Operating System Services
The instruction execution cycle, also known as the machine cycle or fetch-
decode-execute cycle, is a fundamental concept in computer architecture
and operating systems. It refers to the sequence of steps that a computer's
central processing unit (CPU) goes through to fetch, decode, and execute an
instruction from memory.
A program residing in the memory unit of a computer consists of a sequence
of instructions. These instructions are executed by the processor by going
through a cycle for each instruction.
The instruction execution cycle is a critical concept in computer architecture
that underlies the functioning of CPUs. Understanding this cycle helps
computer scientists and engineers design efficient processors and develop
optimized programs. Operating systems play a vital role in managing the
execution of processes, coordinating their access to the CPU, and ensuring
efficient resource utilization
Click icon to add picture
In a basic computer, each instruction
cycle consists of the following phases:
1. Fetch:
The CPU fetches the next instruction from memory.
The program counter (PC) holds the memory address of the next instruction to be
fetched.
The CPU transfers the instruction from memory to its internal instruction register.
2. Decode:
The fetched instruction is decoded to determine the operation to be performed and the
operands involved.
The control unit of the CPU interprets the instruction opcode and identifies the
necessary data paths and control signals.
3. Execute:
The actual execution of the instruction takes place during this phase.
The ALU (Arithmetic Logic Unit) performs the arithmetic or logical operation
specified by the instruction.
Data is manipulated based on the operands provided by the instruction.
Interrupt
System calls provide the interface between a process & the OS. These are
usually available in the form of assembly language instruction. Some
systems allow system calls to be made directly from a high level language
program like C, PERL etc. systems calls occur in different ways depending
on the computer in use.
System calls can be roughly grouped into 5 major categories
1. Process Control
2. File Manipulation
3. Deviced Management
4. Information Maintenance
5. Communication
Process Control
1. End, abort: A running program needs to be able to has its execution either
normally (end) or abnormally (abort).
2. Load, execute: A process or job executing one program may want to load and
executes another program.
3. Create Process, terminate process: There is a system call specifying for the
purpose of creating a new process or job (create process or submit job). We may
want to terminate a job or process that we created (terminates process, if we find
that it is incorrect or no longer needed).
4. Get process attributes, set process attributes: If we create a new job or process
we should able to control its execution. This control requires the ability to
determine & reset the attributes of a job or processes (get process attributes, set
process attributes).
5. Wait time: After creating new jobs or processes, we may need to wait for them to
finish their execution (wait time).
6. Wait event, signal event: We may wait for a specific event to occur (wait event).
The jobs or processes then signal when that event has occurred (signal event).
File Manipulation
1. Create file, delete file: We first need to be able to create & delete files.
Both the system calls require the name of the file & some of its
attributes.
2. Open file, close file: Once the file is created, we need to open it & use
it. We close the file when we are no longer using it.
3. Read, write, reposition file: After opening, we may also read, write or
reposition the file (rewind or skip to the end of the file).
4. Get file attributes, set file attributes: For either files or directories,
we need to be able to determine the values of various attributes & reset
them if necessary. Two system calls get file attribute & set file attributes
are required for their purpose.
Device Management
1. Get time or date, set time or date:Most systems have a system call to
return the current date & time or set the current date & time.
2. Get system data, set system data: Other system calls may return
information about the system like number of current users, version
number of OS, amount of free memory etc.
3. Get process attributes, set process attributes: The OS keeps
information about all its processes & there are system calls to access
this information.
Communications