0% found this document useful (0 votes)
25 views72 pages

Unit-1 Os

learn operating system

Uploaded by

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

Unit-1 Os

learn operating system

Uploaded by

sharmameghaa5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 72

UNIT - 1

Computer System Overview, Basic Components of


Computer System, Operating System Services, Functions of
Operating System, Types of Operating Systems: Instruction
Execution Cycle, Interrupts & System Calls, Interrupt
Processing, Processor Registers, I/O Communication
techniques
Computer System Overview
Basic Organization Of A Computer System
Input Devices

The devices which are used to enter data in the computer


systems are known as input devices. o Keyboard, mouse,
scanner, mike etc are example of input devices.
FUNCTION OF INPUT DEVICES
Accept the data from the outside worlds.
Convert that data into computer acceptable form.
Supply this data to CPU for further processing.
Output Devices

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.

FUNCTIONS OF OUTPUT DEVICES


Accept the result form the CPU.
Convert that result into human readable form.
Display the result on the output device
Storage Unit

The data & instruction have to store inside the computer


before the actual processing start. o Same way the result of
the computer must be stored before passed to the output
devices. Storage unit provides space for storing data and
instructions, intermediate results and results for output
FUNCTIONS OF MEMORY UNIT
. Store data and instructions required for processing (received
from input devices)
Store the intermediate results of processing
Store the final results of processing, before they are released to
an output device
Types of storage

1. Primary storage § Used to hold running program


instructions § Used to hold data, intermediate results, and
results of ongoing processing of job(s) § Fast in operation §
Small Capacity § Expensive § Volatile (looses data on
power dissipation)
2. secondary storage § Used to hold stored program
instructions § Used to hold data and information of stored
jobs § Slower than primary storage § Large Capacity § Lot
cheaper that primary storage § Retains data even without
power
Arithmetical & Logical Unit:
The ALU is the place where actual data & instruction are processed.
All the calculations are performed & all comparisons are made in ALU.
Performs all arithmetical & logical operations.
An arithmetic operation contains basic operations like addition, subtraction, multiplication, division.
Logical operations contains comparison such as less than, greater than, less than equal to, greater than
equal to, equal to, not equal to.
Control Unit:
It controls the movement of data and program instructions into and out of the CPU, and to control the
operations of the ALU.
In sort, its main function is to manage all the activities within the computer system. Controls the
internal parts as well as the external parts related with the computer.
CPU:
The Unit where all the processing is done is called as Central Processing Unit.
It contains many other units under it.
Main of them are:- Control Unit And ALU (Arithmetic & Logic Unit)
Arithmetic Logic Unit of a computer system is the place where
the actual executions of instructions takes place during
processing operation

Control Unit of a computer system manages and coordinates


the operations of all other components of the computer
system
Arithmetic Logic Unit (ALU)
Control Unit (CU) = Central Processing Unit (CPU)
It is the brain of a computer system
It is responsible for controlling the operations of all other units
Arithmetic Central
of a computer
Logic Unit
system Control Unit
Processing Unit
(CU)
(ALU) (CPU)
What is an Operating System?

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

OS has two parts.


(1)Kernel (2)Shell.
(1)Kernel is an active part of an OS i.e., it is the part of OS running at all times.
It is a programs which
can interact with the hardware. Ex: Device driver, dll files, system files etc.
(2) Shell is called as the command interpreter. It is a set of programs used to
interact with the application
programs. It is responsible for execution of instructions given to OS (called
commands).
View of operating system

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

System View: From the computer's point of view, an operating system is a


control program that manages the execution of user programs to prevent
errors and improper use of the computer. It is concerned with the
operation and control of I/O devices.
From the computer point of view the operating system is the program
which is most intermediate with the hardware. An operating system has
resources as hardware and software which may be required to solve a
problem like CPU time, memory space, file storage space and I/O devices
and so on. That’s why the operating system acts as manager of these
resources. Another view of the operating system is it is a control program.
A control program manages the execution of user programs to present the
errors in proper use of the computer. It is especially concerned of the user
the operation and controls the I/O devices
Types of Operating System

1. Batch Operating System


