OS Ch-1 16092024
OS Ch-1 16092024
INTRODUCTION
INTRODUCTION
• Computer-System Organization
• Computer-System Architecture
• Operating-System Operations
• Resource Management
• Virtualization
• Distributed Systems
• Computing Environments
Car
Airplane
Printer
Washing Machine
Toaster
Compiler
Etc.
WHAT IS AN OPERATING SYSTEM?
Operating system
Controls and coordinates use of hardware among various applications and users
Application programs – define the ways in which the system resources are used to solve
the computing problems of the users
Word processors, compilers, web browsers, database systems, video games
Users
People, machines, other computers
o Machine User: For example a client/workstation uses the services provided by the
server
o For example, My computer is connected to the FB server so my computer is the
acting as a user
ABSTRACT VIEW OF COMPONENTS OF COMPUTER
WHAT OPERATING SYSTEMS DO
• Depends on the point of view
• Users want convenience, ease of use and good performance
“The one program running at all times on the computer” is the kernel, part of the
operating system
Everything else is either
A system program (ships with the operating system, but not part of the kernel) like
WIFI, Bluetooth, Calling a printer etc. OR
An application program (browser, MS power point etc.), all programs not
associated with the operating system
OS is a Resource Allocator
Manage all resources (RAM, CPU, H/D etc.)
• Computer-system operation
System buses: Transfer data between the CPU and main memory
Interrupt service routine (ISR): The processor saves its current state and jumps to the
appropriate ISR. The ISR is a piece of code that handles the interrupt and performs
any necessary actions.
Interrupt masking: While the ISR is executing, the processor may mask (disable)
other interrupts to prevent them from interfering with the current ISR.
Interrupt acknowledgment: Once the ISR is complete, the processor sends an
acknowledgment signal to the device or program to indicate that the interrupt has
been handled.
Interrupt unmasking: The processor then unmasks (enables) any interrupts that were
previously masked.
Return from ISR: The processor returns to the point in the program where it was
DMS
CPU
Memory
External devices,
• These are all connected with the help of Peripheral I/O Buses and
General I/O Buses.
The CPU run programs periodically and checks the status of each
device one-by-one
When we write the input then the device should be ready to take the
data otherwise the program should wait for some time so that the device
or buffer will be free then it can take the input.
Once the input is taken then it will be checked whether the output device
or output buffer is free then it will be printed.
This process is continued every time in transferring of the data.
A protocol for data transfer, Since it involves the CPU, the use of PIO
mode for data transfer can slow a computer down considerably.
I/O STRUCTURE: MODE OF TRANSFER
I/O STRUCTURE: MODE OF TRANSFER
I/O STRUCTURE: MODE OF TRANSFER
• I/O Interrupt
To initiate any I/O operation, the CPU first loads the registers to the
device controller. Then the device controller checks the contents of the
registers to determine what operation to perform.
There are two possibilities if I/O operations want to be executed. These
are as follows
Synchronous I/O − The control is returned to the user process after the
I/O process is completed.
Asynchronous I/O − The control is returned to the user process without
waiting for the I/O process to finish. Here, I/O process and the user
process run simultaneously.
I/O STRUCTURE: MODE OF TRANSFER
• I/O Interrupt
After the transfer is complete, CPU returns to the previous task it was
executing.
The branch address of the service can be chosen in two ways known as
vectored and non-vectored interrupt.
In vectored interrupt, the source that interrupts, supplies the branch
information to the CPU while in case of non-vectored interrupt the branch
address is assigned to a fixed location in memory.
For example: a microcontroller can be interrupted by a sensor when it has
a new value, or by a serial port when it receives data
I/O STRUCTURE: MODE OF TRANSFER
• I/O Interrupt
After the transfer is complete, CPU returns to the previous task it was executing.
Interface as converter or
interfaces
Register….give the data
parallel to CPU and get
serially
Speed
• After I/O starts, control returns to user program only upon I/O
completion
Wait instruction idles the CPU until the next interrupt
Wait loop (contention for memory access)
At most one I/O request is outstanding at a time, no simultaneous I/O
processing
• After I/O starts, control returns to user program without waiting for
I/O completion
System call – request to the OS to allow user to wait for I/O
completion
Device-status table contains entry for each I/O device indicating
its type, address, and state
OS indexes into I/O device table to determine device status and to
modify table entry to include interrupt
Storage Structure
STORAGE STRUCTURE
• Main memory – only large storage media that the CPU can access directly
Random access
Typically volatile
A semiconductor-based storage device, Solid-state technology is transforming the storage with high
speed flash memory.
Non-volatile storage
Replace traditional hard disk drives (HDDs) in computers and perform the same basic functions as a
hard drive.
Significantly faster in comparison. With an SSD, the device's operating system will boot up more
rapidly, programs will load quicker and files can be saved faster.
STORAGE STRUCTURE
• Primary Storage
Primary storage is also known as the main memory and is the memory directly
accessible by the CPU. Some primary storage devices are −
• ROM
ROM is read only memory. This memory cannot be changed, it can only be read as
required.
Since ROM is unchangeable memory, it is used by data and programs that are
frequently required and seldom changed, like the system boot program
• Cache Memory
Cache is used to store data and instructions that are frequently required by the CPU
so it doesn't have to search them in the main memory.
A small memory that is also very fast.
STORAGE STRUCTURE (CONT.)
Various technologies
• Hard Disk Drives (HDD) – rigid metal or glass platters covered with
magnetic recording material
Disk surface is logically divided into tracks, which are subdivided into sectors
The disk controller determines the logical interaction between the device and the
computer
• Non-volatile memory (NVM) devices– faster than hard disks, nonvolatile
Various technologies
Becoming more popular as capacity and performance increases, price drops
STORAGE STRUCTURE (CONT.)
• Bit
The binary number 1 or 0 is called a bit (for binary digit), which is the basic unit for storing
data in the computer memory.
The circuit being on or off at a time, a bit in the memory is always storing some kind of
data.
• Byte
A byte is a combination of 8-bits, that can store a single character of data (a letter,
numeral or special character).
The capacity if the memory of the storage is expressed in terms of number of bytes it can
hold or store.
• Word
The size of the register, is defined as the number of bits that constitute a common unit of
data
The length of a word varies from computer to computer. Generally, the larger the word, the
more powerful is the computer.
STORAGE DEFINITIONS AND NOTATION REVIEW
STORAGE DEFINITIONS AND NOTATION REVIEW
STORAGE DEFINITIONS AND NOTATION REVIEW
STORAGE HIERARCHY
• Storage systems organized in hierarchy
Speed
Cost
Volatility
• Caching – copying information into faster storage system;
main memory can be viewed as a cache for secondary
storage
• Device Driver for each device controller to manage I/O
Transfer rate is rate at which data flow between drive and computer
Speed
Cost
Volatility
• Cache Memory
Components:
CPU
Buses (A,D,C)
Memory Unit
1. Timing Signal
2. Control Signal
OPERATING-SYSTEM OPERATIONS
• Bootstrap program – simple code to initialize the system, load
the kernel
• Kernel loads
• Starts system daemons (services provided outside of the
kernel)
• Kernel interrupt driven (hardware and software)
Hardware interrupt by one of the devices
Software interrupt (exception or trap):
Software error (e.g., division by zero)
Request for operating system service – system call
Other process problems include infinite loop, processes modifying
each other or the operating system