0% found this document useful (0 votes)
79 views49 pages

Lec 01

The document discusses different types of operating systems such as batch systems, multiprogrammed systems, time-sharing systems, distributed systems, real-time systems, and single-processor vs multiprocessor systems. It also defines the basic components of a computer system, the roles and objectives of an operating system, and key operating system concepts like interrupts, traps, system calls, and dual-mode operation.
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)
79 views49 pages

Lec 01

The document discusses different types of operating systems such as batch systems, multiprogrammed systems, time-sharing systems, distributed systems, real-time systems, and single-processor vs multiprocessor systems. It also defines the basic components of a computer system, the roles and objectives of an operating system, and key operating system concepts like interrupts, traps, system calls, and dual-mode operation.
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/ 49

OPERATING SYSTEM

Lecture 1
Computer System
Computer system can be divided into four components:
■ Hardware
– Provides basic computing resources
– CPU, memory, I/O devices
■ 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
– Word processors, compilers, web browsers, database systems etc.
■ Users
– People, machines and other computers
Computer System
Batch Systems
■ In Batch processing same type of jobs are batch (BATCH- a set of jobs with similar
needs) together and execute at a time
■ Users did not interact directly with the computer systems, but he prepared a job
(comprising of the program, the data, & some control information)
■ The job was submitted to the computer operator by the programmer. At some later
time the output appeared
Memory Layout
■ Resident monitor :
– initial control in monitor
– control transfers to job
– when job completes control transfers back to monitor

Operating
System

User
program
area
Multi-Programmed Systems
■ Several jobs are kept in main memory at the Operating
same time, and the CPU is multiplexed among system
them
job1
■ Figure depicts the layout of multiprogramming
system job2
■ The main memory consists of 4 jobs at a time, the
CPU executes one by one job3

job4
Multi-Programmed Systems
■ Example: Two process P1 and P2 with CPU and I/O bursts of one time unit each

CPU I/O
Burst Burst

P1
P2

P1