2. Multi-Programming System
3. Multi-Processing System
4. Multi-Tasking Operating System/Time-Sharing Operating
System
5. Network Operating System
6. Distributed Operating System
7. Real-Time Operating System
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.
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. 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.
2. Multiple users can share the batch systems.
3. The idle time for the batch system is very less.
4. It is easy to manage large work repeatedly in batch systems.
Disadvantages of Batch Operating
System

1. The computer operators should be well known with batch


systems.
2. Batch systems are hard to debug.
3. It is sometimes costly.
4. 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.
This type of OS is used to execute more than one jobs simultaneously by a
single processor. it increases CPU utilization by organizing jobs so that the CPU
always has one job to execute.
The concept of multiprogramming is described as follows:
1. All the jobs that enter the system are stored in the job pool( in disc). The
operating system loads a set of jobs from job pool into main memory and
begins to execute.
2. During execution, the job may have to wait for some task, such as an I/O
operation, to complete. In a multiprogramming system, the operating
system simply switches to another job and executes.
3. When that job needs to wait, the CPU is switched to another job, and so
on.
4. When the first job finishes waiting and it gets the CPU back. As long as
at least one job needs to execute, the CPU is never idle.
5. Multiprogramming operating systems use the mechanism of job
scheduling and CPU scheduling
Advantages Disadvantages of Multi-
Programming Operating System

1. Multi Programming increases the Throughput of the


System.
2. It helps in reducing the response time.
3. Multiprogramming systems provide an environment in
which various systems resources are used efficiently, but
they do not provide any user interaction with the computer
system.
Multi-Processing Operating System

Multi-Processing Operating System is a type of Operating


System in which more than one CPU is used for the execution
of resources. It betters the throughput of the System.
Multiprocessor operating systems are also known as parallel
OS or tightly coupled OS. Such operating systems have more
than one processor in close communication that sharing the
computer bus, the clock and sometimes memory and peripheral
devices. It executes multiple jobs at same time and makes the
processing faster.
The multiprocessor operating systems are classified into two categories:
1. Symmetric multiprocessing system
In symmetric multiprocessing system, each processor runs an identical copy
of the operating system, and these copies communicate with one another as
needed.
2. Asymmetric multiprocessing system
In asymmetric multiprocessing system, a processor is called master
processor that controls other processors called slave processor. Thus, it
establishes master-slave relationship. The master processor schedules the
jobs and manages the memory for entire system.
Advantages and Disadvantages of
Multi-Processing Operating System

1. It increases the throughput of the system.


2. As it has several processors, so, if one processor fails, we
can proceed with another processor.
3. Due to the multiple CPU, it can be more complex and
somehow difficult to understand.
Multi-Tasking/Time Sharing
Operating System
The multitasking(Time Sharing) operating system is a logical extension of a
multiprogramming system that enables multiple programs simultaneously. It
allows a user to perform more than one computer task at the same time.
It provides extra facilities such as:
Faster switching between multiple jobs to make processing faster.
Allows multiple users to share computer system simultaneously.
The users can interact with each job while it is running.
These systems use a concept of virtual memory for effective utilization of
memory space. Hence, in this OS, no
jobs are discarded. Each one is executed using virtual memory concept. It
uses CPU scheduling, memory
management, disc management and security management. Examples: CTSS,
MULTICS, CAL, UNIX etcd
Advantages of Multitasking (Time
Sharing) operating system

1. This operating system is more suited to supporting multiple users


simultaneously.
2. The multitasking operating systems have well-defined memory
management.
3. 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.
4. 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.
5. 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 Multitasking (Time
Sharing) 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 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 to 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. and that’s why these computers are popularly known
as tightly coupled systems.
Types of network operating system

1. Peer to peer system


2. Client and server system
Advantages of Network Operating
System

1. Highly stable centralized servers.


2. Security concerns are handled through servers.
3. New technologies and hardware up-gradation are easily
integrated into the system.
4. Server access is possible remotely from different locations
and types of systems.
Disadvantages of Network Operating
System

1. Servers are costly.


2. User has to depend on a central location for most
operations.
3. Maintenance and updates are required regularly.

Examples of Network Operating Systems are Microsoft


Windows Server 2003, Microsoft Windows Server 2008,
UNIX, Linux, Mac OS X, Novell NetWare, BSD, etc.
Distributed Operating System

These types of operating system is 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

1. Failure of one will not affect the other network


