w eek t hree o perating s ystem s tructure. t opics to be discussed system components operating...
TRANSCRIPT
WEEK THREEOPERATING SYSTEM STRUCTURE
TOPICS TO BE DISCUSSED System Components Operating Systems Services User Operating System Interface System Calls Types of System Calls System Programs Operating System Design and Implementation Operating System Structure System Calls Virtual Machines Operating System Debugging Operating System Generation System Boot
OBJECTIVES To understand different components of an
operating system To describe services an operating system
provides to users, processes and other systems To discuss various ways of structuring an
operating system To explain how operating systems are installed,
customized and how they boot
DIFFERENT COMPONENTS OF AN OPERATING SYSTEM
Process Management Main-Memory Management File Management I/O System Management Secondary-Storage Management Networking Protection System Command-Interpreter System
OPERATING SYSTEM COMPONENTS Processes Management
Process can be thought as program in execution A program by itself is not a process, it is a passive entry e.g.
contents of a file stored on a disk A process is an active entity, with a program counter that
specifies which instruction to execute next CPU executes one instruction at a given time, even two
processes may be associated with one program but at no time they should be considered as two separate executable sequences
Execution is a sequential A process requires certain resources such as CPU time,
memory, files, I/O Resources can be given at the time of creation or allocated
when it is running A process is a unit of work in a system. Thus a system is a
collection of processes, some of which are operating-system processes ( those which execute system code) and the rest are user processes (those that execute user code)
PROCESS MANAGEMENT Operating system is responsible for the
following activities with respect to process management
Creating and deleting both user and system processes
Suspending and resuming processes Providing mechanisms for process
synchronizations Mechanisms for process communication Mechanisms for deadlock handling
MAIN-MEMORY MANAGEMENT Main memory is a storage area of quickly accessible data by the CPU
and I/O devices The CPU reads instructions form main memory in instruction-fetch
style, and it both reads and writes data from main memory during the data-fetch style
For a program to execute, it must be mapped to absolute addresses and loaded into memory. As the program executes, it accesses program instructions and addresses from memory by these addresses. When a program terminates, its memory space is declared available and the next program can be loaded and executed.
In order to increase CPU utilization and better user response, , we must keep several programs in memory.
There are different techniques for better memory-management such as hardware design of the system
o The operating system is responsible for the following activities with regards to main-memory management
o Keeping track of which parts of memory are being used and by whom
o Deciding which processes are to be loaded into memory when it becomes available
o Allocating and deallocating memory space as needed
FILE MANAGEMENT The most visible part of an operating system As we discussed, several types of media available
for storing files depending upon: access speed, data-transfer-rate, capacity, access methods (sequential or random)
Operating system creates an abstract logical view of the data stored on physical media
With regards to file management, the operating system is responsible for following activities:
Creating and deleting files Creating and deleting directories (folders) Provides support for manipulating files and
directories Mapping files onto to physical media Backing up files on stable (non volatile) media
I/O SYSTEM MANAGEMENT One of the purpose of an operating system is
to hide the peculiarities of I/O from user The I/O subsystems help us to achieve that.
Common subsystems are A memory-management component that
includes buffering, caching and spooling A General device driver interface Drivers for specific hardware devices
Only the device driver knows all peculiarities about a particular hardware
SECONDARY STORAGE MANAGEMENT Proper management of the disk storage is of
central important to working of a computer system.
Operating system is responsible for the following activities:
Free space management Storage allocation Disk scheduling
Disk storage must be handled efficiently
NETWORKING A distributed system is a collection of processors
that don’t share memory, peripheral devices or clock.
Many processors are connected together with communication networks. The communication network design must consider: message routing, connection strategies and other problems relating to connectivity and security
Networks provide access to shared resources. Access to a shared resource allows computation speedup, increased functionality, increased data availability, enhanced reliability and low costs
Operating system usually generalize network access as a form of file access, with the details of networking being connected in the network interface’s device driver
PROTECTION SYSTEM In an environment where multi-user and
concurrent execution of processes is permitted, it is quite obvious that various processes must be protected from one another’s activities
Mechanisms need to ensure that files, memory segments, CPU and other sources cane only be operated by only those processes which are authorized by an operating system
Protection is a mechanism to control that access of programs, processes or users to the resources by a defined computer system
An un-protected resource cannot defend against use or misuse by an unauthorized or incompetent user
COMMAND-INTERPRETER SYSTEMS An interface between a user and the operating
system Many commands to the operating system are
given by control statements A program that reads and interprets these
commands is called command-line interpreter and is often known as shell
USER INTERFACE Operating system provides as environment for execution of
programs and services to programs and users One set of operating-system provides functions which are
helpful to users: User Interface – Almost all operating systems have user
interface (UI) Varies between command line (CLI), Graphics User
Interface (GUI), Batch Program Execution – The system must be able to load
program into memory and to run that program, end execution i.e. either normally or abnormally (indicating error)
I/O Operations – A running program may require an I/O which may involve a file or I/O device
File –system Manipulation – The file system is of particular interest. Programs needs to read and write files and directories, create and delete them, search them, list file information, protect them
USER OPERATING SYSTEM INTERFACE - GUI
User-friendly desktop metaphor interface Usually, mouse, keyboard and monitor Icons represents files, programs and actions Various mouse buttons over objects in the
interface cause different actions (provide information, options, executes function, open directory also known as folder)
Invented at Xerox PARC Many systems now both include CLI and GUI
Microsoft Windows is GUI with CLI “command” shell
Apple Mac OS X as “Aqua” GUI interface with Unix kernel underneath and shells available
Solaris is CLI with optional GUI (Java Desktop, KDE)
USER OPERATING SYSTEM INTERFACE - CLI
Command Line Interface (CLI) of Command Interpreter allows direct command entry
Sometimes implemented in kernel, sometimes by system program
Sometimes multiple flavors implemented –shells
Primarily fetches a command from user and executes it
Sometimes commands built-in, sometimes just names of programs
If the later, adding new features does not require shell modification
OPERATING SYSTEM
What is an operating system?And what are its
goals?
OPERATING SYSTEM
Controller for the execution of programs with efficient utilization of resources for timely services to the users
A concept of kernel and application programs An intermediary program between a user of a
computer and the computer hardware Uses the computer hardware efficiently
OPERATING SYSTEM GOALS
Execute user programs and solve user problems easily through proper coordination and synchronization
Make the computer system convenient to use Efficient operation of the computer system
components Optimal use of computer resources Ability to evolve through hardware upgrades,
new services and fixing of problems
TWO VIEWS OF OPERATING SYSTEM
User View – Varies from system being used System View
Resource Allocator CPU Time Memory Space File storage space I/O Devices
Controls Programs Executes user programs Prevents errors and improper use Responsible for operations and control of
I/O devices
THE EVOLUTION OF OPERATING SYSTEM
Serial Processing Simple batch systems Multi-programmed batch systems Time-sharing systems Personal computer systems Parallel systems Distributed systems Real-time systems
COMPUTER-SYSTEM OPERATIONS A modern computer consists of a CPU, memory,
system bus and a number of device controllers I/O Devices and the system can execute
concurrently Each device controller is in charge of a particular
device type A device controller for each device which contains
local buffer storage and a special purpose registers A bootstrap program is required to initialize the
computer system CPU moves data from/to main memory to/from local
buffers I/O is from the device to local buffer of controller Device controller informs CPU that it has finished its
operation by causing an interrupt
COMPUTER-SYSTEM ARCHITECTURE
INTERRUPTS
What are interrupts?
COMMON FUNCTIONS OF INTERRUPTS The occurrence of an event is usually signaled by an
interrupt either the hardware or software System call or monitor call is executed to trigger an
interrupt Interrupt transfers control to the interrupt service
routine generally, through the interrupt vector, which contains the addresses of all the service routines
Interrupt architecture must save the address of the interrupted instruction
Incoming interrupts are disabled while another interrupt is being processed to prevent a lost interrupt
A trap is a software-generated interrupt caused either by an error or a user request
An operating system is interrupt driven and priority interrupts have been introduced in modern systems
INTERRUPT HANDLING When the CPU is interrupted, it stops what it is doing and
immediately transfers execution to a fix location to execute the interrupt the routine through a table of pointers which is stored in LMA (Low Memory Address)
On completion of execution of service routine, the CPU resumes the interrupted computation
LMA locations hold the addresses of the interrupt service routines (Interrupt Vector i.e. Memory Address of an Interrupt handler) for the various devices
Separate segments of code determine what action should be taken for each type of interrupt
The operating system preserves the state of the CPU by storing registers and the program counter
Determines which type of interrupt has occurred: Polling Vectored interrupt systems
Interrupts are important part of a modern computer system and should be handled immediately
System call is a method used by a process to request action by the operating system
STORAGE STRUCTURE Registers Cache Main Memory Electronic Disk Magnetic Disk Optical Disk Hard Disk Magnetic Tape
HARDWARE PROTECTION Dual-Mode Operation I/O Protection Memory Protection CPU Protection
COMPUTER NETWORKS LAN WAN