P2
Multi-Programmed Systems
■ Advantages:
– Efficient memory utilization
– Throughput increases
– CPU is never idle, so performance increases.
Time Sharing Systems
■ Time-sharing is a technique which enables many
people, located at various terminals, to use a
particular computer system at the same time
■ Time sharing, or multitasking, is a logical extension of
multiprogramming
■ Processor's time which is simultaneously shared
among multiple users is termed as
time-sharing
■ The operating system uses CPU scheduling and
multiprogramming to provide each user with a small
portion of a time.
Time Sharing Systems
■ Advantages:
– Provides the advantage of quick response
– Reduces CPU idle time
■ Disadvantages:
– Problem of reliability
– Question of security and integrity of user programs and data
Distributed Systems
■ Distribute the computation among several physical processors.
■ Loosely coupled system – each processor has its own local memory; processors
communicate with one another through various communications lines, such as high
speed buses or telephone lines.
■ Processors in a distributed system may vary in size and function.
■ These processors are referred as sites, nodes, computers, and so on.
Advantages of Distributed Systems
■ Resource Sharing
– With resource sharing facility, a user at one site may be able to use the
resources available at another
■ Computational speedup
– Reduction of the load on the host computer
■ Reliability
– If one site fails in a distributed system, the remaining sites can potentially
continue operating.
■ Scalability
– Adds more computers
Clustered Systems
■ Use multiple CPUs to accomplished a task
■ Clustering allows two or more systems to share storage
■ Provides high reliability
– Asymmetric clustering: one server runs the application while other servers
standby
– Symmetric clustering: all N hosts are running the application
Real-time Systems
■ A system that produce output far a given input within a well-defined time period, else
the output is useless.
■ Often used as a control device in dedicated application such as medical imaging
systems, industrial control system, plane landing system, process control in nuclear
power plant, etc.
Real-time Systems
■ Real-time systems may be either hard or soft real-time
■ The hard real-time OS guarantee that critical tasks be completed within a certain
range of time
– Ex: aircraft control systems.
■ The soft real-time OS provides some relaxation in time limit
Single-Processor System
■ Single-processor systems
– One CPU or one processing unit(a single core on a chip)
– They perform only one process at a given time, and it carries out the next
process in the queue only after the current process is completed
Multiprocessor System
■ Multiprocessor systems
– Multiple processor or one processor with multiple core
– Process more than one program simultaneously
– Multiprocessor systems are also known as parallel or tightly- coupled system
Multiprocessor System
■ Asymmetric Multiprocessing; Tasks are assigned to a specific CPU and each CPU
has its own RAM memory
■ Symmetric Multiprocessing; Tasks are assigned to any available CPU and CPU’s can
share RAM memory
■ Advantages include:
– Increased throughput
– Economy of scale
– Increased reliability
What is an Operating System?
■ A program that acts as an intermediary between a user of a computer and the
computer hardware
■ An operating system (OS) is the program that, after being initially loaded into the
computer (main memory) by a boot program, manages all the other programs in a
computer. The other programs are called applications or application programs.
Operating System Objectives
■ Convenience
– Execute user programs and make solving user problems easier
– Make the computer system convenient to use
■ Efficiency
– Use the computer hardware in an efficient manner
■ Ability to evolve
Role of Operating System
■ Government
– Provides an environment for efficient use of its resources
■ Resource allocator
– Manages all resources
– Decides between conflicting requests for efficient and fair use of the resource
■ Control program
– Controls execution of programs to prevent errors and improper use of the
computer
Interrupts and Traps
■ Interrupt
– is a signal to the processor emitted by I/O devices indicating an event that
needs immediate attention from the operating system
– Interrupts are hardware generated
■ Trap
– an event generated by CPU to get attention of the operating system.
– Caused by an error or by a user request for an I/O operation
– It is also called software-generated interrupts
Interrupts and Traps
■ In case of an interrupt or trap, CPU invokes a piece of code in the OS to service it,
known as interrupt service routine (ISR) or trap service routine (TSR)
■ When the CPU is interrupted/trap, it stops what it is doing and immediately transfers
execution to an address where the service routine for the interrupt/trap is located
■ In case of interrupt the OS preserves the state of the CPU but not in case of trap
Interrupts and Traps
Operating System Modes
■ The operating system code and user-defined code must be distinguished to ensure
the proper execution of the operating system.
■ Computer system provides hardware support to differentiate between at least two
modes of operations.
– User mode: execution done on behalf of a user.
– kernel mode: (also called monitor mode or system mode) execution done on
behalf of operating system.
■ Dual-mode operation allows OS to protect itself and other system components.
■ When an interrupt or fault occurs, or a process execute a system call, CPU switches
to monitor mode.
Dual-Mode Operation
■ Mode bit added to computer hardware to indicate the current mode: monitor (0) or
user (1).

■ Privileged instruction can be executed only in monitor mode.


Dual-Mode Operation
■ System call changes mode to kernel, return from call resets it to user.
Entry Point into Kernel
System Calls
■ System calls provide an interface between a user program and operating system
■ User process must not be given open access to the kernel code.
■ The system call interface layer contains entry point in the kernel code.
■ Any user or application request that involves access to any system resource must be
handled by the kernel code.
Types of System Calls
■ Process Control
– These types of system calls are used to control the processes
– End, abort, load, execute Create process, terminate process etc.
■ File management
– These types of system calls are used to manage files
– Create file, delete file, open, close, read etc.
■ Device management
– These types of system calls are used to manage devices
– Request device, release device, read, write etc.
Types of System Calls
■ Information maintenance
– These types of system calls are used to maintain information
– Get time or date, set time or date, get system data, set system data etc.
■ communications
– These types of system calls are used for communication
– Create, delete communication connection, send, receive messages etc.
Operating System Components
■ Process management
■ Memory management
■ Device Management
■ File Management
■ Storage management
■ Protection and security
Process Management
■ A process is a program in execution.
– Program is a passive entity, process is an active entity.
■ A process needs resources to accomplish its task.
– CPU, memory, I/O, files, initialization data, ....
Process Management
■ Process management activities:
– Scheduling processes and threads on the CPUs.
– Creating and deleting processes.
– Suspending and resuming processes.
– Providing mechanisms for process synchronization.
– Providing mechanisms for process communication.
Memory Management