communication, as all systems are independent of each
other.
2. Electronic mail increases the data exchange speed.
3. Since resources are being shared, computation is highly fast
and durable.
4. Load on host computer reduces.
5. These systems are easily scalable as many systems can be
easily added to the network.
6. Delay in data processing reduces.
Disadvantages of Distributed
Operating System

1. Failure of the main network will stop the entire


communication.
2. To establish distributed systems the language is used not
well-defined yet.
3. 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.
4. 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.
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.

2. Soft Real-Time Systems:

These OSs are for applications where time-constraint is less strict.


Advantages of RTOS

1. Maximum Consumption: Maximum utilization of devices and systems,


thus more output from all the resources.
2. 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.
3. Focus on Application: Focus on running applications and less importance
on applications that are in the queue.
4. 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.
5. Error Free: These types of systems are error-free.
6. Memory Allocation: Memory allocation is best managed in these types of
systems.
Disadvantages of RTOS

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.

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


imaging systems, industrial control systems, weapon systems, robots, air traffic
control systems, etc.
Functions of Operating System

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

Following are the five services provided by operating systems to the


convenience of the users.
1. Program Execution
The purpose of computer systems is to allow the user to execute programs.
So the operating system provides an environment where the user can
conveniently run programs. Running a program involves the allocating and
deallocating memory, CPU scheduling in case of multiprocessing.
2. I/O Operations
Each program requires an input and produces output. This involves the use
of I/O. So the operating systems are providing I/O makes it convenient for
the users to run programs.
3. File System Manipulation
The output of a program may need to be written into new files or input
taken from some files. The operating system provides this service.
4. Communications
The processes need to communicate with each other to exchange
information during execution. It may be between processes running on
the same computer or running on the different computers.
Communications can be occur in two ways: (i) shared memory or (ii)
message passing
5. Error Detection
An error is one part of the system may cause malfunctioning of the
complete system. To avoid such a situation operating system constantly
monitors the system for detecting the errors. This relieves the user of the
worry of errors propagating to various part of the system and causing
malfunctioning.
Following are the three services provided by operating systems for ensuring the
efficient operation of the system itself.
1. Resource allocation
When multiple users are logged on the system or multiple jobs are running at the same
time, resources must be allocated to each of them. Many different types of resources are
managed by the operating system.
2. Accounting
The operating systems keep track of which users use how many and which kinds of
computer resources. This record keeping may be used for accounting (so that users can be
billed) or simply for accumulating usage statistics.
3. Protection
When several disjointed processes execute concurrently, it should not be possible for one
process to interfere with the others, or with the operating system itself. Protection involves
ensuring that all access to system resources is controlled. Security of the system from
outsiders is also important. Such security starts with each user having to authenticate him
to the system, usually by means of a password, to be allowed access to the resources.
Instruction Cycle

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:

• Fetch instruction from memory.


• Decode the instruction.
• Read the effective address from
memory.
• Execute the instruction.
Steps in the Instruction Execution
Cycle

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

An interrupt is a signal sent by hardware or software to the


processor, indicating that an event requiring immediate
attention has occurred. Interrupts are used to handle
asynchronous events, such as hardware device requests, errors,
or exceptional conditions.
Types of Interrupts

1. Hardware Interrupts: Generated by external hardware devices like


keyboard, mouse, disk controllers, and timers.
2. Software Interrupts (Traps): Triggered by software instructions or
system calls, often used for system services.
3. Exceptional Interrupts: Arise from exceptional conditions like
division by zero, invalid memory access, or illegal instruction.
Interrupt Processing

When an interrupt occurs, the CPU temporarily stops executing


its current task and transfers control to a predefined interrupt
handler routine. The interrupt processing involves the following
steps:
 Interrupt Detection: The interrupt controller detects and prioritizes
the interrupt source.
 Interrupt Request (IRQ): The interrupt controller sends an interrupt
request to the CPU.
 Interrupt Acknowledgment: The CPU acknowledges the interrupt
request, ensuring it's ready to handle the interrupt.
 Interrupt Vector: The interrupt controller provides an interrupt
vector, which is an address pointing to the interrupt handler routine
associated with the specific interrupt.
 Context Saving: The CPU saves the current context of the
interrupted process, including the program counter, registers, and
other relevant information, into the Process Control Block (PCB).
 Interrupt Handler Execution: The CPU transfers control to the
interrupt handler routine indicated by the interrupt vector.
 Interrupt Servicing: The interrupt handler executes specific actions
to handle the interrupt, which may involve interacting with hardware,
updating data structures, and performing necessary operations.
 Context Restoration: After interrupt servicing, the CPU restores the
context of the interrupted process from the PCB.
 Return from Interrupt (IRET): The CPU executes a special
instruction (IRET) to return to the interrupted process, resuming its
execution from where it was interrupted.
Benefits of Interrupts

1. Efficient utilization of CPU time by allowing the CPU to


handle multiple tasks concurrently.
2. Improved responsiveness to external events, like user inputs
or hardware device requests.
3. Enhanced system stability by enabling error and exception
handling.
Interrupts play a vital role in the operation of modern operating
systems by facilitating efficient multitasking and ensuring
timely response to events. Understanding interrupt processing
is essential for designing robust and responsive systems
Input/Output communication

Input/Output communication, often referred to as I/O, is the process of


exchanging data between a computer system and its external devices. I/O
devices can include keyboards, monitors, disk drives, network interfaces,
and more. Efficient I/O communication is crucial for the overall system
performance and user experience.
Efficient I/O communication techniques are crucial for optimal system
performance and user experience. Operating systems must manage the
complexities of various devices and provide strategies to ensure smooth and
reliable data exchange between the system and external devices.
Understanding these techniques is essential for developing high-
performance and responsive computing systems.
Challenges in I/O Communication:

Efficient I/O communication poses several challenges,


including:
 Speed Mismatch: I/O devices operate at different speeds than the
CPU, leading to potential bottlenecks.
 Varying Data Transfer Rates: Different devices have varying data
transfer rates, requiring adaptive strategies.
 Device Independence: The OS should handle I/O devices
independently of their specific characteristics.
Input/Output Communication
Techniques:

1. Programmed I/O (PIO)


2. Interrupt-Driven I/O:
3. Direct Memory Access (DMA)
4. I/O Channels
1. Programmed I/O (PIO):
 In this technique, the CPU directly controls the data transfer between
the I/O device and memory.
 The CPU repeatedly polls the device's status register to check if it's
ready to transfer data.
 Suitable for slow devices but can waste CPU cycles in polling.
2. Interrupt-Driven I/O:
 In this technique, the CPU initiates the I/O transfer and then continues
with other tasks.
 When the I/O operation is complete, the device sends an interrupt to
the CPU, prompting it to handle the completed operation.
 Reduces CPU wastage in polling but can lead to additional context-
switching overhead.
3. Direct Memory Access (DMA):
 DMA is used to offload the CPU from managing data transfers between
devices and memory.
 A DMA controller takes control of the system bus and directly transfers
data between memory and I/O devices.
 Particularly useful for high-speed data transfers, like disk I/O.
4. I/O Channels:
 I/O channels are special-purpose processors that handle I/O operations
independently of the CPU.
 They have their own internal memory and can manage data transfers
without CPU intervention.
 Suitable for complex I/O operations and high-performance computing
environments.
System Calls

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. Request device, release device: If there are multiple users of the


system, we first request the device. After we finished with the device,
we must release it.
2. Read, write, reposition: Once the device has been requested &
allocated to us, we can read, write & reposition the device.
Information maintenance:

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

1. create, delete communication connection


2. send, receive messages
3. transfer status information
4. attach or detach remote devices
Communication

There are two modes of communication such as:


Message passing model: Information is exchanged through an inter process
communication facility provided by operating system. Each computer in a network
has a name by which it is known. Similarly, each process has a process name which is
translated to an equivalent identifier by which the OS can refer to it. The get hostid
and get processed systems calls to do this translation. These identifiers are then
passed to the general purpose open & close calls provided by the file system or to
specific open connection system call. The recipient process must give its permission
for communication to take place with an accept connection call. The source of the
communication known as client & receiver known as server exchange messages by
read message & write message system calls. The close connection call terminates the
connection.
Shared memory model: processes use map memory system calls to access regions of
memory owned by other processes. They exchange information by reading & writing
data in the shared areas. The processes ensure that they are not writing to the same
location simultaneously.

You might also like