■ To execute a program all (or part) of the instructions must be in memory.


■ All (or part) of the data that is needed by the program must be in memory.
■ Memory management determines what is in memory and when.
Memory Management
■ Memory management activities:
– Keeping track of which parts of memory are currently being used and by
whom.
– Deciding which processes (or parts of) and data to move into and out of
memory.
– Allocating and deallocating memory space as needed.
Device Management
■ An Operating System manages device communication via their respective drivers. It
does the following activities for device management:
– Keeps tracks of all devices. The program responsible for this task is known as
the I/O controller.
– Decides which process gets the device when and for how much time.
– Allocates the device in the most efficient way.
– De-allocates devices.
Storage Management
■ Usually disks used to store data that does not fit in main memory or data that must
be kept for a long period of time.

■ Disk management activities:


– Free-space management
– Storage allocation
– Disk scheduling
File Management
■ A file system is normally organized into directories for easy navigation and usage. An
Operating System does the following activities for file management:
– Creating and deleting files and directories.
– Mapping files onto secondary storage.
– Backup files onto stable (non-volatile) storage media.
Protection and Security
■ Protection: any mechanism for controlling access of processes or users to resources
defined by the OS.
– I/O Protection
– Memory Protection
– CPU protection
■ Security: defense of the system against internal and external attacks.
– E.g., denial-of-service, worms, viruses, identity theft, theft of service, ...
I/O Protection
■ All I/O instruction are privileged instruction.
■ Must ensure that a user process could never gain control of the computer in monitor
mode.
Memory Protection
■ Region in the main memory that a process can legally access is known as its
address space.
■ Must provide memory protection outside the address space of a process.
■ In order to have memory protection, add two register that determine the range of
legal addresses a program may access.
– Base register: holds the smallest legal physical memory address.
– Limit register: contains the size of the range.
Use of Base and limit Register
Hardware Support
CPU Protection
■ Timer and a fixed-interval clock that interrupts the CPU periodically.
– Timer is loaded with a value and decremented every clock tick.
– When timer reaches the value 0, an interrupt occurs and an ISR is executed to
switch CPU to another process.
■ Load-timer is a privileged instruction.
Operating System Services
■ OS provides users the services to execute the programs in a convenient manner.
■ User interface
– Command-line interface (CLI)
– Graphical user interface (GUI)
■ Program execution
– The system must be able to load a program into memory and to run that
program
– The program must be able to end its execution, either normally or abnormally
(indicating error).
Operating System Services
■ I/O operations
– A running program may require I/O, which may involve a file or an I/O device
– For efficiency and protection, users usually cannot control I/O devices directly.
– Therefore, the operating system must provide a means to do I/O.
■ File System Manipulation
– OS provides an interface to the user to read, write create and delete files
– OS provides an interface to the user to create/delete directories.
Operating System Services
■ Communication between processes
– OS provides the facility for exchanging the information between processes that
are executing on the same computer or on completely different computers
– Communications may be implemented via shared memory or message passing
■ Error detection and handling
– OS provides the facility of error detection and response
– Error detection occur both hardware and software levels
Operating System Services
Services for efficient system operation
■ Resource allocation
– It is the ability to allocate resources to multiple users or to multiple jobs
running at same time
■ Accounting
– It is the ability to keep track of and to record which users use how much and
what kinds of computer resources
■ Protection
– It is the ability to ensure that all access to system resources is controlled

You might also like